improve windows version detecting code

This commit is contained in:
Green Sky 2024-06-07 15:03:50 +02:00
parent 6b96be7a57
commit 183277250f
No known key found for this signature in database

View File

@ -20,7 +20,9 @@ void runSysCheck(void) {
NTSTATUS(WINAPI *RtlGetVersion)(LPOSVERSIONINFOEXW); NTSTATUS(WINAPI *RtlGetVersion)(LPOSVERSIONINFOEXW);
OSVERSIONINFOEXW osInfo; OSVERSIONINFOEXW osInfo;
*(FARPROC*)&RtlGetVersion = GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion"); HMODULE lib = GetModuleHandleW(L"ntdll.dll");
if (lib) {
*(FARPROC*)&RtlGetVersion = GetProcAddress(lib, "RtlGetVersion");
if (NULL != RtlGetVersion) { if (NULL != RtlGetVersion) {
osInfo.dwOSVersionInfoSize = sizeof(osInfo); osInfo.dwOSVersionInfoSize = sizeof(osInfo);
@ -34,6 +36,7 @@ void runSysCheck(void) {
exit(0); exit(0);
} }
} }
}
} }
#else #else