mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Windows: remove legacy code (XP, Vista). Simplify code since Windows 7 is now minimal OS version.
This commit is contained in:
@@ -570,25 +570,12 @@ BOOL IsSystemRestoreEnabled ()
|
||||
GetRestorePointRegKeyName (szRegPath, sizeof (szRegPath));
|
||||
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, szRegPath, 0, KEY_READ | KEY_WOW64_64KEY, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
if (IsOSAtLeast (WIN_VISTA))
|
||||
if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"RPSessionInterval", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
|
||||
&& (dwValue == 1)
|
||||
)
|
||||
{
|
||||
if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"RPSessionInterval", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
|
||||
&& (dwValue == 1)
|
||||
)
|
||||
{
|
||||
bEnabled = TRUE;
|
||||
}
|
||||
bEnabled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"DisableSR", NULL, NULL, (LPBYTE) &dwValue, &cbValue))
|
||||
&& (dwValue == 0)
|
||||
)
|
||||
{
|
||||
bEnabled = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RegCloseKey (hKey);
|
||||
}
|
||||
@@ -1357,13 +1344,10 @@ error:
|
||||
}
|
||||
|
||||
// Register COM servers for UAC
|
||||
if (IsOSAtLeast (WIN_VISTA))
|
||||
if (!RegisterComServers (szDir))
|
||||
{
|
||||
if (!RegisterComServers (szDir))
|
||||
{
|
||||
Error ("COM_REG_FAILED", hwndDlg);
|
||||
return FALSE;
|
||||
}
|
||||
Error ("COM_REG_FAILED", hwndDlg);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return bOK;
|
||||
@@ -1436,16 +1420,9 @@ BOOL DoApplicationDataUninstall (HWND hwndDlg)
|
||||
BOOL DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated)
|
||||
{
|
||||
wchar_t regk [64];
|
||||
typedef LSTATUS (WINAPI *RegDeleteKeyExWFn) (HKEY hKey,LPCWSTR lpSubKey,REGSAM samDesired,WORD Reserved);
|
||||
RegDeleteKeyExWFn RegDeleteKeyExWPtr = NULL;
|
||||
HMODULE hAdvapiDll = LoadLibrary (L"Advapi32.dll");
|
||||
if (hAdvapiDll)
|
||||
{
|
||||
RegDeleteKeyExWPtr = (RegDeleteKeyExWFn) GetProcAddress(hAdvapiDll, "RegDeleteKeyExW");
|
||||
}
|
||||
|
||||
// Unregister COM servers
|
||||
if (!bRemoveDeprecated && IsOSAtLeast (WIN_VISTA))
|
||||
if (!bRemoveDeprecated)
|
||||
{
|
||||
if (!UnregisterComServers (InstallationPath))
|
||||
StatusMessage (hwndDlg, "COM_DEREG_FAILED");
|
||||
@@ -1454,16 +1431,9 @@ BOOL DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated)
|
||||
if (!bRemoveDeprecated)
|
||||
StatusMessage (hwndDlg, "REMOVING_REG");
|
||||
|
||||
if (RegDeleteKeyExWPtr)
|
||||
{
|
||||
RegDeleteKeyExWPtr (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt", KEY_WOW64_32KEY, 0);
|
||||
RegDeleteKeyExWPtr (HKEY_CURRENT_USER, L"Software\\VeraCrypt", KEY_WOW64_32KEY, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt");
|
||||
RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\VeraCrypt");
|
||||
}
|
||||
RegDeleteKeyExW (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt", KEY_WOW64_32KEY, 0);
|
||||
RegDeleteKeyExW (HKEY_CURRENT_USER, L"Software\\VeraCrypt", KEY_WOW64_32KEY, 0);
|
||||
|
||||
RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\Classes\\VeraCryptVolume\\Shell\\open\\command");
|
||||
RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\Classes\\VeraCryptVolume\\Shell\\open");
|
||||
RegDeleteKey (HKEY_LOCAL_MACHINE, L"Software\\Classes\\VeraCryptVolume\\Shell");
|
||||
@@ -1502,9 +1472,6 @@ BOOL DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated)
|
||||
SHChangeNotify (SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
|
||||
}
|
||||
|
||||
if (hAdvapiDll)
|
||||
FreeLibrary (hAdvapiDll);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2879,7 +2846,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
|
||||
|
||||
if (!bUninstall)
|
||||
{
|
||||
if (!bDevm && !LocalizationActive && (nCurrentOS >= WIN_VISTA))
|
||||
if (!bDevm && !LocalizationActive)
|
||||
{
|
||||
BOOL bHasPreferredLanguage = (strlen (GetPreferredLangId ()) > 0)? TRUE : FALSE;
|
||||
if ((IDCANCEL == DialogBoxParamW (hInstance, MAKEINTRESOURCEW (IDD_INSTALL_LANGUAGE), NULL, (DLGPROC) SelectLanguageDialogProc, (LPARAM) 0 ))
|
||||
|
||||
Reference in New Issue
Block a user