Browse Source

Implemented /extract switch for ep_setup

pull/492/head
Valentin Radu 4 years ago
parent
commit
aff330cc08
  1. 5
      CHANGELOG.md
  2. 53
      ep_setup/ep_setup.c

5
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 network flyout
* Functional Windows 10 battery flyout * Functional Windows 10 battery flyout
* Implemented support for Windows 7 battery flyout (#274) * 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 #### Feature enhancements

53
ep_setup/ep_setup.c

@ -295,6 +295,49 @@ int WINAPI wWinMain(
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); 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()) if (!IsAppRunningAsAdminMode())
{ {
WCHAR wszPath[MAX_PATH]; 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) if (bOk)
{ {
bOk = GetWindowsDirectoryW(wszPath, MAX_PATH); bOk = GetWindowsDirectoryW(wszPath, MAX_PATH);

Loading…
Cancel
Save