Skip to content

Instantly share code, notes, and snippets.

@takamin
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takamin/72cc136506ad402203b3 to your computer and use it in GitHub Desktop.
Save takamin/72cc136506ad402203b3 to your computer and use it in GitHub Desktop.
[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