SystemStats::is64Bit


#1

SystemStats::is64Bit would be handy. It’s useful if you’re doing things like running 32-bit code on a 64-bit OS.

Here’s a Windows version:

[code]#ifdef _WIN64

bool SystemStats::is64Bit()
{
return true;
}

#else

typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);

bool SystemStats::is64Bit()
{
LPFN_ISWOW64PROCESS
fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(“kernel32”),“IsWow64Process”);

BOOL bIsWow64 = FALSE;

if (NULL != fnIsWow64Process)
{
fnIsWow64Process(GetCurrentProcess(),&bIsWow64);
}

return FALSE != bIsWow64; // convert from BOOL to bool

}

#endif

[/code]


#2

Ok, thanks Matt, I’ll maybe pop that in there.


#3