Forum Discussion
Excel 64BIT - DBGHELP - C/C++ COM Addin throws exception in LoadLibrary method
Hi Everyone,
I have a COM addin developed in C++ which I want to use with Office Excel 64BIT (current version is Office365 MSO 64BIT). In this COM I am calling LoadLibrary to load a library containing the business logic.
When I do this the following exception is thrown in debugger:
---------------
4534:7058 @ 159255234 - LdrpGetProcedureAddress - INFO: Locating procedure "RtlInterlockedFlushSList" by name
4534:7058 @ 159255234 - LdrpNameToOrdinal - WARNING: Procedure "SymSetDiaSession" could not be located in DLL at base 0x00007FFF56040000.
4534:7058 @ 159255234 - LdrpReportError - ERROR: Locating export "SymSetDiaSession" for DLL "C:\WINDOWS\SYSTEM32\dbgeng.dll" failed with status: 0xc0000139.
4534:7058 @ 159255234 - LdrpGenericExceptionFilter - ERROR: Function LdrpSnapModule raised exception 0xc0000139
Exception record: .exr 00000076C64F9AB0
Context record: .cxr 00000076C64F95C0
Exception thrown at 0x00007FFFB51BBEB8 (ntdll.dll) in EXCEL.EXE: 0xC0000139: Entry Point Not Found.
'EXCEL.EXE' (Win32): Unloaded 'C:\Windows\System32\wsock32.dll'
---------------
Looking up in the DLL loading process, dbgeng.dll is taken from C:\WINDOWS\SYSTEM32:
---------------
4534:7058 @ 159255000 - LdrpSearchPath - ENTER: DLL name: dbgeng.dll
4534:7058 @ 159255000 - LdrpResolveDllName - ENTER: DLL name: C:\Program Files\Microsoft Office\root\Office16\dbgeng.dll
4534:7058 @ 159255000 - LdrpResolveDllName - RETURN: Status: 0xc0000135
4534:7058 @ 159255000 - LdrpResolveDllName - ENTER: DLL name: C:\WINDOWS\SYSTEM32\dbgeng.dll
4534:7058 @ 159255000 - LdrpResolveDllName - RETURN: Status: 0x00000000
4534:7058 @ 159255000 - LdrpSearchPath - RETURN: Status: 0x00000000
4534:7058 @ 159255000 - LdrpMinimalMapModule - ENTER: DLL name: C:\WINDOWS\SYSTEM32\dbgeng.dll
'EXCEL.EXE' (Win32): Loaded 'C:\Windows\System32\dbgeng.dll'. Symbol loading disabled by Include/Exclude setting.
4534:7058 @ 159255000 - LdrpMinimalMapModule - RETURN: Status: 0x00000000
4534:7058 @ 159255000 - LdrpFindDllActivationContext - INFO: Probing for the manifest of DLL "C:\WINDOWS\SYSTEM32\dbgeng.dll" failed with status 0xc000008a
---------------
while dbghelp.dll is taken from C:\Program Files\Microsoft Office\root\Office16:
---------------
4534:7058 @ 159255187 - LdrpSearchPath - ENTER: DLL name: dbghelp.dll
4534:7058 @ 159255187 - LdrpResolveDllName - ENTER: DLL name: C:\Program Files\Microsoft Office\root\Office16\dbghelp.dll
4534:7058 @ 159255187 - LdrpResolveDllName - RETURN: Status: 0x00000000
4534:7058 @ 159255187 - LdrpSearchPath - RETURN: Status: 0x00000000
4534:7058 @ 159255187 - LdrpMinimalMapModule - ENTER: DLL name: C:\Program Files\Microsoft Office\root\Office16\dbghelp.dll
'EXCEL.EXE' (Win32): Loaded 'C:\Program Files\Microsoft Office\root\Office16\DBGHELP.DLL'. Symbol loading disabled by Include/Exclude setting.
4534:7058 @ 159255187 - LdrpMinimalMapModule - RETURN: Status: 0x00000000
4534:7058 @ 159255187 - LdrpFindDllActivationContext - INFO: Probing for the manifest of DLL "C:\Program Files\Microsoft Office\root\Office16\dbghelp.dll" failed with status 0xc000008b
---------------
This is because the search path for EXCEL.exe is as follows:
---------------
4534:7058 @ 159254625 - LdrpComputeLazyDllPath - INFO: DLL search path computed: C:\Program Files\Microsoft Office\root\Office16;C:\WINDOWS\SYSTEM32;C:\WINDOWS\system;C:\WINDOWS;...
---------------
There seems to be a mismatch between dbghelp.dll version part of the Office installation (C:\Program Files\Microsoft Office\root\Office16\dbghelp.dll) and the one used by the system (C:\windows\system32\dbghelp.dll). The latter contains symbol SymSetDiaSession which is being needed by C:\WINDOWS\SYSTEM32\dbgeng.dll but the Office version does not.
Please advice how this can be fixed. One solution I am thinking of is to remove the dbghelp.dll from the Office installation but unfortunately I cannot do that on my work account installation since there I cannot change the installation folder (due to admin rights).
Thank you.