1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2025-01-19 09:07:29 +01:00

Implemented /extract switch for ep_setup

This commit is contained in:
Valentin Radu 2021-11-18 19:08:29 +02:00
parent 725d5ad18f
commit aff330cc08
2 changed files with 48 additions and 10 deletions

View File

@ -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

View File

@ -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);