views:

282

answers:

4

Hi All. I have written a COM dll, and wish to register it using

regsvr32 myComdll.dll

I get an error :

DllRegisterServer failed, Return code was: 0xc0000005

I want to debug my DllRegsiterServer function, but I do not know how to set up Visual Studio 2008 to run regsvr32 in debug mode...

Thanks

Roey

+3  A: 

1 set regsvr32 as you exe to start

2 Set the arguments in visual studio to be the path to your debug dll

3 set a breakpoint in the register function.

4 Start Debugging

rerun
+2  A: 

Project + Properties, Debugging, set Command = Regsvr32.exe $(TargetPath). Set a breakpoint on your DllRegisterServer function or use Debug + Exceptions, check Win32 Exceptions. Press F5 to get it going.

Hans Passant
A: 

The other answers are good, but there's always old reliable Sleep() - you insert Sleep() call as the first statement of the function of interest (DllRegisterServer() in your case) and recompile the project. Then you set a breakpoint into the next statement, run regsvr32 and attach the debugger to it. regsvr32 calls the function and after Sleep() returns execution is stopped on the next statement.

Nothing to setup, but requires recompliling.

sharptooth
A: 

The first answer worked for me. This site is really helpful.

dor