diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-09-10 01:32:55 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-09-10 01:44:17 +0200 |
commit | fe6ea623637a94f74ce60cbf134783bfcbdf5e0b (patch) | |
tree | dcf6435eba0373186dce766696ef465a48376c21 /src | |
parent | 957ff20f37d25927cf48efb52289f6c6a60f1e0b (diff) | |
download | VeraCrypt-fe6ea623637a94f74ce60cbf134783bfcbdf5e0b.tar.gz VeraCrypt-fe6ea623637a94f74ce60cbf134783bfcbdf5e0b.zip |
Windows: Don't offer creating a restore point if it is disabled in Windows.
Diffstat (limited to 'src')
-rw-r--r-- | src/Setup/Setup.c | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c index bd7a6ee4..d93b4ced 100644 --- a/src/Setup/Setup.c +++ b/src/Setup/Setup.c @@ -490,6 +490,39 @@ HRESULT CreateLink (char *lpszPathObj, char *lpszArguments, return hres;
}
+BOOL IsSystemRestoreEnabled ()
+{
+ BOOL bEnabled = FALSE;
+ HKEY hKey;
+ DWORD dwValue = 0, cbValue = sizeof (DWORD);
+ if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore", 0, KEY_READ | KEY_WOW64_64KEY, &hKey) == ERROR_SUCCESS)
+ {
+ if (IsOSAtLeast (WIN_VISTA))
+ {
+ if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, "RPSessionInterval", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
+ && (dwValue == 1)
+ )
+ {
+ bEnabled = TRUE;
+ }
+ }
+ else
+ {
+ if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, "DisableSR", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
+ && (dwValue == 0)
+ )
+ {
+ bEnabled = TRUE;
+ }
+ }
+
+
+ RegCloseKey (hKey);
+ }
+
+ return bEnabled;
+}
+
void GetProgramPath (HWND hwndDlg, char *path)
{
ITEMIDLIST *i;
@@ -2554,14 +2587,19 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, char *lpszComm }
// System Restore
- char dllPath[MAX_PATH];
- if (GetSystemDirectory (dllPath, MAX_PATH))
+ if (IsSystemRestoreEnabled ())
{
- StringCbCatA(dllPath, sizeof(dllPath), "\\srclient.dll");
+ char dllPath[MAX_PATH];
+ if (GetSystemDirectory (dllPath, MAX_PATH))
+ {
+ StringCbCatA(dllPath, sizeof(dllPath), "\\srclient.dll");
+ }
+ else
+ StringCbCopyA(dllPath, sizeof(dllPath), "C:\\Windows\\System32\\srclient.dll");
+ SystemRestoreDll = LoadLibrary (dllPath);
}
else
- StringCbCopyA(dllPath, sizeof(dllPath), "C:\\Windows\\System32\\srclient.dll");
- SystemRestoreDll = LoadLibrary (dllPath);
+ SystemRestoreDll = 0;
if (!bUninstall)
{
|