diff --git a/installer/PowerToysSetup/CustomDialogs/WixUI_PTInstallDir.wxs b/installer/PowerToysSetup/CustomDialogs/WixUI_PTInstallDir.wxs index a06d1ed278..a23805f6e8 100644 --- a/installer/PowerToysSetup/CustomDialogs/WixUI_PTInstallDir.wxs +++ b/installer/PowerToysSetup/CustomDialogs/WixUI_PTInstallDir.wxs @@ -37,7 +37,6 @@ Patch dialog sequence: - diff --git a/installer/PowerToysSetupCustomActionsVNext/CustomAction.cpp b/installer/PowerToysSetupCustomActionsVNext/CustomAction.cpp index 238477c48b..1c79cc5c39 100644 --- a/installer/PowerToysSetupCustomActionsVNext/CustomAction.cpp +++ b/installer/PowerToysSetupCustomActionsVNext/CustomAction.cpp @@ -1267,80 +1267,6 @@ UINT __stdcall TerminateProcessesCA(MSIHANDLE hInstall) return WcaFinalize(er); } -UINT __stdcall TerminateOccupiedProcessesCA(MSIHANDLE hInstall) -{ - HRESULT hr = S_OK; - UINT er = ERROR_SUCCESS; - hr = WcaInitialize(hInstall, "TerminateOccupiedProcessesCA"); - - std::vector processes; - const size_t maxProcesses = 4096; - DWORD bytes = maxProcesses * sizeof(processes[0]); - processes.resize(maxProcesses); - - if (!EnumProcesses(processes.data(), bytes, &bytes)) - { - return 1; - } - processes.resize(bytes / sizeof(processes[0])); - - std::array processesToTerminate = { - L"COM Surrogate.exe", - L"ShellHost.exe", - }; - - for (const auto procID : processes) - { - if (!procID) - { - continue; - } - wchar_t processName[MAX_PATH] = L""; - - HANDLE hProcess{OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE, FALSE, procID)}; - if (!hProcess) - { - continue; - } - HMODULE hMod; - DWORD cbNeeded; - - if (!EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded)) - { - CloseHandle(hProcess); - continue; - } - GetModuleBaseNameW(hProcess, hMod, processName, sizeof(processName) / sizeof(wchar_t)); - - for (const auto processToTerminate : processesToTerminate) - { - if (processName == processToTerminate) - { - const DWORD timeout = 500; - auto windowEnumerator = [](HWND hwnd, LPARAM procIDPtr) -> BOOL - { - auto targetProcID = *reinterpret_cast(procIDPtr); - DWORD windowProcID = 0; - GetWindowThreadProcessId(hwnd, &windowProcID); - if (windowProcID == targetProcID) - { - DWORD_PTR _{}; - SendMessageTimeoutA(hwnd, WM_CLOSE, 0, 0, SMTO_BLOCK, timeout, &_); - } - return TRUE; - }; - EnumWindows(windowEnumerator, reinterpret_cast(&procID)); - Sleep(timeout); - TerminateProcess(hProcess, 0); - break; - } - } - CloseHandle(hProcess); - } - - er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE; - return WcaFinalize(er); -} void initSystemLogger() { diff --git a/installer/PowerToysSetupCustomActionsVNext/CustomAction.def b/installer/PowerToysSetupCustomActionsVNext/CustomAction.def index c41d5b3ff1..e9bfce7f88 100644 --- a/installer/PowerToysSetupCustomActionsVNext/CustomAction.def +++ b/installer/PowerToysSetupCustomActionsVNext/CustomAction.def @@ -16,7 +16,6 @@ EXPORTS TelemetryLogRepairCancelCA TelemetryLogRepairFailCA TerminateProcessesCA - TerminateOccupiedProcessesCA InstallEmbeddedMSIXCA InstallDSCModuleCA InstallCmdPalPackageCA diff --git a/installer/PowerToysSetupVNext/Product.wxs b/installer/PowerToysSetupVNext/Product.wxs index b6f8ba5925..7d7c542cf0 100644 --- a/installer/PowerToysSetupVNext/Product.wxs +++ b/installer/PowerToysSetupVNext/Product.wxs @@ -103,6 +103,7 @@ + @@ -159,9 +160,7 @@ - - - +