installer: SxS: WIP

This commit is contained in:
Bill Zissimopoulos 2022-09-06 12:08:09 +01:00
parent f4ae097722
commit 7009324e7f
2 changed files with 48 additions and 4 deletions

View File

@ -51,7 +51,14 @@ UINT __stdcall InstanceID(MSIHANDLE MsiHandle)
SystemTime.wHour, SystemTime.wHour,
SystemTime.wMinute, SystemTime.wMinute,
SystemTime.wSecond); SystemTime.wSecond);
Sleep(1000);
/*
* Sleep 1 second to ensure timestamp uniqueness.
*
* Note that this assumes that time is monotonic and users do not change time.
* Disable for now as it is assumed that the installation takes more than 1 second to complete.
*/
//Sleep(1000);
WcaSetProperty(L"" __FUNCTION__, Result); WcaSetProperty(L"" __FUNCTION__, Result);
@ -79,7 +86,7 @@ UINT __stdcall ServiceRunning(MSIHANDLE MsiHandle)
hr = WcaInitialize(MsiHandle, __FUNCTION__); hr = WcaInitialize(MsiHandle, __FUNCTION__);
ExitOnFailure(hr, "Failed to initialize"); ExitOnFailure(hr, "Failed to initialize");
WcaGetProperty(L"" __FUNCTION__, &ServiceName); hr = WcaGetProperty(L"" __FUNCTION__, &ServiceName);
ExitOnFailure(hr, "Failed to get ServiceName"); ExitOnFailure(hr, "Failed to get ServiceName");
WcaLog(LOGMSG_STANDARD, "Initialized: \"%S\"", ServiceName); WcaLog(LOGMSG_STANDARD, "Initialized: \"%S\"", ServiceName);

View File

@ -29,7 +29,7 @@
<Property Id="OLDVERSIONINSTALLED"> <Property Id="OLDVERSIONINSTALLED">
<ProductSearch UpgradeCode="$(var.OldVersionUpgradeCode)" Minimum="0.0.0.0" /> <ProductSearch UpgradeCode="$(var.OldVersionUpgradeCode)" Minimum="0.0.0.0" />
</Property> </Property>
<Condition Message="An older version of $(var.MyProductName) is already installed. You must uninstall it before you can install this version."> <Condition Message="An older version of $(var.MyProductName) that cannot be upgraded is already installed. You must uninstall it before you can install this version.">
NOT OLDVERSIONINSTALLED NOT OLDVERSIONINSTALLED
</Condition> </Condition>
@ -1021,7 +1021,10 @@
Order="10">NOT Installed</Publish> Order="10">NOT Installed</Publish>
</UI> </UI>
<!-- Custom Actions -->
<Binary Id="CustomActions" SourceFile="..\build\$(var.Configuration)\CustomActions.dll" /> <Binary Id="CustomActions" SourceFile="..\build\$(var.Configuration)\CustomActions.dll" />
<!-- InstanceID computes a unique per-installer-run ID -->
<CustomAction <CustomAction
Id="Action.InstanceID" Id="Action.InstanceID"
BinaryKey="CustomActions" BinaryKey="CustomActions"
@ -1034,5 +1037,39 @@
<InstallUISequence> <InstallUISequence>
<Custom Action="Action.InstanceID" Before="AppSearch" /> <Custom Action="Action.InstanceID" Before="AppSearch" />
</InstallUISequence> </InstallUISequence>
<!-- ServiceRunning determines if the old driver (that did not support unload) is running. -->
<CustomAction
Id="Params.ServiceRunning"
Property="ServiceRunning"
Value="$(var.MyProductName)" />
<CustomAction
Id="Action.ServiceRunning"
BinaryKey="CustomActions"
DllEntry="ServiceRunning"
Execute="immediate"
Return="ignore" />
<CustomAction
Id="Action.ServiceRunning.Error"
Error="A component from an older version of $(var.MyProductName) that cannot be upgraded appears to be running. If you just uninstalled an older version of $(var.MyProductName) please restart your computer." />
<InstallExecuteSequence>
<Custom Action="Params.ServiceRunning" Before="Action.ServiceRunning" />
<Custom Action="Action.ServiceRunning" After="AppSearch">
<![CDATA[NOT Installed AND (0 <> ServiceRunning)]]>
</Custom>
<Custom Action="Action.ServiceRunning.Error" After="Action.ServiceRunning">
<![CDATA[NOT Installed AND (0 <> ServiceRunning)]]>
</Custom>
</InstallExecuteSequence>
<InstallUISequence>
<Custom Action="Params.ServiceRunning" Before="Action.ServiceRunning" />
<Custom Action="Action.ServiceRunning" After="AppSearch">
<![CDATA[NOT Installed AND (0 <> ServiceRunning)]]>
</Custom>
<Custom Action="Action.ServiceRunning.Error" After="Action.ServiceRunning">
<![CDATA[NOT Installed AND (0 <> ServiceRunning)]]>
</Custom>
</InstallUISequence>
</Product> </Product>
</Wix> </Wix>