windows 如何调试regsvr32编译后DLL注册异常?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/802238/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to debug regsvr32 post-compile DLL registration exception?
提问by Peter K.
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:
我正在使用 Visual Studio 2008(在 Windows 2003 Server / 32 位上)编译一个库,在生成 DLL 后,“自定义构建步骤”->“常规”执行命令行:
regsvr32 /s /c "($TargetPath)"
regsvr32 /s /c "($TargetPath)"
which generates the exception:
产生异常:
An unhandled win32 exception occurred in regsvr32.exe [212].
regsvr32.exe [212] 中发生未处理的 win32 异常。
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).
在 cmd 窗口中从命令行运行 regsvr32 会引发异常(尽管最后的数字不同)。
Any pointers appreciated!
任何指针表示赞赏!
回答by gbjbaanb
run the dll in the debugger, set regsvr32 as the debug target.
在调试器中运行 dll,将 regsvr32 设置为调试目标。
You'll want to place a breakpoint in the DllRegisterServer function.
您需要在 DllRegisterServer 函数中放置一个断点。
回答by Ion Todirel
Your code should implement DllRegisterServer, add a MessageBox there, and when you run regsvr32 it should be hit, attach to the process at that time
你的代码应该实现 DllRegisterServer,在那里添加一个 MessageBox,当你运行 regsvr32 时它应该被命中,当时附加到进程