diff --git a/CHANGELOG.md b/CHANGELOG.md index 66e4fff..53c94a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ Tested on build 22000.318 and 22000.346 (currently in Windows Insider beta and r * Functional Windows 10 network flyout * Functional Windows 10 battery flyout * Implemented support for Windows 7 battery flyout (#274) +* Implemented `/extract` switch which unpacks the files from `ep_setup.exe` to disk (#396): + * `ep_setup /extract` - extracts `ExplorerPatcher.IA-32.dll` and `ExplorerPatcher.amd64.dll` to current directory + * `ep-setup /extract test` - extracts to `test` folder in current directory + * `ep-setup /extract "C:\test with space"` - extracts to `C:\test with space` directory + #### Feature enhancements diff --git a/ep_setup/ep_setup.c b/ep_setup/ep_setup.c index dbf05ab..7b3cdfe 100644 --- a/ep_setup/ep_setup.c +++ b/ep_setup/ep_setup.c @@ -295,6 +295,49 @@ int WINAPI wWinMain( SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); + int argc = 0; + LPWSTR* wargv = CommandLineToArgvW( + lpCmdLine, + &argc + ); + + bIsUpdate = (argc >= 1 && !_wcsicmp(wargv[0], L"/update_silent")); + + WCHAR wszPath[MAX_PATH]; + ZeroMemory(wszPath, MAX_PATH * sizeof(WCHAR)); + + if (argc >= 1 && !_wcsicmp(wargv[0], L"/extract")) + { + if (argc >= 2) + { + wcsncpy_s(wszPath, MAX_PATH, wargv[1], MAX_PATH); + CreateDirectoryW(wargv[1], NULL); + } + else + { + GetCurrentDirectoryW(MAX_PATH, wszPath); + } + if (bOk) + { + wcscat_s(wszPath, MAX_PATH, L"\\" _T(PRODUCT_NAME) L".IA-32.dll"); + bOk = InstallResource(TRUE, hInstance, IDR_EP_IA32, wszPath); + } + if (argc >= 2) + { + wcsncpy_s(wszPath, MAX_PATH, wargv[1], MAX_PATH); + } + else + { + GetCurrentDirectoryW(MAX_PATH, wszPath); + } + if (bOk) + { + wcscat_s(wszPath, MAX_PATH, L"\\" _T(PRODUCT_NAME) L".amd64.dll"); + bOk = InstallResource(TRUE, hInstance, IDR_EP_AMD64, wszPath); + } + return 0; + } + if (!IsAppRunningAsAdminMode()) { WCHAR wszPath[MAX_PATH]; @@ -320,16 +363,6 @@ int WINAPI wWinMain( } } - int argc = 0; - LPWSTR* wargv = CommandLineToArgvW( - lpCmdLine, - &argc - ); - - bIsUpdate = (argc >= 1 && !_wcsicmp(wargv[0], L"/update_silent")); - - WCHAR wszPath[MAX_PATH]; - ZeroMemory(wszPath, MAX_PATH * sizeof(WCHAR)); if (bOk) { bOk = GetWindowsDirectoryW(wszPath, MAX_PATH);