Browse Source

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

pull/886/head 22000.348.40.4_88e1355
Valentin Radu 4 years ago
parent
commit
88e1355ddf
  1. 1
      CHANGELOG.md
  2. 28
      ep_setup/ep_setup.c
  3. 6
      version.h

1
CHANGELOG.md

@ -37,6 +37,7 @@ Tested on build 22000.348.
* Fixed regression of [#161](https://github.com/valinet/ExplorerPatcher/issues/161#issuecomment-986234002) (.1) * 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) * 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) * 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 ## 22000.348.39

28
ep_setup/ep_setup.c

@ -291,7 +291,7 @@ int WINAPI wWinMain(
_In_ int nShowCmd _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); SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
@ -336,9 +336,26 @@ int WINAPI wWinMain(
return 0; 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"))); 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")); 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( if (MessageBoxW(
NULL, NULL,
@ -352,16 +369,12 @@ int WINAPI wWinMain(
} }
if (!IsAppRunningAsAdminMode()) if (!IsAppRunningAsAdminMode())
{
WCHAR wszPath[MAX_PATH];
ZeroMemory(wszPath, ARRAYSIZE(wszPath));
if (GetModuleFileNameW(NULL, wszPath, ARRAYSIZE(wszPath)))
{ {
SHELLEXECUTEINFOW sei; SHELLEXECUTEINFOW sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW)); ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));
sei.cbSize = sizeof(sei); sei.cbSize = sizeof(sei);
sei.lpVerb = L"runas"; sei.lpVerb = L"runas";
sei.lpFile = wszPath; sei.lpFile = wszOwnPath;
sei.lpParameters = !bInstall ? L"/uninstall_silent" : lpCmdLine; sei.lpParameters = !bInstall ? L"/uninstall_silent" : lpCmdLine;
sei.hwnd = NULL; sei.hwnd = NULL;
sei.nShow = SW_NORMAL; sei.nShow = SW_NORMAL;
@ -374,7 +387,6 @@ int WINAPI wWinMain(
} }
exit(0); exit(0);
} }
}
SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszPath); SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszPath);
wcscat_s(wszPath, MAX_PATH, _T(APP_RELATIVE_PATH)); wcscat_s(wszPath, MAX_PATH, _T(APP_RELATIVE_PATH));

6
version.h

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

Loading…
Cancel
Save