I have a c# solution that makes use of a cpp COM object. Both the COM object and the c# application are specifically built for a 64-bit system. When I run from VS 2010, the solution works properly. However, after I install it on a different system (64 bit), the COM object is not found.
I figured this was because it didn't get registered during the install, but I seem to be having trouble doing that. When I try
regsvr32 ComObject.dll
I get an error stating that "The module 'ComObject.dll' failed to load. Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent .DLL file.
I am calling regsvr32 from the directory the dll resides in, and I triple-checked that the name was typed correctly. I tried registering it in the installer, setting the dll Register switch to vsdrfCOM, and got the warning "Unable to create registration information for file named 'ComObject.dll'. Most likely this is because the dll was built in a separate solution and added to this solution as a resource.
Consequently, I can install it on my dev system, and it runs fine. I assume this is because VS already registered the dll. (currently, the dll is not a part of the installer as it was causing problems, so I copied the one in the debug folder.
Does anyone have any ideas what I might be doing wrong?
Additional Information:
Based on instructions from David Heffernan, I ran Dependency Walker the correct way. Below are the last couple lines before I get the error saying "entry-point DllRegisterServer was not found."
...
GetProcAddress(0x000007FEFCBB0000 [UXTHEME.DLL], "DrawThemeText") called from "COMCTL32.DLL" at address 0x000007FEFCC2FD99 and returned 0x000007FEFCBB61F8.
GetProcAddress(0x000007FEFCBB0000 [UXTHEME.DLL], "EndBufferedAnimation") called from "COMCTL32.DLL" at address 0x000007FEFCC2FD99 and returned 0x000007FEFCBB4F98.
GetProcAddress(0x000007FEFCBB0000 [UXTHEME.DLL], "GetBufferedPaintDC") called from "DUSER.DLL" at address 0x000007FEFC58069D and returned 0x000007FEFCBC0BC0.
GetProcAddress(0x000007FEFCBB0000 [UXTHEME.DLL], "GetBufferedPaintTargetDC") called from "DUSER.DLL" at address 0x000007FEFC58069D and returned 0x000007FEFCBC0B5C.
GetProcAddress(0x000007FEFCBB0000 [UXTHEME.DLL], "EndBufferedPaint") called from "DUSER.DLL" at address 0x000007FEFC58069D and returned 0x000007FEFCBB4F98.
GetProcAddress(0x000007FEFC570000 [DUSER.DLL], "FindGadgetFromPoint") called from "COMCTL32.DLL" at address 0x000007FEFCC2FD99 and returned 0x000007FEFC581F40.
GetProcAddress(0x000007FEFC570000 [DUSER.DLL], "ForwardGadgetMessage") called from "COMCTL32.DLL" at address 0x000007FEFCC2FD99 and returned 0x000007FEFC582CAC.
After pressing OK, I get:
LoadLibraryW("comctl32.dll") called from "USER32.DLL" at address 0x00000000779A91DC.
LoadLibraryW("comctl32.dll") returned 0x000007FEFCC10000.
GetProcAddress(0x000007FEFCC10000 [COMCTL32.DLL], "RegisterClassNameW") called from "USER32.DLL" at address 0x00000000779A91F9 and returned 0x000007FEFCC38024.
GetProcAddress(0x000007FEFCBB0000 [UXTHEME.DLL], "BufferedPaintStopAllAnimations") called from "COMCTL32.DLL" at address 0x000007FEFCC2FD99 and returned 0x000007FEFCBCE408.
GetProcAddress(0x000007FEFCBB0000 [UXTHEME.DLL], "BufferedPaintUnInit") called from "COMCTL32.DLL" at address 0x000007FEFCC2FD99 and returned 0x000007FEFCBBFA04.
GetProcAddress(0x000007FEFC570000 [DUSER.DLL], "DisableContainerHwnd") called from "COMCTL32.DLL" at address 0x000007FEFCC2FD99 and returned 0x000007FEFC57A38C.
GetProcAddress(0x000007FEFCBB0000 [UXTHEME.DLL], "BufferedPaintUnInit") called from "DUSER.DLL" at address 0x000007FEFC58069D and returned 0x000007FEFCBBFA04.
GetProcAddress(0x000007FEFC570000 [DUSER.DLL], "DUserFlushMessages") called from "COMCTL32.DLL" at address 0x000007FEFCC2FD99 and returned 0x000007FEFC57A8A0.
GetProcAddress(0x000007FEFC570000 [DUSER.DLL], "DUserFlushDeferredMessages") called from "COMCTL32.DLL" at address 0x000007FEFCC2FD99 and returned 0x000007FEFC57A830.
GetProcAddress(0x000007FEFC570000 [DUSER.DLL], "DeleteHandle") called from "COMCTL32.DLL" at address 0x000007FEFCC2FD99 and returned 0x000007FEFC574BB8.
GetProcAddress(0x00000000779A0000 [USER32.DLL], "UnregisterMessagePumpHook") called from "DUSER.DLL" at address 0x000007FEFC57B8A9 and returned 0x00000000779A8564.
DllMain(0x0000000180000000, DLL_PROCESS_DETACH, 0x0000000000000000) in "MAPIEX64.DLL" called.
DllMain(0x0000000180000000, DLL_PROCESS_DETACH, 0x0000000000000000) in "MAPIEX64.DLL" returned 1 (0x1).
DllMain(0x000007FEFB5F0000, DLL_PROCESS_DETACH, 0x0000000000000000) in "MAPI32.DLL" called.
DllMain(0x000007FEFB5F0000, DLL_PROCESS_DETACH, 0x0000000000000000) in "MAPI32.DLL" returned 1 (0x1).
DllMain(0x0000000051AF0000, DLL_PROCESS_DETACH, 0x0000000000000000) in "MFC100.DLL" called.
DllMain(0x0000000051AF0000, DLL_PROCESS_DETACH, 0x0000000000000000) in "MFC100.DLL" returned 1 (0x1).
DllMain(0x000007FEF9E60000, DLL_PROCESS_DETACH, 0x0000000000000000) in "MSIMG32.DLL" called.
...
Exited "REGSVR32.EXE" (process 0x23A0) with code 4 (0x4).
There is no specific error message outside of the mention of DllRegisterServer. I did run as administrator. While running, I got an additional error in the module list: Error opening file. The system cannot find the path specified. That makes sense since it is an empty string. This has a questionmark next to it, so I assume it is delay-load.
I ran Dependency Walker again on regsvr32.exe, and got the following error:
LoadLibraryExW("C:\Program Files\Project\ComObject.dll", 0x0000000000000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).
I also found these errors at the top of the log file:
Error: Modules with different CPU types were found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
Thank you all for your help.