mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 19:08:26 -06:00
Windows: enhance ReflectDrivers mechanism by persisting it across major Windows upgrades.
This commit is contained in:
@@ -2722,8 +2722,37 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
StringCchCatW (szSetupconfigLocation, ARRAYSIZE (szSetupconfigLocation), L"SetupConfig.ini");
|
StringCchCatW (szSetupconfigLocation, ARRAYSIZE (szSetupconfigLocation), L"SetupConfig.ini");
|
||||||
|
|
||||||
if (bForInstall || FileExists (szSetupconfigLocation))
|
if (bForInstall)
|
||||||
WritePrivateProfileStringW (L"SetupConfig", L"ReflectDrivers", bForInstall? szInstallPath : NULL, szSetupconfigLocation);
|
{
|
||||||
|
wstring szPathParam = L"\"";
|
||||||
|
szPathParam += szInstallPath;
|
||||||
|
szPathParam += L"\"";
|
||||||
|
WritePrivateProfileStringW (L"SetupConfig", L"ReflectDrivers", szPathParam.c_str(), szSetupconfigLocation);
|
||||||
|
|
||||||
|
szPathParam = GetProgramConfigPath (L"SetupComplete.cmd");
|
||||||
|
FILE* scriptFile = _wfopen (szPathParam.c_str(), L"w");
|
||||||
|
if (scriptFile)
|
||||||
|
{
|
||||||
|
fwprintf (scriptFile, L"\"%s\\VeraCrypt.exe\" /PostOOBE\n", szInstallPath);
|
||||||
|
fclose (scriptFile);
|
||||||
|
|
||||||
|
WritePrivateProfileStringW (L"SetupConfig", L"PostOOBE", szPathParam.c_str(), szSetupconfigLocation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (FileExists (szSetupconfigLocation))
|
||||||
|
{
|
||||||
|
WritePrivateProfileStringW (L"SetupConfig", L"ReflectDrivers", NULL, szSetupconfigLocation);
|
||||||
|
WritePrivateProfileStringW (L"SetupConfig", L"PostOOBE", NULL, szSetupconfigLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
wstring scriptFilePath = GetProgramConfigPath (L"SetupComplete.cmd");
|
||||||
|
if (FileExists (scriptFilePath.c_str()))
|
||||||
|
{
|
||||||
|
::DeleteFileW (scriptFilePath.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3717,7 +3746,7 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
finally_do ({ EfiBootInst.DismountBootPartition(); });
|
finally_do ({ EfiBootInst.DismountBootPartition(); });
|
||||||
|
|
||||||
EfiBootInst.MountBootPartition(0);
|
EfiBootInst.MountBootPartition(0);
|
||||||
|
|
||||||
EfiBootInst.GetFileSize(Is64BitOs()? L"\\EFI\\Boot\\bootx64.efi" : L"\\EFI\\Boot\\bootia32.efi", loaderSize);
|
EfiBootInst.GetFileSize(Is64BitOs()? L"\\EFI\\Boot\\bootx64.efi" : L"\\EFI\\Boot\\bootia32.efi", loaderSize);
|
||||||
|
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ namespace VeraCrypt
|
|||||||
void GetEfiBootDeviceNumber (PSTORAGE_DEVICE_NUMBER pSdn);
|
void GetEfiBootDeviceNumber (PSTORAGE_DEVICE_NUMBER pSdn);
|
||||||
void BackupSystemLoader ();
|
void BackupSystemLoader ();
|
||||||
void RestoreSystemLoader ();
|
void RestoreSystemLoader ();
|
||||||
void UpdateSetupConfigFile (bool bForInstall);
|
static void UpdateSetupConfigFile (bool bForInstall);
|
||||||
protected:
|
protected:
|
||||||
static const uint32 RescueIsoImageSize = 1835008; // Size of ISO9660 image with bootable emulated 1.44MB floppy disk image
|
static const uint32 RescueIsoImageSize = 1835008; // Size of ISO9660 image with bootable emulated 1.44MB floppy disk image
|
||||||
|
|
||||||
@@ -354,4 +354,6 @@ namespace VeraCrypt
|
|||||||
#define TC_SYSTEM_FAVORITES_SERVICE_LOAD_ORDER_GROUP L"Event Log"
|
#define TC_SYSTEM_FAVORITES_SERVICE_LOAD_ORDER_GROUP L"Event Log"
|
||||||
#define TC_SYSTEM_FAVORITES_SERVICE_CMDLINE_OPTION L"/systemFavoritesService"
|
#define TC_SYSTEM_FAVORITES_SERVICE_CMDLINE_OPTION L"/systemFavoritesService"
|
||||||
|
|
||||||
|
#define VC_WINDOWS_UPGRADE_POSTOOBE_CMDLINE_OPTION L"/PostOOBE"
|
||||||
|
|
||||||
#endif // TC_HEADER_Common_BootEncryption
|
#endif // TC_HEADER_Common_BootEncryption
|
||||||
|
|||||||
@@ -9383,6 +9383,13 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
|
|||||||
if (argv && argc == 2 && wstring (TC_SYSTEM_FAVORITES_SERVICE_CMDLINE_OPTION) == argv[1])
|
if (argv && argc == 2 && wstring (TC_SYSTEM_FAVORITES_SERVICE_CMDLINE_OPTION) == argv[1])
|
||||||
return StartSystemFavoritesService() ? 0 : 1;
|
return StartSystemFavoritesService() ? 0 : 1;
|
||||||
|
|
||||||
|
if (argv && argc == 2 && wstring (VC_WINDOWS_UPGRADE_POSTOOBE_CMDLINE_OPTION) == argv[1])
|
||||||
|
{
|
||||||
|
InitOSVersionInfo();
|
||||||
|
BootEncryption::UpdateSetupConfigFile (true);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
atexit (localcleanup);
|
atexit (localcleanup);
|
||||||
SetProcessShutdownParameters (0x100, 0);
|
SetProcessShutdownParameters (0x100, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user