DllRegisterServer error 0xc0000005, (C++ COM Dll).

2019-08-13 23:17发布

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条回答
霸刀☆藐视天下
2楼-- · 2019-08-13 23:58

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.

查看更多
做个烂人
3楼-- · 2019-08-14 00:01

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

查看更多
Anthone
4楼-- · 2019-08-14 00:04

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.

查看更多
登录 后发表回答