Menu

Jak sprawdzić czy system jest w wersji 64bit?

2024-07-27 - System
//---------------------------------------------------------------------------
bool __fastcall TForm1::Is64bit(void) {
 
    bool ret = false;
    try {
        wchar_t str[100];
        UINT uSize = 100;
        if (GetSystemWow64Directory(str, uSize) > 0)
            ret = true;
        else
            ret = false;
        return ret;
    }
    catch (...) {
    }
 
    BOOL bIsWow64 = FALSE;
    typedef BOOL(WINAPI * LPFN_ISWOW64PROCESS)(HANDLE, PBOOL);
    LPFN_ISWOW64PROCESS fnIsWow64Process;
 
    try {
        fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
        if (NULL != fnIsWow64Process) {
            if (!fnIsWow64Process(GetCurrentProcess(), &bIsWow64)) {
                // handle error
            }
        }
        ret = (bool)bIsWow64;
    }
    catch (...) {
    }
    return ret;
}
//---------------------------------------------------------------------------