mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-08-29 10:09:43 +02:00
Installer: scope DuplicateFiles change to CA cleanup
This commit is contained in:
@@ -225,7 +225,7 @@ function Get-WinUI3DuplicateFileData {
|
||||
throw "Expected $($expectedSourceFiles.Count) WinUI3Apps DuplicateFile rows but found $($winUI3Duplicates.Count) in $resolvedPath."
|
||||
}
|
||||
|
||||
$customActions = Invoke-MsiQuery $database 'SELECT `Action`, `Type` FROM `CustomAction`' @('Action', 'Type') @('String', 'Integer')
|
||||
$customActions = Invoke-MsiQuery $database 'SELECT `Action` FROM `CustomAction`' @('Action') @('String')
|
||||
$legacyActions = @('SetCreateWinAppSDKHardlinksParam', 'CreateWinAppSDKHardlinks', 'SetDeleteWinAppSDKHardlinksParam', 'DeleteWinAppSDKHardlinks')
|
||||
foreach ($legacyAction in $legacyActions) {
|
||||
if ($customActions.Action -contains $legacyAction) {
|
||||
@@ -233,11 +233,6 @@ function Get-WinUI3DuplicateFileData {
|
||||
}
|
||||
}
|
||||
|
||||
$launchAction = @($customActions | Where-Object { $_.Action -eq 'LaunchPowerToys' })
|
||||
if ($launchAction.Count -ne 1 -or ($launchAction[0].Type -band 0x400) -ne 0) {
|
||||
throw "LaunchPowerToys must be an immediate custom action in $resolvedPath."
|
||||
}
|
||||
|
||||
if ($fileRows.File -contains 'WinUI3Apps_hardlinks_txt' -or $fileRows.FileName -match '(^|\|)hardlinks\.txt$') {
|
||||
throw "Legacy hardlinks.txt manifest is still present in $resolvedPath."
|
||||
}
|
||||
@@ -256,8 +251,6 @@ function Get-WinUI3DuplicateFileData {
|
||||
Assert-ActionBefore $sequenceByAction 'UninstallPackageIdentityMSIX' 'RemoveDuplicateFiles' $resolvedPath
|
||||
Assert-ActionBefore $sequenceByAction 'RemoveDuplicateFiles' 'RemoveFiles' $resolvedPath
|
||||
Assert-ActionBefore $sequenceByAction 'RemoveDuplicateFiles' 'InstallFiles' $resolvedPath
|
||||
Assert-ActionBefore $sequenceByAction 'InstallFinalize' 'LaunchPowerToys' $resolvedPath
|
||||
|
||||
if ($sequenceByAction.ContainsKey('PatchFiles')) {
|
||||
Assert-ActionBefore $sequenceByAction 'PatchFiles' 'DuplicateFiles' $resolvedPath
|
||||
}
|
||||
|
||||
@@ -213,24 +213,11 @@ UINT __stdcall LaunchPowerToysCA(MSIHANDLE hInstall)
|
||||
UINT er = ERROR_SUCCESS;
|
||||
std::wstring installationFolder, path, args;
|
||||
std::wstring commandLine;
|
||||
LPWSTR installFolderProperty = nullptr;
|
||||
LPWSTR replacedInUseFiles = nullptr;
|
||||
|
||||
hr = WcaInitialize(hInstall, "LaunchPowerToys");
|
||||
ExitOnFailure(hr, "Failed to initialize");
|
||||
|
||||
hr = WcaGetProperty(L"ReplacedInUseFiles", &replacedInUseFiles);
|
||||
ExitOnFailure(hr, "Failed to get ReplacedInUseFiles property.");
|
||||
|
||||
if ((replacedInUseFiles && replacedInUseFiles[0] != L'\0') || MsiGetMode(hInstall, MSIRUNMODE_REBOOTATEND) || MsiGetMode(hInstall, MSIRUNMODE_REBOOTNOW))
|
||||
{
|
||||
WcaLog(LOGMSG_STANDARD, "LaunchPowerToys: Skipping launch because Windows Installer requires a reboot.");
|
||||
goto LExit;
|
||||
}
|
||||
|
||||
hr = WcaGetProperty(L"INSTALLFOLDER", &installFolderProperty);
|
||||
ExitOnFailure(hr, "Failed to get INSTALLFOLDER property.");
|
||||
installationFolder = installFolderProperty;
|
||||
hr = getInstallFolder(hInstall, installationFolder);
|
||||
ExitOnFailure(hr, "Failed to get installFolder.");
|
||||
|
||||
path = installationFolder;
|
||||
path += L"\\PowerToys.exe";
|
||||
@@ -320,8 +307,6 @@ UINT __stdcall LaunchPowerToysCA(MSIHANDLE hInstall)
|
||||
}
|
||||
|
||||
LExit:
|
||||
ReleaseStr(installFolderProperty);
|
||||
ReleaseStr(replacedInUseFiles);
|
||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||
return WcaFinalize(er);
|
||||
}
|
||||
|
||||
@@ -109,6 +109,7 @@
|
||||
<SetProperty Id="InstallScope" Value="$(var.InstallScope)" Before="DetectPrevInstallPath" Sequence="execute"></SetProperty>
|
||||
<InstallExecuteSequence>
|
||||
<Custom Action="DetectPrevInstallPath" After="AppSearch" />
|
||||
<Custom Action="SetLaunchPowerToysParam" Before="LaunchPowerToys" />
|
||||
<Custom Action="SetInstallCmdPalPackageParam" Before="InstallCmdPalPackage" />
|
||||
<Custom Action="SetUninstallCommandNotFoundParam" Before="UninstallCommandNotFound" />
|
||||
<Custom Action="SetUpgradeCommandNotFoundParam" Before="UpgradeCommandNotFound" />
|
||||
@@ -157,7 +158,7 @@
|
||||
<Custom Action="UninstallDSCModule" After="InstallFinalize" Condition="Installed AND (REMOVE="ALL")" />
|
||||
<?endif?>
|
||||
<Custom Action="TerminateProcesses" Before="InstallValidate" />
|
||||
<Custom Action="LaunchPowerToys" After="InstallFinalize" Condition="NOT Installed" />
|
||||
<Custom Action="LaunchPowerToys" Before="InstallFinalize" Condition="NOT Installed" />
|
||||
|
||||
<!-- Clean Video Conference Mute registry keys that might be around from previous installations. We've deprecated this utility since then. -->
|
||||
<Custom Action="CleanVideoConferenceRegistry" Before="InstallFinalize" Condition="NOT Installed" />
|
||||
@@ -167,12 +168,14 @@
|
||||
|
||||
</InstallExecuteSequence>
|
||||
|
||||
<CustomAction Id="SetLaunchPowerToysParam" Property="LaunchPowerToys" Value="[INSTALLFOLDER]" />
|
||||
|
||||
<CustomAction Id="SetInstallCmdPalPackageParam" Property="InstallCmdPalPackage" Value="[INSTALLFOLDER]" />
|
||||
|
||||
<!-- Set InstallLocation for Bundle entry as well -->
|
||||
<CustomAction Id="SetBundleInstallLocationData" Property="SetBundleInstallLocation" Value="[INSTALLFOLDER];[BUNDLEINFO];[InstallScope]" />
|
||||
|
||||
<CustomAction Id="LaunchPowerToys" Return="ignore" DllEntry="LaunchPowerToysCA" BinaryRef="PTCustomActions" />
|
||||
<CustomAction Id="LaunchPowerToys" Return="ignore" Impersonate="yes" Execute="deferred" DllEntry="LaunchPowerToysCA" BinaryRef="PTCustomActions" />
|
||||
|
||||
<CustomAction Id="TerminateProcesses" Return="ignore" Execute="immediate" DllEntry="TerminateProcessesCA" BinaryRef="PTCustomActions" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user