From e362d804b0a9e92b36f3e2d28d08bbbc387ac9a2 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 28 Sep 2016 10:55:53 +0200 Subject: Windows: Perform Shutdown instead of Reboot during Pre-Test of UEFI system encryption in order to detect machines where changes to EFI boot don't persist after shutdown. --- src/Common/BootEncryption.cpp | 4 ++-- src/Common/BootEncryption.h | 2 +- src/Common/Dlgcode.c | 4 ++-- src/Common/Dlgcode.h | 2 +- src/Format/Tcformat.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp index c3aec66e..8aa40605 100644 --- a/src/Common/BootEncryption.cpp +++ b/src/Common/BootEncryption.cpp @@ -4568,8 +4568,8 @@ namespace VeraCrypt } } - bool BootEncryption::RestartComputer (void) + bool BootEncryption::RestartComputer (BOOL bShutdown) { - return (::RestartComputer() != FALSE); + return (::RestartComputer(bShutdown) != FALSE); } } diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h index 06da2bba..4bf31fec 100644 --- a/src/Common/BootEncryption.h +++ b/src/Common/BootEncryption.h @@ -276,7 +276,7 @@ namespace VeraCrypt void RegisterSystemFavoritesService (BOOL registerService, BOOL noFileHandling); void UpdateSystemFavoritesService (); void RenameDeprecatedSystemLoaderBackup (); - bool RestartComputer (void); + bool RestartComputer (BOOL bShutdown = FALSE); void InitialSecurityChecksForHiddenOS (); void RestrictPagingFilesToSystemPartition (); void SetDriverConfigurationFlag (uint32 flag, bool state); diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index c2e15390..810b6e8a 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -10017,7 +10017,7 @@ BOOL EnableWow64FsRedirection (BOOL enable) } -BOOL RestartComputer (void) +BOOL RestartComputer (BOOL bShutdown) { TOKEN_PRIVILEGES tokenPrivil; HANDLE hTkn; @@ -10038,7 +10038,7 @@ BOOL RestartComputer (void) return false; } - if (!ExitWindowsEx (EWX_REBOOT, + if (!ExitWindowsEx (bShutdown? EWX_POWEROFF: EWX_REBOOT, SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED)) { CloseHandle(hTkn); diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h index 9ae9d5b2..a950ae22 100644 --- a/src/Common/Dlgcode.h +++ b/src/Common/Dlgcode.h @@ -443,7 +443,7 @@ BOOL Is64BitOs (); BOOL IsServerOS (); BOOL IsHiddenOSRunning (void); BOOL EnableWow64FsRedirection (BOOL enable); -BOOL RestartComputer (void); +BOOL RestartComputer (BOOL bShutdown); void Applink (char *dest, BOOL bSendOS, char *extraOutput); wchar_t *RelativePath2Absolute (wchar_t *szFileName); void HandleDriveNotReadyError (HWND hwnd); diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index 66ec3ac3..d83d9f49 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -8157,7 +8157,7 @@ retryCDDriveCheck: try { - BootEncObj->RestartComputer (); + BootEncObj->RestartComputer (bSystemIsGPT); } catch (Exception &e) { @@ -10112,7 +10112,7 @@ static void AfterWMInitTasks (HWND hwndDlg) try { - BootEncObj->RestartComputer (); + BootEncObj->RestartComputer (bSystemIsGPT); } catch (Exception &e) { -- cgit v1.2.3