//判断当前系统是否为64位
BOOL Is64BitSystem()
{
#ifdef _WIN64
return true;
#elif _WIN32
HMODULE hModule = LoadLibrary(TEXT("kernel32.dll"));
typedef UINT(WINAPI * _pGetSystemWow64DirectoryA)(LPSTR, UINT);
_pGetSystemWow64DirectoryA funcaddr = (_pGetSystemWow64DirectoryA)GetProcAddress(hModule, "GetSystemWow64DirectoryA");
if (funcaddr == NULL)
{
FreeLibrary(hModule);
return FALSE;
}
else
{
LPSTR lpBuffer = new char[MAX_PATH];
UINT ret = funcaddr(lpBuffer, MAX_PATH);
FreeLibrary(hModule);
delete[] lpBuffer;
return ret > 0;
}
#else
#error "我草泥马,别人都编译32位64位,就你这个孤儿非要特立独行。"
#endif
}