Create a gist now

Instantly share code, notes, and snippets.

Embed
[Windows VC++] Check whether the current process is running on the x64
#include <Windows.h>
BOOL IsRunningOnX64()
{
BOOL isRunningOnX64 = FALSE;
typedef BOOL(WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
LPFN_ISWOW64PROCESS IsWow64Process =
(LPFN_ISWOW64PROCESS)GetProcAddress(
GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
if (IsWow64Process != 0) {
IsWow64Process(GetCurrentProcess(), &isRunningOnX64);
}
return isRunningOnX64;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment