Setting breakpoint on OLE32 API's in Windows 10 - windows-10

I'm trying to set a breakpoint on CLSIDFromProgID while debugging Excel (32 bit) as I'm looking into an add-in issue. So far I haven't figured out how to do it on Win10. Both the Visual Studio (17) debugger and WinDbg say they have loaded the symbols for ole32.dll. I've tried:
in WinDbg:
ole32!CLSIDFromProgID
ole32!_CLSIDFromProgID
ole32!_CLSIDFromProgID#8
CLSIDFromProgID
_CLSIDFromProgID
_CLSIDFromProgID#8
in visual studio:
{,,ole32.dll}CLSIDFromProgID
{,,ole32.dll}_CLSIDFromProgID
{,,ole32.dll}_CLSIDFromProgID#8
CLSIDFromProgID
_CLSIDFromProgID
_CLSIDFromProgID#8
In some cases it seemed to set a breakpoint but it was actually in some other module so that didn't help. If I view the exported CLSIDFromProgID in ole32.dll on Win10 I see:
CLSIDFromProgID (forwarded to api-ms-win-core-com-l1-1-0.CLSIDFromProgID)
When I use the DBH tool included with WinDbg to list the symbols in ole32.pdb, the only CLSIDFromProgID symbol I see is:
_imp__CLSIDFromProgID
while debugging Excel and having already executed the code which calls CLSIDFromProgID I don't see module api-ms-win-core-com-l1-1-0.dll loaded.
Anyone successful putting a breakpoint of any of these forwarded API's?
[Edit]
By the way, if you want Excel to call CLSIDFromProgID you can enter the following in a cell:
=RTD("MyBogus.ProgId", "", "Foo")
Thanks,
Nick

Related

CallStack panel is missing in VSCode-lldb when debugging

I am debugging an ARM64 process written in Rust on Mac M1 , ussng vscode-lldb extension in VSCode.
I can see panels including Variables/Breakpoints/Modules. But the Callstack panel is missing. I want to look for the function calling the current function. Please how to find the Callstack panel in VSCode-lldb extention? Currrently I have to execute thread backtrace in debugging console to view the frames

Excel 2016 VBA failed calling vs2015 c++ dll

Recently upgraded to a new PC with Win 10 pro, Excel 2016 coming with Office365, vs2015 community. Built a very simple vc++ dll with just one function exported in def file. The code is very simple but would still post here to give a content and make sure there's no problem there.
//also tried __declspec(dllexport) double sumCPP(double a, double b) without .def file
double __stdcall sumCPP(double a, double b)
{
return a + b;
}
'VBA
Public Declare PtrSafe Function sumCpp Lib "C:\MyTestProject\x64\Debug\DllTest.dll" (ByVal a As Double, ByVal b As Double) As Double
But a call from VBA results Run-time error '48': File not found: C:\MyTestProject\x64\Debug\DllTest.dll.
The source code of a more complicated dll project can be built to exe that runs fine, but whose dll prompted this original failure calling dll problem. Any suggestion where to look at? I've tried depends.exe with many supposedly false alarms and dumpbin /dependents but not clear how to use the result. I wonder if this is related to some vs2015 redistributable not in system PATH. I don't see any there but haven't tried to add them yet, as there seem to be too many.
Is there any other option to delegate heavy computation and TCP/IP socket besides using vc++ dll? I don't know but can consider C#, while python would be preferred. Since those dll functions are intended to be called many times in VBA, a system call to vc++ exe doesn't seem to be efficient.
Great thanks in advance!
Since the machine is new so I reset it removing all data. Then I installed Office 2016 64bit and VS Community 2015 from scratch and built the 64bit dll again. This time the error is Run-time error '453' Can't find DLL entry point. Can't find any obvious missing dependent dll by either dumpbin.exe /dependents or depends.exe.
Try change build configuration from "Debug" to "Release"

Catel examples load very slowly in visual studio

