Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple fixes for MSI installer #6630

Merged
merged 1 commit into from
Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion share/windows/KPXC_ExitDlg.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogTitle)" />
<!-- Custom Controls for KPXC Installer -->
<Control Id="LaunchCheckBox" Type="CheckBox" X="80" Y="243" Width="100" Height="17" Property="LAUNCHAPPONEXIT" Hidden="yes" CheckBoxValue="1" Text="Launch KeePassXC">
<Condition Action="show">NOT Installed</Condition>
<Condition Action="show">NOT Installed OR WIX_UPGRADE_DETECTED</Condition>
</Control>
</Dialog>

Expand Down
43 changes: 32 additions & 11 deletions share/windows/wix-template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,24 @@
</Component>

<DirectoryRef Id="TARGETDIR">
<!-- Startmenu shortcut -->
<!-- Startmenu shortcuts -->
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="KeePassXC">
<Component Id="ApplicationShortcut" Guid="*">
<Component Id="ApplicationShortcuts" Guid="*">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="KeePassXC"
Target="[#CM_FP_KeePassXC.exe]"
WorkingDirectory="INSTALL_ROOT"/>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\KeePassXC" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
<Shortcut Id="GettingStartedShortcut"
Name="KeePassXC - Getting Started"
Target="[#CM_FP_share.docs.KeePassXC_GettingStarted.html]"
WorkingDirectory="INSTALL_ROOT" />
<Shortcut Id="UserGuideShortcut"
Name="KeePassXC - User Guide"
Target="[#CM_FP_share.docs.KeePassXC_UserGuide.html]"
WorkingDirectory="INSTALL_ROOT" />
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\KeePassXC" Name="StartMenuShortcut" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</Directory>
</Directory>
Expand All @@ -80,33 +88,46 @@
Name="KeePassXC"
Target="[#CM_FP_KeePassXC.exe]"
WorkingDirectory="INSTALL_ROOT" />
<RemoveFile Id="RemoveDesktopIcon" Name="KeePassXC.lnk" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\KeePassXC" Name="DesktopShortcut" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</Directory>
</DirectoryRef>

<Property Id="AUTOSTARTPROGRAM" Value="1" Secure="yes" />
<!-- Custom properties to control installation options -->
<Property Id="LAUNCHAPPONEXIT" Value="1" Secure="yes" />
<Property Id="AUTOSTARTPROGRAM" Value="1" Secure="yes" />
<Property Id="AUTOSTARTPROGRAM_REGISTRY">
<RegistrySearch Id="AutoStartSearch" Root="HKCU" Key="Software\Microsoft\Windows\CurrentVersion\Run" Name="$(var.CPACK_PACKAGE_NAME)" Type="raw" />
</Property>
<Property Id="INSTALLDESKTOPSHORTCUT" Secure="yes" />
<Property Id="INSTALLDESKTOPSHORTCUT_REGISTRY">
<RegistrySearch Id="DesktopIconSearch" Root="HKCU" Key="Software\KeePassXC" Name="DesktopShortcut" Type="raw" />
</Property>

<!-- Set properties based on existing conditions, prevents changing state on upgrade -->
<SetProperty Id="AUTOSTARTPROGRAM" After="AppSearch" Value="">AUTOSTARTPROGRAM="0" OR (WIX_UPGRADE_DETECTED AND NOT AUTOSTARTPROGRAM_REGISTRY)</SetProperty>
<SetProperty Id="INSTALLDESKTOPSHORTCUT" After="AppSearch" Value="1">WIX_UPGRADE_DETECTED AND INSTALLDESKTOPSHORTCUT_REGISTRY</SetProperty>
<SetProperty Id="LicenseAccepted" After="AppSearch" Value="1">WIX_UPGRADE_DETECTED</SetProperty>

<FeatureRef Id="ProductFeature">
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="ApplicationShortcuts" />
<ComponentRef Id="Autostart" />
<ComponentRef Id="DesktopShortcut" />
</FeatureRef>

<!-- Action to launch application after installer exits -->
<Property Id="WixShellExecTarget" Value="[#CM_FP_KeePassXC.exe]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />

<Property Id="WixSilentExecCmdLine" Value='"Taskkill" /IM KeePassXC.exe' />
<!-- Action to kill running KeePassXC processes -->
<Property Id="WixSilentExecCmdLine" Value='taskkill /IM KeePassXC.exe; taskkill /IM keepassxc-proxy.exe /F' />
<CustomAction Id="KillKeePassXC" BinaryKey="WixCA" DllEntry="WixSilentExec" Execute="immediate" Return="ignore" />

<Property Id="WixQuietExecCmdLine" Value='"Taskkill" /IM keepassxc-proxy.exe /F' />
<CustomAction Id="KillProxy" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="immediate" Return="ignore" />

<InstallExecuteSequence>
<Custom Action="KillKeePassXC" Before="InstallValidate" />
<Custom Action="KillProxy" Before="InstallValidate" />
<!-- Prevent pinned taskbar shortcut from being removed -->
<RemoveShortcuts Suppress="yes" />
</InstallExecuteSequence>
</Product>
</Wix>