Files
frpmgr/installer/msi/frpmgr.wxs
Gerhard Tan 8219d4b7e5 Rewrite custom actions in C (#253)
* Rewrite custom actions in C

* Add language setting file

* Improve setup

* Improve build script

* Skip directory selection on upgrade

* Fix dll symbols error on x86

* Validate install path

* Hide language selection dialog on upgrade

* Improve macros

* Add multi-language support to the setup

* Remove old files
2025-07-03 22:05:26 +08:00

165 lines
6.6 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<?if $(sys.BUILDARCH) = "x64" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?define UpgradeCode = "C9F7C2B3-291A-454A-9871-150D98DC2645" ?>
<?elseif $(sys.BUILDARCH) = "x86" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?define UpgradeCode = "46E3AA36-10BB-4CD9-92E3-5F990AB5FC88" ?>
<?else?>
<?error Unknown platform ?>
<?endif?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="!(loc.ApplicationName)" Language="!(loc.Language)" Version="$(var.VERSION)" Manufacturer="FRP Manager Project" UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="400" Compressed="yes" InstallScope="perMachine" Languages="1033,1041,1042,2052,1028,3082" Description="!(loc.ApplicationName)" ReadOnly="yes" />
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<Condition Message="!(loc.BlockMessage)">
<![CDATA[Installed OR (VersionNT >= 603)]]>
</Condition>
<!--
Upgrading
-->
<MajorUpgrade AllowDowngrades="yes" />
<Icon Id="app.ico" SourceFile="..\icon\app.ico" />
<Binary Id="actions.dll" SourceFile="build\$(sys.BUILDARCH)\actions.dll" />
<Property Id="ARPPRODUCTICON" Value="app.ico" />
<Property Id="ARPURLINFOABOUT" Value="https://github.com/koho/frpmgr" />
<Property Id="ARPNOREPAIR" Value="yes" />
<Property Id="DISABLEADVTSHORTCUTS" Value="yes" />
<Property Id="REINSTALLMODE" Value="amus" />
<!--
Detect previous install folder if it's a upgrade
-->
<SetProperty Id="INSTALLFOLDER" Value="[PREVINSTALLFOLDER]" After="AppSearch" Sequence="first">
WIX_UPGRADE_DETECTED
</SetProperty>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<Property Id="LicenseAccepted" Value="1" />
<Feature Id="CoreFeature" Title="!(loc.ApplicationName)" Level="1">
<ComponentGroupRef Id="CoreComponents" />
</Feature>
<UI>
<UIRef Id="WixUI_InstallDir" />
<UIRef Id="WixUI_ErrorProgressText" />
<!-- Skip license dialog -->
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2">NOT WIX_UPGRADE_DETECTED</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">NOT WIX_UPGRADE_DETECTED</Publish>
<!-- Skip directory selection on upgrade -->
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="2">WIX_UPGRADE_DETECTED</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">WIX_UPGRADE_DETECTED</Publish>
<!-- Launch application after installation -->
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">NOT Installed</Publish>
</UI>
</Product>
<!--
Folders
-->
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="INSTALLFOLDER" Name="FRP" />
</Directory>
<Directory Id="ProgramMenuFolder" />
</Directory>
</Fragment>
<!--
Components
-->
<Fragment>
<ComponentGroup Id="CoreComponents" Directory="INSTALLFOLDER">
<Component Id="frpmgr.exe">
<File Id="frpmgr.exe" Source="..\bin\$(sys.BUILDARCH)\frpmgr.exe" KeyPath="yes">
<Shortcut Id="StartMenuShortcut" Name="!(loc.ApplicationName)" Directory="ProgramMenuFolder" WorkingDirectory="INSTALLFOLDER" Advertise="yes"/>
</File>
<!-- A dummy to make WiX create ServiceControl table for us. -->
<ServiceControl Id="DummyService.E3F2D6BE_38C7_4654_9C1B_C667A1F9040A" Name="DummyService.E3F2D6BE_38C7_4654_9C1B_C667A1F9040A" />
</Component>
</ComponentGroup>
</Fragment>
<!--
Actions
-->
<Fragment>
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLFOLDER]" After="CostFinalize" />
<CustomAction Id="KillFrpProcesses.SetProperty" Return="check" Property="KillFrpProcesses" Value="[#frpmgr.exe]" />
<CustomAction Id="RemoveFrpFiles.SetProperty" Return="check" Property="RemoveFrpFiles" Value="[INSTALLFOLDER]" />
<CustomAction Id="SetLangConfig.SetProperty" Return="check" Property="SetLangConfig" Value="[INSTALLFOLDER]" />
<CustomAction Id="MoveFrpProfiles.SetProperty" Return="check" Property="MoveFrpProfiles" Value="[INSTALLFOLDER]" />
<!--
Launch application
-->
<Property Id="WixShellExecTarget" Value="[#frpmgr.exe]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<!--
Close GUI windows
-->
<CustomAction Id="KillFrpGUIProcesses" BinaryKey="actions.dll" DllEntry="KillFrpGUIProcesses" Impersonate="yes" Execute="immediate" />
<InstallExecuteSequence>
<Custom Action="KillFrpGUIProcesses" Before="InstallValidate">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
</InstallExecuteSequence>
<!--
Evaluate FRP services
-->
<CustomAction Id="EvaluateFrpServices" BinaryKey="actions.dll" DllEntry="EvaluateFrpServices" />
<InstallExecuteSequence>
<Custom Action="EvaluateFrpServices" After="InstallInitialize">NOT (UPGRADINGPRODUCTCODE AND (REMOVE="ALL"))</Custom>
</InstallExecuteSequence>
<!--
Kill lingering processes
-->
<CustomAction Id="KillFrpProcesses" BinaryKey="actions.dll" DllEntry="KillFrpProcesses" Impersonate="no" Execute="deferred" />
<InstallExecuteSequence>
<Custom Action="KillFrpProcesses.SetProperty" After="StopServices" />
<Custom Action="KillFrpProcesses" After="KillFrpProcesses.SetProperty">REMOVE="ALL"</Custom>
</InstallExecuteSequence>
<!--
Delete files generated by FRP
-->
<CustomAction Id="RemoveFrpFiles" BinaryKey="actions.dll" DllEntry="RemoveFrpFiles" Impersonate="no" Execute="deferred" />
<InstallExecuteSequence>
<Custom Action="RemoveFrpFiles.SetProperty" After="DeleteServices" />
<Custom Action="RemoveFrpFiles" After="RemoveFrpFiles.SetProperty">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
</InstallExecuteSequence>
<!--
Set language of the product
-->
<CustomAction Id="SetLangConfig" BinaryKey="actions.dll" DllEntry="SetLangConfig" Impersonate="no" Execute="deferred" />
<InstallExecuteSequence>
<Custom Action="SetLangConfig.SetProperty" After="InstallFiles" />
<Custom Action="SetLangConfig" After="SetLangConfig.SetProperty">NOT (REMOVE="ALL")</Custom>
</InstallExecuteSequence>
<!--
Move old profiles to the new folder
-->
<CustomAction Id="MoveFrpProfiles" BinaryKey="actions.dll" DllEntry="MoveFrpProfiles" Impersonate="no" Execute="deferred" />
<InstallExecuteSequence>
<Custom Action="MoveFrpProfiles.SetProperty" After="InstallFiles" />
<Custom Action="MoveFrpProfiles" After="MoveFrpProfiles.SetProperty">NOT (REMOVE="ALL")</Custom>
</InstallExecuteSequence>
</Fragment>
</Wix>