diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2023-09-03 16:47:41 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2023-09-03 16:47:41 +0200 |
commit | 201d09ff5aa69db61643659726b36810d5ac00d4 (patch) | |
tree | 7e125fa95b059a7cc5272086ab9ed93defbb878c /src/Setup/Setup.c | |
parent | d68b9546bd36fa34093b8592d3927ba581fc8e59 (diff) | |
download | VeraCrypt-201d09ff5aa69db61643659726b36810d5ac00d4.tar.gz VeraCrypt-201d09ff5aa69db61643659726b36810d5ac00d4.zip |
Windows: remove legacy code (XP, Vista). Simplify code since Windows 7 is now minimal OS version.
Diffstat (limited to 'src/Setup/Setup.c')
-rw-r--r-- | src/Setup/Setup.c | 57 |
1 files changed, 12 insertions, 45 deletions
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c index e505bb05..2d8d940c 100644 --- a/src/Setup/Setup.c +++ b/src/Setup/Setup.c @@ -570,26 +570,13 @@ 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) - ) - { - bEnabled = TRUE; - } - } - else + if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"RPSessionInterval", NULL, NULL, (LPBYTE) &dwValue, &cbValue)) + && (dwValue == 1) + ) { - if ( (ERROR_SUCCESS == RegQueryValueEx (hKey, L"DisableSR", NULL, NULL, (LPBYTE) &dwValue, &cbValue)) - && (dwValue == 0) - ) - { - bEnabled = TRUE; - } + 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 )) |