From d9e17522ee9a326100c9acb9fbafd443497cfdac Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 25 Dec 2024 17:00:37 +0100 Subject: Windows: Update Windows version check on startup to require Win10 1809 or later - Add IsWin10BuildAtLeast() helper function to check Windows 10 build numbers - Replace direct build number comparison with IsWin10BuildAtLeast() for ReflectDrivers check - Update error message to be more specific about Windows version requirement --- src/Common/BootEncryption.cpp | 2 +- src/Common/Dlgcode.c | 20 +++++++++++++++++--- src/Common/Dlgcode.h | 4 ++++ 3 files changed, 22 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp index e6e36f12..6a36a60f 100644 --- a/src/Common/BootEncryption.cpp +++ b/src/Common/BootEncryption.cpp @@ -3202,7 +3202,7 @@ namespace VeraCrypt void BootEncryption::UpdateSetupConfigFile (bool bForInstall) { // starting from Windows 10 1607 (Build 14393), ReflectDrivers in Setupconfig.ini is supported - if (IsOSVersionAtLeast (WIN_10, 0) && CurrentOSBuildNumber >= 14393) + if (IsWin10BuildAtLeast(WIN_10_1607_BUILD)) { wchar_t szInstallPath [TC_MAX_PATH]; wchar_t szSetupconfigLocation [TC_MAX_PATH + 20]; diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index ee3630c0..681761bf 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -1046,6 +1046,20 @@ BOOL IsOSVersionAtLeast (OSVersionEnum reqMinOS, int reqMinServicePack) >= (major << 16 | minor << 8 | reqMinServicePack)); } +BOOL IsWin10BuildAtLeast(DWORD minBuild) +{ + // Must first be recognized as Windows 10 or higher + if (nCurrentOS < WIN_10) + return FALSE; + + // If we’re on Windows 10, check build number + if (nCurrentOS == WIN_10 && CurrentOSBuildNumber < minBuild) + return FALSE; + + // If we are on a higher version of Windows, we are good to go + return TRUE; +} + #ifdef SETUP_DLL static BOOL GetWindowVersionFromFile(DWORD* pdwMajor, DWORD* pdwMinor, DWORD* pdwBuildNumber) { @@ -3611,10 +3625,10 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine) InitOSVersionInfo(); - if (!IsOSAtLeast (WIN_10)) + if (!IsWin10BuildAtLeast(WIN_10_1809_BUILD)) { - // abort using a message that says that VeraCrypt can run only on Windows 10 and later - AbortProcessDirect(L"VeraCrypt requires at least Windows 10 to run."); + // abort using a message that says that VeraCrypt can run only on Windows 10 version 1809 or later + AbortProcessDirect(L"VeraCrypt requires at least Windows 10 version 1809 (October 2018 Update) to run."); } if (!Is64BitOs()) diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h index 4dfae20f..9ffb5c9d 100644 --- a/src/Common/Dlgcode.h +++ b/src/Common/Dlgcode.h @@ -286,6 +286,9 @@ typedef NTSTATUS (WINAPI *NtQuerySystemInformationFn)( #define ISO_BURNER_TOOL L"isoburn.exe" #define PRINT_TOOL L"notepad.exe" +#define WIN_10_1607_BUILD 14393 // Windows 10 version 1607 corresponds to build 14393 +#define WIN_10_1809_BUILD 17763 // Windows 10 version 1809 corresponds to build 17763 + void InitGlobalLocks (); void FinalizeGlobalLocks (); void cleanup ( void ); @@ -500,6 +503,7 @@ void Debug (char *format, ...); void DebugMsgBox (char *format, ...); BOOL IsOSAtLeast (OSVersionEnum reqMinOS); BOOL IsOSVersionAtLeast (OSVersionEnum reqMinOS, int reqMinServicePack); +BOOL IsWin10BuildAtLeast(DWORD minBuild); BOOL IsSupportedOS (); BOOL Is64BitOs (); BOOL IsARM(); -- cgit v1.2.3