Regsvr32 在 Windows 7 上崩溃
我有一个 x64(64 位)COM dll。当尝试在 Windows 7 上使用 Regsvr32 注册它时 - Regsvr32 崩溃。
Regsvr32 在具有管理权限的 cmd 下运行(“以管理员身份运行”),我尝试了 32 位和 64 位 cmd.exe 和 regsvr.exe,甚至是两台不同的 PC,它总是相同的。
调试崩溃的 Regsvr32 报告发生缓冲区溢出,可能是什么问题?
都一样,但是编译为 Win32(32 位)工作正常并且注册没有问题
I have an x64 (64-bit) COM dll. When trying to register it with Regsvr32 on Windows 7 - Regsvr32 crashes.
Regsvr32 is run under cmd with administrative priviliges ("run as administrator"), I tried both 32 and 64bit cmd.exe and regsvr.exe, even two different PCs and it is always the same.
Debugging the crashed Regsvr32 reports that buffer overrun has occured, what can be the problem?
All the same, but compiled as Win32 (32-bit) works fine and has no problems in registering
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当编译为 64 位时,该 DLL 中的
DllRegisterServer()
的实现很可能会崩溃。如果您有 DLL 的源代码,最好的办法是在执行代码时对其进行调试并解决问题的根本原因。这可能是当代码不是以位数无关(32 位/64 位可移植)方式编写时通常发生的任何错误。
Most likely the implementation of
DllRegisterServer()
in that DLL crashes when compiled for 64 bit.If you have the source code for the DLL your best bet is to debug the implementation code as it executes and resolve the root cause of the problem. This can be any error typically occurring when code is not written in bitness-agnostic (32-bit/64-bit portable) manner.
显然,问题在于缓冲区溢出。现在,Win32 和 Win64 进程的内存布局将有所不同,尤其是 ASLR。因此,您不能肯定地说缓冲区溢出会对 Win32 产生相同的影响。对于像 Regsvr32 这样的东西尤其如此,它将调用 DLL 中的一个函数并退出。这限制了缓冲区溢出损坏数据的时间。
解决方案当然是修复缓冲区溢出。
Obviously, the problem is that you have a buffer overrun. Now the memory layouts of Win32 and Win64 processes will differ, especially with ASLR. You can't therefore say with certainty that the buffer overflow will have the same effects on Win32. This is especially true for something like Regsvr32, which will call one function in your DLL and exit. That limits the time in which the buffer overflow can damage data.
The solution is of course to just fix the buffer overrun.