Skip to content
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
19 changes: 19 additions & 0 deletions IntelPresentMon/PMInstaller/PresentMon.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

<Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine" Platform="x64"/>

<!-- Handle in-use files by scheduling for reboot (user will see FilesInUse dialog) -->
<Property Id="MSIRESTARTMANAGERCONTROL" Value="DisableShutdown" />
<Property Id="REBOOT" Value="ReallySuppress" />

<MajorUpgrade
Schedule="afterInstallValidate"
AllowDowngrades="no"
Expand Down Expand Up @@ -87,6 +91,17 @@
<UIRef Id="WixUI_ErrorProgressText" />

<WixVariable Id="WixUILicenseRtf" Value="license.rtf" />

<!-- Custom action to set REINSTALLMODE for handling in-use files -->
<CustomAction Id="SetReinstallMode"
Property="REINSTALLMODE"
Value="amus"
Execute="immediate" />

<InstallExecuteSequence>
<!-- Always set REINSTALLMODE to handle file replacement -->
<Custom Action="SetReinstallMode" Before="CostInitialize">1</Custom>
</InstallExecuteSequence>
</Product>

<Fragment>
Expand Down Expand Up @@ -147,6 +162,10 @@
Id="DesktopFolder"
Name="Desktop">
</Directory>
<Directory
Id="WindowsFolder">
<Directory Id="SystemFolder" Name="System32" />
</Directory>
</Directory>
</Fragment>

Expand Down
40 changes: 29 additions & 11 deletions IntelPresentMon/PMInstallerLib/Library.wxs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>

Expand All @@ -9,11 +9,15 @@
<!-- PresentMonService.exe (key file + Windows service) -->
<Component Id="pmon_shared_service_component"
Guid="{45531AC0-CEB6-4DD0-B6B6-2BAD7F6AD01E}"
Win64="yes">
Win64="yes"
NeverOverwrite="no"
Permanent="no">
<File Id="pmon_shared_service_exe"
Name="$(var.PresentMonService.TargetFileName)"
Source="$(var.PresentMonService.TargetPath)"
KeyPath="yes" />
KeyPath="yes"
Checksum="yes"
Vital="yes" />

<ServiceInstall Id="PmSharedServiceInstall"
Name="PresentMonSharedService"
Expand All @@ -22,15 +26,12 @@
Start="auto"
Type="ownProcess"
ErrorControl="normal"
Vital="yes" />

<!-- Stop before replace, remove on uninstall, start after install -->
Vital="no" />
<!-- Only handle service removal on uninstall - let RestartManager handle in-use files -->
<ServiceControl Id="SharedPresentMonServiceControl"
Name="PresentMonSharedService"
Start="install"
Stop="both"
Remove="uninstall"
Wait="yes" />
Wait="no" />
<RemoveFolder Id ="PresentMonSharedServiceUninstall"
Directory="service_folder"
On="uninstall"/>
Expand All @@ -39,15 +40,32 @@
<!-- PresentMonAPI2.dll -->
<Component Id="present_mon_shared_dll_component"
Guid="{BC2D2B30-9011-48E5-8592-ACC58CEFDF17}"
Win64="yes">
Win64="yes"
NeverOverwrite="no"
Permanent="no">
<File Id="present_mon_shared_api_2_dll"
Name="$(var.PresentMonAPI2.TargetFileName)"
Source="$(var.PresentMonAPI2.TargetPath)"
KeyPath="yes" />
KeyPath="yes"
Checksum="yes"
Vital="yes" />
</Component>

</DirectoryRef>

<!-- Smart service start - only if service is not already running -->
<CustomAction Id="TryStartSharedService"
Directory="SystemFolder"
ExeCommand='cmd /c "sc query PresentMonSharedService | find "RUNNING" > nul || sc start PresentMonSharedService"'
Execute="deferred"
Impersonate="no"
Return="ignore" />

<InstallExecuteSequence>
<!-- After InstallServices has registered the service (and StartServices would have run) -->
<Custom Action="TryStartSharedService" After="StartServices">1</Custom>
</InstallExecuteSequence>

<!-- Group that consumers reference -->
<ComponentGroup Id="service_files">
<ComponentRef Id="pmon_shared_service_component" />
Expand Down
4 changes: 0 additions & 4 deletions IntelPresentMon/PMInstallerLib/PMInstallerLib.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,5 @@
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</ItemGroup>
<!-- Add WiX extensions here only if you actually use them in Library.wxs -->
<!-- <ItemGroup>
<WixExtension Include="WixUtilExtension" />
</ItemGroup> -->
<Import Project="$(WixTargetsPath)" />
</Project>
3 changes: 0 additions & 3 deletions IntelPresentMon/ServiceMergeModule/ServiceMergeModule.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
<ItemGroup>
<!-- The module authoring file -->
<Compile Include="ServiceMergeModule.wxs" />
<!-- Link your existing wixlib so we get ComponentGroup Id='service_files' -->
<!-- Add extensions only if your wixlib uses them -->
<!-- <WixExtension Include="WixUtilExtension" /> -->
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PMInstallerLib\PMInstallerLib.wixproj">
Expand Down
3 changes: 3 additions & 0 deletions IntelPresentMon/ServiceMergeModule/ServiceMergeModule.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<Directory Id="service_folder" Name="PresentMonSharedService" />
</Directory>
</Directory>
<Directory Id="WindowsFolder">
<Directory Id="SystemFolder" Name="System32" />
</Directory>
</Directory>

<!-- Pull in the payload from your wixlib; no <Feature> in a Module -->
Expand Down