简体   繁体   English

64位vc ++程序似乎在32位模式下运行

[英]64bit vc++ program seems to run under 32bit mode

I created a 64bit c++ project in Visual Studio 2010 (under Windows 7 64bit); 我在Visual Studio 2010中创建了一个64位的c ++项目(在Windows 7 64bit下);

I thought I was running a 64bit application, and the following code returned true : 我以为我正在运行64位应用程序,以下代码返回true

bool is64bit = (sizeof(void*)==8);

but if I called the function IsWow64Process , it returned FALSE ... 但如果我调用函数IsWow64Process ,它返回FALSE ...

More weird things: 更奇怪的事情:

  • calling LoadLibrary() to load a dll under c:\\windows\\system32\\some.dll works well 调用LoadLibrary()来加载c:\\windows\\system32\\some.dll下的dll效果很好
  • loading a dll under c:\\windows\\sysWow64\\some.dll will fail (error code 193: some.dll is not a valid win32 application) c:\\windows\\sysWow64\\some.dll下加载一个DLL将失败(错误代码193:some.dll不是一个有效的win32应用程序)

All these failures suggest the application is running under 32bit mode, but this is against the truth the pointer type is 8-byte length 所有这些失败都表明应用程序在32位模式下运行,但这违背了指针类型为8字节长度的事实

I am confused, any help will be appreciated! 我很困惑,任何帮助将不胜感激!

calling LoadLibrary() to load a dll under c:\\windows\\system32\\some.dll works well; 调用LoadLibrary()在c:\\ windows \\ system32 \\ some.dll下加载一个dll效果很好; loading a dll under c:\\windows\\sysWow64\\some.dll will fail 在c:\\ windows \\ sysWow64 \\ some.dll下加载一个DLL将失败

Everything you say suggests that you are running 64 bit. 你说的一切都表明你正在运行64位。

In Windows 64bit, the System32 folder contains the 64 bit versions of the DLLs, and the SysWow64 folder contains the 32 bit versions . 在Windows 64位中, System32文件夹包含64位版本的DLL,而SysWow64文件夹包含32位版本 When IsWow64Process returns TRUE, it means that you're a 32bit application on a 64bit OS. IsWow64Process返回TRUE时,表示您是64位操作系统上的32位应用程序。

This is the opposite of what the names in the folder suggests, which is likely why this seems confusing. 这与文件夹中的名称所暗示的相反,这可能是为什么这看起来令人困惑。 Basically, the SysWow64 folder is the 32 bit versions for use under WoW64 , which is "Windows 32-bit on Windows 64-bit" - basically, you use the WoW64 DLLs when you run 32bit , and the normal DLLs when you run 64bit. 基本上, SysWow64文件夹是在WoW64下使用的32位版本,它是“Windows 32位Windows 64位” - 基本上, 当你运行32位时你使用WoW64 DLL,而当你运行64位时你使用普通的DLL。

Press Ctrl-Shitf-Esc to run Task Manager application. Ctrl-Shitf-Esc以运行任务管理器应用程序。 In the "Processes" tab you'll see *32 label by the name of every 32-bit process. 在“进程”选项卡中,您将看到每个32位进程名称的*32标签。 It's a one of the simplest ways of checking bitness of a process. 这是检查进程位数的最简单方法之一。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM