Windows 7(64 位版本)上的 AppInit_DLLs
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6515006/
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
AppInit_DLLs on Windows 7 (64 bit version)
提问by steven johnson
I have written a DLL that will help me debug my app. I am running a 64 bit version of windows7. Here is what I am observing:
我编写了一个可以帮助我调试应用程序的 DLL。我正在运行 64 位版本的 windows7。这是我观察到的:
(1) If I set HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs and run the 32 bit version of my application, the DLL gets loaded and everything is okay. (2) If I set HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs and run the 64 bit version of my application, the application starts but it crashes immediately.
(1) 如果我设置 HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs 并运行我的应用程序的 32 位版本,DLL 被加载并且一切正常。(2) 如果我设置 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs 并运行我的应用程序的 64 位版本,应用程序启动但它立即崩溃。
Do you guys know any solution for this problem?
你们知道这个问题的任何解决方案吗?
回答by Martyn Lovell
AppInit_DLLs can work for 64 bit apps on Win7, but you proably aren't meeting the requirements.
AppInit_DLLs 可用于 Win7 上的 64 位应用程序,但您可能不满足要求。
a) You probably need to know this: http://msdn.microsoft.com/en-us/library/dd744762(v=VS.85).aspx.
a) 您可能需要知道这一点:http: //msdn.microsoft.com/en-us/library/dd744762(v=VS.85).aspx。
b) If it is your app and your DLL, skip the whole AppInit_DLLs mechanism which is messy and usafe, and just do your own LoadLibrary at the right time.
b) 如果是你的应用程序和你的 DLL,跳过整个 AppInit_DLLs 机制,它是凌乱和不安全的,在合适的时间做你自己的 LoadLibrary。
Martyn
马丁
回答by rustyx
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs
is the registry key for the default CPU architecture, in your case 64-bit.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs
是默认 CPU 架构的注册表项,在您的情况下为 64 位。
To hook a 32-bit process on a 64-bit OS, use:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs
要在 64 位操作系统上挂接 32 位进程,请使用:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs