- 注册时间
- 2010-7-22
- 最后登录
- 2015-10-22
- 在线时间
- 2 小时
编程入门
- 魔鬼币
- 694
|
BOOL Is64BitOS()
{
typedef VOID (WINAPI *LPFN_GetNativeSystemInfo)( __out LPSYSTEM_INFO lpSystemInfo );
LPFN_GetNativeSystemInfo fnGetNativeSystemInfo = (LPFN_GetNativeSystemInfo)GetProcAddress( GetModuleHandleW(L"kernel32"),"GetNativeSystemInfo");
if(fnGetNativeSystemInfo)
{
SYSTEM_INFO stInfo = {0};
fnGetNativeSystemInfo( &stInfo);
if( stInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64
|| stInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
{
return TRUE;
}
}
return FALSE;
}
BOOL Is64BitPorcess(DWORD dwProcessID)
{
if (!Is64BitOS())
{
return FALSE;
}else
{
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION,FALSE,dwProcessID);
if(hProcess)
{
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress( GetModuleHandleW(L"kernel32"),"IsWow64Process");
if (NULL != fnIsWow64Process)
{
BOOL bIsWow64 = FALSE;
fnIsWow64Process(hProcess,&bIsWow64);
CloseHandle(hProcess);
if (bIsWow64)
{
return FALSE;
}
else
{
return TRUE;
}
}
}
}
return FALSE;
}
|
|