mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Windows: use RtlGetVersion instead of GetVersionEx in order to get accurate Windows version information on Windows 10.
This commit is contained in:
@@ -2540,13 +2540,34 @@ void DoPostInstallTasks (HWND hwndDlg)
|
|||||||
SavePostInstallTasksSettings (TC_POST_INSTALL_CFG_REMOVE_ALL);
|
SavePostInstallTasksSettings (TC_POST_INSTALL_CFG_REMOVE_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use RtlGetVersion to get Windows version because GetVersionEx is affected by application manifestation.
|
||||||
|
*/
|
||||||
|
typedef NTSTATUS (WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
|
||||||
|
|
||||||
|
static BOOL GetWindowsVersion(LPOSVERSIONINFOW lpVersionInformation)
|
||||||
|
{
|
||||||
|
BOOL bRet = FALSE;
|
||||||
|
RtlGetVersionPtr RtlGetVersionFn = (RtlGetVersionPtr) GetProcAddress(GetModuleHandle (L"ntdll.dll"), "RtlGetVersion");
|
||||||
|
if (RtlGetVersionFn != NULL)
|
||||||
|
{
|
||||||
|
if (ERROR_SUCCESS == RtlGetVersionFn (lpVersionInformation))
|
||||||
|
bRet = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bRet)
|
||||||
|
bRet = GetVersionExW (lpVersionInformation);
|
||||||
|
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void InitOSVersionInfo ()
|
void InitOSVersionInfo ()
|
||||||
{
|
{
|
||||||
OSVERSIONINFOEXW os;
|
OSVERSIONINFOEXW os;
|
||||||
os.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEXW);
|
os.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEXW);
|
||||||
|
|
||||||
if (GetVersionExW ((LPOSVERSIONINFOW) &os) == FALSE)
|
if (GetWindowsVersion ((LPOSVERSIONINFOW) &os) == FALSE)
|
||||||
AbortProcess ("NO_OS_VER");
|
AbortProcess ("NO_OS_VER");
|
||||||
|
|
||||||
CurrentOSMajor = os.dwMajorVersion;
|
CurrentOSMajor = os.dwMajorVersion;
|
||||||
|
|||||||
Reference in New Issue
Block a user