How to detect 64-bit OS
On 64-bit Windows the 32-bit Windows-based applications run under WOW64 x86 emulator. WOW64 isolates 32-bit applications from 64-bit applications, which includes preventing file and registry collisions. Console, GUI, and service applications are supported. However, 32-bit processes cannot load 64-bit DLLs, and 64-bit processes cannot load 32-bit DLLs.
A 32-bit application can detect whether it is running under WOW64 by calling the IsWow64Process function. The application can obtain additional information about the processor by using the GetNativeSystemInfofunction.
The IsWow64Process function is only included in Windows OS that have 64-bit versions. To avoid an error we have to check for it presence with GetProcAddress / GetModuleHandleWIN API functions before it can be called.
| This is sample code. Add error handling and adjust to your requirements as necessary. | 
Comments
MSDN Reference for IsWow64Process()
The IsWow64Process() is fine
IOW, just checking for presence of IsWow64Process() function in the Kernel32.dll is not reliable way to detect 64-bit OS. OTOH, using the IsWow64Process() in 32-bit application to detect 64-bit OS is fine.
You're mistaken. WOW64 is the
Mistaken about what? This
Your statement "using the
The code is Visual FoxPro. Do
Very useful code to determine 64bits OS
Thanks for sharing.
Thank you for sharing this code
Thank you for sharing; Your VFP contributions are numerous and always excellent!!!
Greetings from San Juan, Puerto Rico - USA
thanks for the nice sharing
Thanks for sharing the code
Thanks for sharing the code to detect OS 64 bits, very much useful to me, for the application I am doing, which has module that doesn't work on 64 bit.
Form: Di
help
So basically i need to differentiate between xp 32, xp 64,vista32 and vista 64.
Based on this i want to install specific system drivers.
How can I do this ? Is registry entries can be used if yes which one?
Any help is appreciated.
Thanks
See
The windows API function
BOOL WINAPI GetVersionEx(
__inout LPOSVERSIONINFO lpVersionInfo
);
typedef struct _OSVERSIONINFOEX {
DWORD dwOSVersionInfoSize;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
DWORD dwBuildNumber;
DWORD dwPlatformId;
TCHAR szCSDVersion[128];
WORD wServicePackMajor;
WORD wServicePackMinor;
WORD wSuiteMask;
BYTE wProductType;
BYTE wReserved;
} OSVERSIONINFOEX, *POSVERSIONINFOEX, *LPOSVERSIONINFOEX;