1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-12 02:00:46 +01:00

Setup: Moved uninstallation prompt dialog existence check to the GUI

This commit is contained in:
Amrsatrio 2024-03-13 07:18:48 +07:00
parent 95ea9e740b
commit 0589a251c1
2 changed files with 20 additions and 19 deletions

View File

@ -2184,19 +2184,27 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
}
else if (!strncmp(line + 1, "uninstall", 6))
{
wchar_t uninstallLink[MAX_PATH];
ZeroMemory(uninstallLink, sizeof(uninstallLink));
SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, uninstallLink);
wcscat_s(uninstallLink, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\" _T(SETUP_UTILITY_NAME));
HWND hwndExistingMb = FindWindowExW(NULL, NULL, L"#32770", _T(PRODUCT_NAME));
if (hwndExistingMb)
{
SwitchToThisWindow(hwndExistingMb, TRUE);
}
else
{
wchar_t uninstallLink[MAX_PATH];
ZeroMemory(uninstallLink, sizeof(uninstallLink));
SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, uninstallLink);
wcscat_s(uninstallLink, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\" _T(SETUP_UTILITY_NAME));
SHELLEXECUTEINFOW sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));
sei.cbSize = sizeof(sei);
sei.hwnd = hwnd;
sei.lpFile = uninstallLink;
sei.nShow = SW_NORMAL;
sei.lpParameters = L"/uninstall";
ShellExecuteExW(&sei);
SHELLEXECUTEINFOW sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));
sei.cbSize = sizeof(sei);
sei.hwnd = hwnd;
sei.lpFile = uninstallLink;
sei.nShow = SW_NORMAL;
sei.lpParameters = L"/uninstall";
ShellExecuteExW(&sei);
}
}
else if (!strncmp(line + 1, "update_weather", 14))
{

View File

@ -517,13 +517,6 @@ int WINAPI wWinMain(
bIsUpdate = (argc >= 1 && !_wcsicmp(wargv[0], L"/update_silent"));
if (!bInstall && (!_wcsicmp(wargv[0], L"/uninstall") || bForcePromptForUninstall))
{
HWND hwndExistingMb = FindWindowExW(NULL, NULL, L"#32770", _T(PRODUCT_NAME));
if (hwndExistingMb)
{
SwitchToThisWindow(hwndExistingMb, TRUE);
exit(0);
}
wchar_t mbText[256];
mbText[0] = 0;
LoadStringW(hInstance, IDS_SETUP_UNINSTALL_PROMPT, mbText, ARRAYSIZE(mbText));