views:

880

answers:

1

I'm using Visual Studio 2008 (on Windows 2003 Server / 32 bit) to compile a library and after the DLL is produced the "Custom Build Step" -> "General" executes a command line:

regsvr32 /s /c "($TargetPath)"

which generates the exception:

An unhandled win32 exception occurred in regsvr32.exe [212].

This throws up a debug session, which shows remarkably little information.

Running the regsvr32 from the command line in a cmd window throws an exception (though the number at the end is different).

Any pointers appreciated!

+7  A: 

run the dll in the debugger, set regsvr32 as the debug target.

You'll want to place a breakpoint in the DllRegisterServer function.

gbjbaanb
Hehe, I thought that would be obvious! :)
leppie
@leppie: :-) Not to me! I would have thought the automatic debug session would show the same information, which it doesn't.
Peter K.
@gbjbaanb Thanks! That shows much more information... though for some reason the DllRegisterServer function doesn't seem to get called.
Peter K.
if its not getting called, you might not be debugging the 'right' dll. Pass the full path to it in your regsvr32, and working directory settings.
gbjbaanb
@gbjbaanb Much appreciated! What appears to be happening is the DLL includes another library which does some static initializations. The static initializations are where the exception is being thrown. The DLL entrypoint is _DllMainCRTStartup.
Peter K.