Registering a 32 bit DLL with 64 bit regsvr32(使用 64 位 regsvr32 注册 32 位 DLL)
问题描述
考虑以下理解
- 32 位进程无法加载 64 位 dll,反之亦然.
- 注册/注销一个DLL
regsvr32在通过将目标DLL加载到其地址空间后调用入口点.DllRegisterServer/DllUnregisterServer>LoadLIbrary - 在 64 位系统上,32 位版本的 regsvr32 存在于
C:WindowsSysWOW64
- A 32 bit Process cannot load a 64 bit dll or vice versa.
- For registering/unregistering a DLL
regsvr32calls the entry pointDllRegisterServer/DllUnregisterServerafter loading the target DLL into its address space throughLoadLIbrary. - On a 64 bit System, 32 bit version of regsvr32 is present in
C:WindowsSysWOW64
但是在我的 2008 R2 Box 上,我能够通过 64 位 regsvr32 注册一个 32 位 dll.这怎么可能?我错过了什么吗?
But then on my 2008 R2 Box, I was able to register a 32 bit dll by the 64 bit regsvr32. How was that possible? Am I missing something?
我想在屏幕截图中突出显示的示例是对话框弹出的最后一个示例.
The example I wanted to highlight in the screenshot was the last for which the Dialog pops up.
推荐答案
这应该解释它是如何发生的:
This should explain how it happens exactly:
(来源:alax.info)
regsvr32 将在内部启动它的另一个位数孪生,以匹配 DLL 的位数.这样注册就成功了.您无需关心是启动 32 位还是 64 位版本的 regsvr32,因为它会处理不匹配问题.
regsvr32 will start it's another bitness twin internally to match the bitness of the DLL. This is how registration succeeds. You don't need to care whether you start 32-bit or 64-bit version of regsvr32 because it will take care of mismatch.
当你从 Visual Studio 作为调试主机启动 regsvr32 时,你需要注意的情况.您需要正确的位数,因为实际注册的子进程将在调试器之外运行,您将无法单步执行您的代码.
The scenario when you need to care is when you start regsvr32 from Visual Studio as debugging host. You want correct bitness there, because child process with actual registration will run outside of debugger and you won't be able to step your code through.
这篇关于使用 64 位 regsvr32 注册 32 位 DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 64 位 regsvr32 注册 32 位 DLL
基础教程推荐
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- CString 到 char* 2021-01-01
