这里需要用到系统链接库的kernel32.dll里的函数:GetNativeSystemInfo。这个函数的参数
LPSYSTEM_INFO 结构体
定义函数指针
typedef void (WINAPI *LPFN_PGNSI)(LPSYSTEM_INFO);
BOOL IS64BIT_OS
{
BOOL bRetVal = FALSE; SYSTEM_INFO si = { 0 }; LPFN_PGNSI pGNSI = (LPFN_PGNSI) GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "GetNativeSystemInfo"); if (pGNSI == NULL) { return FALSE; } pGNSI(&si); if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 || si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64 ) { bRetVal = TRUE; } return bRetVal;
}