Reputation: 33
I have an application running under 64bit OS (Windows 7). I was expecting GetSystemDirectory
to return "C:\Windows\SysWOW64". Instead, it returns "C:\Windows\system32".
How do I get it to return "C:\Windows\SysWOW64"?
Upvotes: 2
Views: 4145
Reputation: 595557
I was expecting
GetSystemDirectory
to return "C:\Windows\SysWOW64". Instead, it returns "C:\Windows\system32".
As it should be, because system32
is the official system folder, even for a 32bit app running on 64bit Windows. In that latter case, any files a 32bit app tries to access in system32
are silently redirected to SysWOW64
by the WOW64 emulator. You don't need to do anything special in your code to get that behavior. So keep using system32
whether your app is 32bit or 64bit.
If you want to get the path of the SysWOW64
folder specifically, use GetSystemWow64Directory()
instead.
Upvotes: 5
Reputation: 122
#include <Windows.h>
int main(int argv, char* args[])
{
TCHAR sysDir[MAX_PATH];
GetSystemWow64Directory(sysDir, MAX_PATH);
std::cout << sysDir << std::endl;
return 0;
}
OUTPUT:
C:\Windows\SysWOW64
Upvotes: -1