Does anybody know why the Catel Framework examples run so slowly when launched from Visual Stuio? When running any of the demo apps, load time is extremely slow (around 45 seconds). However, running the .exe directly, outside of VS is as fast as one would expect (< 2 sec).
System: Windows 7 Pro x64, Visual Studio 2012 Pro
Edit
I narrowed down the problem by reducing the App.xaml.cs code to this:
protected override void OnStartup(StartupEventArgs e)
{
var serviceLocator = IoC.ServiceLocator.Default;
}
..and set a breakpoint at the opening brace of the method, after F5 it takes 40 seconds to hit that breakpoint. If I comment-out that servicelocator line and then run, the breakpoint is hit almost instantly.
Edit 2
..ok, to narrow it down further: any reference to Catel.Core will cause the huge delay. When I have the Catel reference line uncommented, the following extra lines are seen in the Output window:
'CatelLoggingTinker.vshost.exe' (Managed (v4.0.30319)): Loaded 'c:\users\bruce.tw\documents\visual studio 2012\Projects\CatelLoggingTinker\CatelLoggingTinker\bin\Debug\Catel.Core.dll', Symbols loaded.
'CatelLoggingTinker.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Accessibility\v4.0_4.0.0.0__b03f5f7f11d50a3a\Accessibility.dll'
'CatelLoggingTinker.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Security\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Security.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread '<No Name>' (0x3d24) has exited with code 0 (0x0).
'CatelLoggingTinker.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'CatelLoggingTinker.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.SqlXml\v4.0_4.0.0.0__b77a5c561934e089\System.Data.SqlXml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'CatelLoggingTinker.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\UIAutomationProvider\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationProvider.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'CatelLoggingTinker.vshost.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods Assembly'
If my only line in OnStartup is
Catel.Collections.ListDictionary<int, int> cc = new Catel.Collections.ListDictionary<int, int>();
... then the output window first shows that Catel.Core.dll is loaded right away, but then UIAutomationProvider.dll takes ages to appear.
Is there something wrong with my GAC?
I also struggled with this Problem (in fact on many Computers i tried it out!).
My solution was the following:
in VS "Debug-> Options and Settings":
Debugging -> Symbols:
choose Option "All modules, unless excluded".
Add the following to the exclude list:
Catel.Core.dll
Catel.Extensions.Controls.dll
Catel.MVVM.dll
(and whichever Catel module you happen to reference).
The strangest thing: after i did this once, i can remove those dll from the exclude list, and still start Debugging fast :-/
(although this might Change after next reboot....idk)
But i Keep them in exclude list anyways, cause i don't Need to load those Modules at all - they should be "bugfree" afterall, at least shouldnt be in need to debug by me....
Regards
Johannes Colmsee
Update: it turns out you can easily disable loading of all Catel dll's by only specifying "Catel.*.dll" in the excluded module list
Another nice side-effect by this is, that you wont be bothered by those "Manifest Resouce stream not found exceptions" or the "ThreadAbortException" (when PleaseWaitService finishes) (all for Debug Settings "Break on Thrown Exceptions")
A few hints:
Performance considerations
Check if the debug logger is taking too much time (the output window is trying to keep up, slowing things down)
Check if you have symbols enabled, then it might be visual studio trying to load source symbols (see docs)

Visual Studio 2012 undocumented warning C4447

dllmain.cpp(16): warning C4447: 'main' signature found without threading mode
l. Consider using 'int main(Platform::Array<Platform::String^>^ args)'.
Above is a warning I got from building a Windows Store App DLL project. I didn't change anything in that default dllmain.cpp file except for including my own version of pch.
The documentation for this warning (along with many VS2012 errors/warnings) is nowhere to be found on MSDN and here is the only relevant link I can find:
http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/6daa9587-fe54-4e84-a8b9-0e5c52c2f6e8/
and the op there didn't get an answer.
If anyone knows what it means and how to fix it, it would be great!
As far as I can tell, you can safely ignore the warning. The compiler cribs when it sees a Win32-style DllMain being compiled using the /ZW flag (Consume Windows Runtime Extensions). However, the function gets called as you'd normally expect.
Alternatively, you can work around the warning by compiling dllmain.cpp without /ZW. You might need to adjust the PCH settings for this to properly work. This is the path taken by the DLL (Windows Store apps) C++/CX project template in Visual Studio.
Incidentally, the reason you do not get the warning when you're trying to build a Windows Runtime Component project (which builds everything using /ZW) is that a Windows Runtime Component doesn't declare a DllMain. This is not to say that it can't; it just picks up the dummy DllMain that the CRT defines (which basically turns off per-thread initialization and reports success).

How to get rid of LNK2019 unresolved external symbol errors with opencv and vs2012

I'm a visual basic programmer trying to get a visual c++ up and running with some source code I found that uses OpenCV. I'm not very experienced at all with c++. I'm getting unresolved external symbol errors and I've spent hours reading every article I can find on here about it, and every answer is...
"don't link x86 with x64 libs, or vise versa" or
"add x references to preferences->linker" or
"add your lib/dll files to the project folder, and then add them to your solution" or
"obviously you didn't add the libs to your linker".
I've already done all of the following, and it didn't work...
1) I added "c:\opencv\build\x64\vc11\staticlib;%(AdditionalLibraryDirectories)" to my "Additional Library Directories" in Project->Preferences->Linker->General. Didn't help a bit.
2) I tried the above with the x86 directory instead, didn't help a bit. So the theories that it's a x64 / x86 problem doesn't seem to be the answer.
3) I added "opencv_calib3d244d.lib;opencv_contrib244d.lib;opencv_core244d.lib;opencv_features2d244d.lib;opencv_flann244d.lib;opencv_gpu244d.lib;opencv_haartraining_engined.lib;opencv_highgui244d.lib;opencv_imgproc244d.lib;opencv_legacy244d.lib;opencv_ml244d.lib;opencv_nonfree244d.lib;opencv_objdetect244d.lib;opencv_photo244d.lib;opencv_stitching244d.lib;opencv_ts244d.lib;opencv_video244d.lib;opencv_videostab244d.lib;%(AdditionalDependencies)" to my Project->Preferences->Linker->Input, for Debug(active). Didn't help.
4) I tried the above with the "lib" directory instead of the "staticlib" directory. Didn't help a bit.
5) I tried copying all the debug version of the *.lib files from the lib directory into my project folder, and Project->Add->Existing Item to add them to my project. Didn't help.
6) I added "c:\opencv\build\include;%(AdditionalIncludeDirectories)" to my Project->Preferences->C/C++->General->Additional Include Directories. Didn't help.
It does not appear to be any of these things. Does anyone know a solution to this error that does not involve any of these things I already tried?
Here are some of the errors I'm getting:
Error 16 error LNK2019: unresolved external symbol _cvCreateImage referenced in function "struct _IplImage * __cdecl loadFloatImage(char const *)" (?loadFloatImage##YAPAU_IplImage##PBD#Z) C:\dev\CPP_console\CPP_console\FeaturesMain.obj CPP_console
Error 17 error LNK2001: unresolved external symbol _cvCreateImage C:\dev\CPP_console\CPP_console\TextDetection.obj CPP_console
Error 18 error LNK2019: unresolved external symbol _cvReleaseImage referenced in function "struct _IplImage * __cdecl loadFloatImage(char const *)" (?loadFloatImage##YAPAU_IplImage##PBD#Z) C:\dev\CPP_console\CPP_console\FeaturesMain.obj CPP_console
I found the solution. VS2012 is glitched. I thought my project was set to x64, because when I clicked on Build -> Configuration Manager -> Platform, there was no other option for platform except "Win32" and "Edit". When I clicked "Edit", it said that the platform was x64, but that it had copied settings from "Win32". This appears to be a glitch in VS2012. Fact is, I was NOT editing the current platform, even though I was clicking the "edit" button. Rather, it was creating a NEW platform. But because I had clicked the edit button, I thought it was telling me that my platform was x64, because that's what it had selected. But no, it was creating a new platform... and it really should not say that the project could be x64, yet copying settings from Win32! Anyway, so multiple glitches appear to be there in VS2012. So to fix my problem, I had to click the "edit" link, and tell it to copy settings from "" instead of from Win32 (blank is the only other option). This created a new platform option called x64, and changed it to show that my platform was now x64. Also, doing this magically made a button called "new" appear next to the "edit" button in the platform drop-down, and the "edit" button no longer acts like a new button (it no longer gives the option to "copy settings from __". But the "new" button still allows you to create a x64 platform, yet copy settings from Win32, which is stupid. But at least now when I click edit, it actually acts a bit more like an edit button. VS2012 is bugged in this menu area. Anyway, all my link errors went away when I got it fully changed to x64, since I am using a x64 version of OpenCV. If anyone else is using an x64 version of OpenCV: make sure your "Platform" says x64, not Win32, or it will give your LNK errors.

Resources