1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 19:08:26 -06:00

Windows: Warn about Fast Startup if it is enabled during system encryption or volume creation and propose to disable it

This commit is contained in:
Mounir IDRASSI
2020-07-22 17:04:32 +02:00
parent 1c3e4fd0ee
commit 587e6db4f1
4 changed files with 68 additions and 0 deletions

View File

@@ -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;
}
}