From f397f70fbe8e43eaa502db00a768e76d7ec377a8 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Tue, 17 Mar 2015 15:39:50 +0100 Subject: Windows Setup: When clicking uninstall link, launch Windows Add/Remove program instead of uninstall directly in order to avoid being flagged as legacy application by the Windows Program Compatibility Assistant (see number 5 in Microsoft UI Design Standard https://msdn.microsoft.com/en-us/library/ms954377.aspx) --- src/Setup/Setup.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/Setup') diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c index 700045c9..b24b479d 100644 --- a/src/Setup/Setup.c +++ b/src/Setup/Setup.c @@ -415,7 +415,7 @@ BOOL SetPrivilege(LPTSTR szPrivilegeName, BOOL bEnable) } HRESULT CreateLink (char *lpszPathObj, char *lpszArguments, - char *lpszPathLink) + char *lpszPathLink, const char* iconFile, int iconIndex) { HRESULT hres; IShellLink *psl; @@ -431,6 +431,10 @@ HRESULT CreateLink (char *lpszPathObj, char *lpszArguments, description. */ psl->SetPath (lpszPathObj); psl->SetArguments (lpszArguments); + if (iconFile) + { + psl->SetIconLocation (iconFile, iconIndex); + } // Application ID if (strstr (lpszPathObj, TC_APP_NAME ".exe")) @@ -1573,14 +1577,14 @@ BOOL DoShortcutsInstall (HWND hwndDlg, char *szDestDir, BOOL bProgGroup, BOOL bD StringCbPrintfA (szTmp2, sizeof(szTmp2), "%s%s", szLinkDir, "\\VeraCrypt.lnk"); IconMessage (hwndDlg, szTmp2); - if (CreateLink (szTmp, "", szTmp2) != S_OK) + if (CreateLink (szTmp, "", szTmp2, NULL, -1) != S_OK) goto error; StringCbPrintfA (szTmp, sizeof(szTmp), "%s%s", szDir, "VeraCryptExpander.exe"); StringCbPrintfA (szTmp2, sizeof(szTmp2), "%s%s", szLinkDir, "\\VeraCryptExpander.lnk"); IconMessage (hwndDlg, szTmp2); - if (CreateLink (szTmp, "", szTmp2) != S_OK) + if (CreateLink (szTmp, "", szTmp2, NULL, -1) != S_OK) goto error; StringCbPrintfA (szTmp2, sizeof(szTmp2), "%s%s", szLinkDir, "\\VeraCrypt Website.url"); @@ -1598,10 +1602,15 @@ BOOL DoShortcutsInstall (HWND hwndDlg, char *szDestDir, BOOL bProgGroup, BOOL bD StringCbPrintfA (szTmp, sizeof(szTmp), "%s%s", szDir, "VeraCrypt Setup.exe"); StringCbPrintfA (szTmp2, sizeof(szTmp2), "%s%s", szLinkDir, "\\Uninstall VeraCrypt.lnk"); - StringCbCopyA (szTmp3, sizeof(szTmp3), "/u"); + if (GetSystemDirectoryA (szTmp3, sizeof(szTmp3))) + { + StringCbCatA (szTmp3, sizeof(szTmp3), "\\control.exe"); + } + else + StringCbCopyA(szTmp3, sizeof(szTmp3), "C:\\Windows\\System32\\control.exe"); IconMessage (hwndDlg, szTmp2); - if (CreateLink (szTmp, szTmp3, szTmp2) != S_OK) + if (CreateLink (szTmp3, "appwiz.cpl", szTmp2, szTmp, 0) != S_OK) goto error; StringCbPrintfA (szTmp2, sizeof(szTmp2), "%s%s", szLinkDir, "\\VeraCrypt User's Guide.lnk"); @@ -1630,7 +1639,7 @@ BOOL DoShortcutsInstall (HWND hwndDlg, char *szDestDir, BOOL bProgGroup, BOOL bD IconMessage (hwndDlg, szTmp2); - if (CreateLink (szTmp, "", szTmp2) != S_OK) + if (CreateLink (szTmp, "", szTmp2, NULL, -1) != S_OK) goto error; } -- cgit v1.2.3