installer: simplify FSD/DLL registration by removing regsvr32 custom actions

This commit is contained in:
Bill Zissimopoulos 2016-05-01 20:22:38 -07:00
parent b089b98afc
commit 14366f76c5
2 changed files with 30 additions and 58 deletions

View File

@ -7,6 +7,7 @@
Version="$(var.MyVersion)" Version="$(var.MyVersion)"
Language="1033" Language="1033"
UpgradeCode="82F812D9-4083-4EF1-8BC8-0F1EDA05B46B"> UpgradeCode="82F812D9-4083-4EF1-8BC8-0F1EDA05B46B">
<Package <Package
Description="$(var.MyProductName) - $(var.MyDescription)" Description="$(var.MyProductName) - $(var.MyDescription)"
InstallerVersion="200" InstallerVersion="200"
@ -15,6 +16,7 @@
<MajorUpgrade <MajorUpgrade
DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Media Id="1" Cabinet="WinFsp.cab" EmbedCab="yes" /> <Media Id="1" Cabinet="WinFsp.cab" EmbedCab="yes" />
<Property Id="P.RegistryKey">Software\$(var.MyProductName)</Property> <Property Id="P.RegistryKey">Software\$(var.MyProductName)</Property>
<Property Id="INSTALLDIR"> <Property Id="INSTALLDIR">
<RegistrySearch <RegistrySearch
@ -24,6 +26,7 @@
Name="InstallDir" Name="InstallDir"
Type="raw" /> Type="raw" />
</Property> </Property>
<Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder"> <Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="WinFsp"> <Directory Id="INSTALLDIR" Name="WinFsp">
@ -34,6 +37,7 @@
</Directory> </Directory>
</Directory> </Directory>
</Directory> </Directory>
<DirectoryRef Id="INSTALLDIR"> <DirectoryRef Id="INSTALLDIR">
<Component Id="C.INSTALLDIR"> <Component Id="C.INSTALLDIR">
<RegistryValue <RegistryValue
@ -51,12 +55,27 @@
<Component Id="C.winfsp_x86.sys"> <Component Id="C.winfsp_x86.sys">
<File Name="winfsp-x86.sys" KeyPath="yes" /> <File Name="winfsp-x86.sys" KeyPath="yes" />
</Component> </Component>
<Component Id="C.winfsp_x64.dll">
<File Name="winfsp-x64.dll" KeyPath="yes" /> <!-- On Win64 register winfsp-x64.dll -->
<Component Id="C.winfsp_x64.dll.selfreg" Guid="F0A67746-1A9C-4976-8EC0-882E9407FA6D">
<File Id="FILE.winfsp_x64.dll.selfreg" Name="winfsp-x64.dll" KeyPath="yes" SelfRegCost="1" />
<Condition>VersionNT64</Condition>
</Component> </Component>
<Component Id="C.winfsp_x86.dll"> <Component Id="C.winfsp_x86.dll" Guid="950492FB-12F7-4E27-9124-8325A2BC9927">
<File Name="winfsp-x86.dll" KeyPath="yes" /> <File Name="winfsp-x86.dll" KeyPath="yes" />
<Condition>VersionNT64</Condition>
</Component> </Component>
<!-- On Win32 register winfsp-x86.dll -->
<Component Id="C.winfsp_x64.dll" Guid="4D6E7A8E-0CA6-49BE-B312-1EDADE725756">
<File Name="winfsp-x64.dll" KeyPath="yes" />
<Condition>NOT VersionNT64</Condition>
</Component>
<Component Id="C.winfsp_x86.dll.selfreg" Guid="F0DEF7A6-AF55-419F-A58A-DF4018C6FA73">
<File Id="FILE.winfsp_x86.dll.selfreg" Name="winfsp-x86.dll" KeyPath="yes" SelfRegCost="1" />
<Condition>NOT VersionNT64</Condition>
</Component>
<Component Id="C.memfs_x64.exe"> <Component Id="C.memfs_x64.exe">
<File Name="memfs-x64.exe" KeyPath="yes" /> <File Name="memfs-x64.exe" KeyPath="yes" />
</Component> </Component>
@ -95,11 +114,14 @@
</Component> </Component>
</Directory> </Directory>
</DirectoryRef> </DirectoryRef>
<ComponentGroup Id="C.WinFsp.bin"> <ComponentGroup Id="C.WinFsp.bin">
<ComponentRef Id="C.winfsp_x64.sys" /> <ComponentRef Id="C.winfsp_x64.sys" />
<ComponentRef Id="C.winfsp_x86.sys" /> <ComponentRef Id="C.winfsp_x86.sys" />
<ComponentRef Id="C.winfsp_x64.dll" /> <ComponentRef Id="C.winfsp_x64.dll.selfreg" />
<ComponentRef Id="C.winfsp_x86.dll" /> <ComponentRef Id="C.winfsp_x86.dll" />
<ComponentRef Id="C.winfsp_x64.dll" />
<ComponentRef Id="C.winfsp_x86.dll.selfreg" />
<ComponentRef Id="C.memfs_x64.exe" /> <ComponentRef Id="C.memfs_x64.exe" />
<ComponentRef Id="C.memfs_x86.exe" /> <ComponentRef Id="C.memfs_x86.exe" />
</ComponentGroup> </ComponentGroup>
@ -116,6 +138,7 @@
<ComponentRef Id="C.memfs.cpp" /> <ComponentRef Id="C.memfs.cpp" />
<ComponentRef Id="C.memfs_main.c" /> <ComponentRef Id="C.memfs_main.c" />
</ComponentGroup> </ComponentGroup>
<Feature <Feature
Id="F.Main" Id="F.Main"
Level="1" Level="1"
@ -150,6 +173,7 @@
<ComponentGroupRef Id="C.WinFsp.smp" /> <ComponentGroupRef Id="C.WinFsp.smp" />
</Feature> </Feature>
</Feature> </Feature>
<UI Id="FeatureTree"> <UI Id="FeatureTree">
<UIRef Id="WixUI_FeatureTree" /> <UIRef Id="WixUI_FeatureTree" />
<!-- skip the license agreement dialog; higher Order takes priority (weird) --> <!-- skip the license agreement dialog; higher Order takes priority (weird) -->
@ -166,59 +190,5 @@
Value="WelcomeDlg" Value="WelcomeDlg"
Order="10">NOT Installed</Publish> Order="10">NOT Installed</Publish>
</UI> </UI>
<!--
Use a bunch of custom actions to register our FSD/DLL.
Turns out that Wix cannot be used to register legacy drivers or
Network Provider DLL's.
-->
<CustomAction
Id="A.WinFsp.x64.Register"
Execute="deferred"
Impersonate="no"
Directory="BINDIR"
ExeCommand="&quot;[WindowsFolder]System32\regsvr32.exe&quot; winfsp-x64.dll"
Return="check" />
<CustomAction
Id="A.WinFsp.x64.Unregister"
Execute="deferred"
Impersonate="no"
Directory="BINDIR"
ExeCommand="&quot;[WindowsFolder]System32\regsvr32.exe&quot; /u winfsp-x64.dll"
Return="ignore" />
<CustomAction
Id="A.WinFsp.x86.Register"
Execute="deferred"
Impersonate="no"
Directory="BINDIR"
ExeCommand="&quot;[WindowsFolder]System32\regsvr32.exe&quot; winfsp-x86.dll"
Return="check" />
<CustomAction
Id="A.WinFsp.x86.Unregister"
Execute="deferred"
Impersonate="no"
Directory="BINDIR"
ExeCommand="&quot;[WindowsFolder]System32\regsvr32.exe&quot; /u winfsp-x86.dll"
Return="ignore" />
<InstallExecuteSequence>
<!--
We want to register our FSD/DLL in all cases except on Uninstall.
The Uninstall condition can be identified as follows:
REMOVE ~= "ALL"
See http://stackoverflow.com/a/321874
-->
<Custom Action="A.WinFsp.x64.Register" After="InstallFiles">
VersionNT64 AND NOT (REMOVE ~= "ALL")
</Custom>
<Custom Action="A.WinFsp.x64.Unregister" Before="RemoveFiles">
VersionNT64 AND (REMOVE ~= "ALL")
</Custom>
<Custom Action="A.WinFsp.x86.Register" After="InstallFiles">
NOT VersionNT64 AND NOT (REMOVE ~= "ALL")
</Custom>
<Custom Action="A.WinFsp.x86.Unregister" Before="RemoveFiles">
NOT VersionNT64 AND (REMOVE ~= "ALL")
</Custom>
</InstallExecuteSequence>
</Product> </Product>
</Wix> </Wix>

View File

@ -20,6 +20,7 @@
<SuppressAllWarnings>False</SuppressAllWarnings> <SuppressAllWarnings>False</SuppressAllWarnings>
<Pedantic>True</Pedantic> <Pedantic>True</Pedantic>
<SuppressPdbOutput>True</SuppressPdbOutput> <SuppressPdbOutput>True</SuppressPdbOutput>
<SuppressIces>ICE30</SuppressIces>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>$(SolutionDir)build\$(Configuration)\</OutputPath> <OutputPath>$(SolutionDir)build\$(Configuration)\</OutputPath>
@ -28,6 +29,7 @@
<SuppressAllWarnings>False</SuppressAllWarnings> <SuppressAllWarnings>False</SuppressAllWarnings>
<Pedantic>True</Pedantic> <Pedantic>True</Pedantic>
<SuppressPdbOutput>True</SuppressPdbOutput> <SuppressPdbOutput>True</SuppressPdbOutput>
<SuppressIces>ICE30</SuppressIces>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Product.wxs" /> <Compile Include="Product.wxs" />