From 587e6db4f16291d8b6f22d0937a4bff87bc8ffc0 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 22 Jul 2020 17:04:32 +0200 Subject: Windows: Warn about Fast Startup if it is enabled during system encryption or volume creation and propose to disable it --- src/Format/FormatCom.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/Format/FormatCom.cpp') diff --git a/src/Format/FormatCom.cpp b/src/Format/FormatCom.cpp index 10757765..4acf7a3e 100644 --- a/src/Format/FormatCom.cpp +++ b/src/Format/FormatCom.cpp @@ -291,3 +291,42 @@ extern "C" int UacAnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 h return r; } + +extern "C" BOOL UacWriteLocalMachineRegistryDword (HWND hwndDlg, wchar_t *keyPath, wchar_t *valueName, DWORD value) +{ + CComPtr tc; + int r = 0; + + CoInitialize (NULL); + + if (ComGetInstance (hwndDlg, &tc)) + { + CComBSTR keyPathBstr, valueNameBstr; + BSTR bstr = W2BSTR(keyPath); + if (bstr) + { + keyPathBstr.Attach (bstr); + bstr = W2BSTR(valueName); + if (bstr) + { + valueNameBstr.Attach (bstr); + r = tc->WriteLocalMachineRegistryDwordValue (keyPathBstr, valueNameBstr, value); + } + else + r = ERROR_OUTOFMEMORY; + } + else + r = ERROR_OUTOFMEMORY; + } + + CoUninitialize (); + + if (r == ERROR_SUCCESS) + return TRUE; + else + { + SetLastError (r); + return FALSE; + } +} + -- cgit v1.2.3