1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2025-01-18 16:54:13 +01:00

Possibility to uninstall by renaming ep_setup.exe to ep_uninstall.exe and running that

This commit is contained in:
Valentin Radu 2021-12-06 07:48:04 +02:00
parent 6f19d53ffd
commit 88e1355ddf
3 changed files with 35 additions and 22 deletions

View File

@ -37,6 +37,7 @@ Tested on build 22000.348.
* Fixed regression of [#161](https://github.com/valinet/ExplorerPatcher/issues/161#issuecomment-986234002) (.1)
* Possibility to disable per-application window lists (`Alt`+`) ([#283](https://github.com/valinet/ExplorerPatcher/issues/283#issuecomment-986261712)) (.2)
* Fixed bug that prevented proper loading of default settings (.3)
* Possibility to uninstall by renaming `ep_setup.exe` to `ep_uninstall.exe` and running that (.4)
## 22000.348.39

View File

@ -291,7 +291,7 @@ int WINAPI wWinMain(
_In_ int nShowCmd
)
{
BOOL bOk = TRUE, bInstall = TRUE, bWasShellExt = FALSE, bIsUpdate = FALSE;
BOOL bOk = TRUE, bInstall = TRUE, bWasShellExt = FALSE, bIsUpdate = FALSE, bForcePromptForUninstall = FALSE;
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
@ -336,9 +336,26 @@ int WINAPI wWinMain(
return 0;
}
WCHAR wszOwnPath[MAX_PATH];
ZeroMemory(wszOwnPath, ARRAYSIZE(wszOwnPath));
if (!GetModuleFileNameW(NULL, wszOwnPath, ARRAYSIZE(wszOwnPath)))
{
exit(0);
}
bInstall = !(argc >= 1 && (!_wcsicmp(wargv[0], L"/uninstall") || !_wcsicmp(wargv[0], L"/uninstall_silent")));
PathStripPathW(wszOwnPath);
if (!_wcsicmp(wszOwnPath, L"ep_uninstall.exe"))
{
bInstall = FALSE;
bForcePromptForUninstall = _wcsicmp(wargv[0], L"/uninstall_silent");
}
if (!GetModuleFileNameW(NULL, wszOwnPath, ARRAYSIZE(wszOwnPath)))
{
exit(0);
}
bIsUpdate = (argc >= 1 && !_wcsicmp(wargv[0], L"/update_silent"));
if (!bInstall && !_wcsicmp(wargv[0], L"/uninstall"))
if (!bInstall && (!_wcsicmp(wargv[0], L"/uninstall") || bForcePromptForUninstall))
{
if (MessageBoxW(
NULL,
@ -353,27 +370,22 @@ int WINAPI wWinMain(
if (!IsAppRunningAsAdminMode())
{
WCHAR wszPath[MAX_PATH];
ZeroMemory(wszPath, ARRAYSIZE(wszPath));
if (GetModuleFileNameW(NULL, wszPath, ARRAYSIZE(wszPath)))
SHELLEXECUTEINFOW sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));
sei.cbSize = sizeof(sei);
sei.lpVerb = L"runas";
sei.lpFile = wszOwnPath;
sei.lpParameters = !bInstall ? L"/uninstall_silent" : lpCmdLine;
sei.hwnd = NULL;
sei.nShow = SW_NORMAL;
if (!ShellExecuteExW(&sei))
{
SHELLEXECUTEINFOW sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));
sei.cbSize = sizeof(sei);
sei.lpVerb = L"runas";
sei.lpFile = wszPath;
sei.lpParameters = !bInstall ? L"/uninstall_silent" : lpCmdLine;
sei.hwnd = NULL;
sei.nShow = SW_NORMAL;
if (!ShellExecuteExW(&sei))
DWORD dwError = GetLastError();
if (dwError == ERROR_CANCELLED)
{
DWORD dwError = GetLastError();
if (dwError == ERROR_CANCELLED)
{
}
}
exit(0);
}
exit(0);
}
SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszPath);

View File

@ -1,7 +1,7 @@
#define VER_MAJOR 22000
#define VER_MINOR 348
#define VER_BUILD_HI 40
#define VER_BUILD_LO 3
#define VER_BUILD_LO 4
#define VER_FLAGS VS_FF_PRERELEASE
@ -12,5 +12,5 @@
#define VER_STR(arg) #arg
// The String form of the version numbers
#define VER_FILE_STRING VALUE "FileVersion", "22000.348.40.3"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.348.40.3"
#define VER_FILE_STRING VALUE "FileVersion", "22000.348.40.4"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.348.40.4"