使用 64 位 regsvr32 注册 32 位 DLL [英] Registering a 32 bit DLL with 64 bit regsvr32

查看:22
本文介绍了使用 64 位 regsvr32 注册 32 位 DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑以下理解

  1. 32 位进程无法加载 64 位 dll,反之亦然.
  2. 注册/注销一个DLLregsvr32在通过将目标DLL加载到其地址空间后调用入口点DllRegisterServer/DllUnregisterServer>LoadLIbrary.
  3. 在 64 位系统上,32 位版本的 regsvr32 存在于 C:WindowsSysWOW64
  1. A 32 bit Process cannot load a 64 bit dll or vice versa.
  2. For registering/unregistering a DLL regsvr32 calls the entry point DllRegisterServer / DllUnregisterServer after loading the target DLL into its address space through LoadLIbrary.
  3. 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