diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2020-07-22 17:04:32 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2020-07-22 17:27:59 +0200 |
commit | 587e6db4f16291d8b6f22d0937a4bff87bc8ffc0 (patch) | |
tree | c60a12b021182324b9d741981bf8b45b621ee742 /src/Format/FormatCom.cpp | |
parent | 1c3e4fd0ee235ac2cf7cee2c2f6db2ac74ba21c8 (diff) | |
download | VeraCrypt-587e6db4f16291d8b6f22d0937a4bff87bc8ffc0.tar.gz VeraCrypt-587e6db4f16291d8b6f22d0937a4bff87bc8ffc0.zip |
Windows: Warn about Fast Startup if it is enabled during system encryption or volume creation and propose to disable it
Diffstat (limited to 'src/Format/FormatCom.cpp')
-rw-r--r-- | src/Format/FormatCom.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
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<ITrueCryptFormatCom> 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; + } +} + |