I was reviewing some statements which came from the dark.exe decompiled output of an installshield msi file.
One section, for an example:
<Directory Id='INSTALLDIR' Name="$(var.BasicProductName)">
...
<Component Id="Comp1" Guid="xx" KeyPath="yes" SharedDllRefCount="yes" Win64="$(var.Win64)">
<CreateFolder Directory="INSTALLDIR" />
...
</Component>
<Component Id="Comp2" Guid="xx" KeyPath="yes" SharedDllRefCount="yes" Win64="$(var.Win64)">
<CreateFolder Directory="INSTALLDIR" />
...
</Component>
<Directory Id="UHDDRIVER" Name="UHDDriver">
<Component Id="MyUHD" Guid="xx" SharedDllRefCount="yes" Win64="$(var.Win64)">
<File Id="MyUHD.inf" Name="MyUHD.inf" KeyPath="yes" Vital="no" DiskId="1" Source="$(var.WIN64BINARIES)\UHDDriver\MyUHD.inf" />
<File Id="MyUHD_.cat" Name="MyUHD_.cat" Vital="no" DiskId="1" Source="$(var.WIN64BINARIES)\UHDDriver\MyUHD_.cat" />
<Driver AddRemovePrograms="no" DeleteFiles="yes" Legacy="yes" PlugAndPlayPrompt="no" Sequence="2" xmlns="http://schemas.microsoft.com/wix/DifxAppExtension" />
</Component>
<Component Id="UHDDriver_Dir" Guid="xx" KeyPath="yes" SharedDllRefCount="yes" Win64="$(var.Win64)">
<CreateFolder Directory="UHDDRIVER" />
</Component>
<Directory Id="AMD644" Name="AMD64">
<Component Id="MyUHD_AMD64" Guid="xx" KeyPath="yes" SharedDllRefCount="yes" Win64="$(var.Win64)">
<File Id="MyUHD.sys1" Name="MyUHD.sys" Vital="no" DiskId="1" Source="$(var.WIN64BINARIES)\UHDDriver\AMD64\MyUHD.sys" />
</Component>
</Directory>
<Directory Id="X864" Name="x86">
<Component Id="MyUHD_x86" Guid="xx" KeyPath="yes" SharedDllRefCount="yes" Win64="$(var.Win64)">
<File Id="MyUHD.sys" Name="MyUHD.sys" Vital="no" DiskId="1" Source="$(var.WIN64BINARIES)\UHDDriver\X86\MyUHD.sys" />
</Component>
</Directory>
</Directory>
</Directory>
Wondering if I can optimize the CreateFolder
tags as follows:
<Directory Id='INSTALLDIR' Name="$(var.BasicProductName)">
...
<Component Id="Comp1" Guid="xx" KeyPath="yes" SharedDllRefCount="yes" Win64="$(var.Win64)">
<CreateFolder />
...
</Component>
<Component Id="Comp2" Guid="xx" KeyPath="yes" SharedDllRefCount="yes" Win64="$(var.Win64)">
...
</Component>
<Directory Id="UHDDRIVER" Name="UHDDriver">
<Component Id="MyUHD" Guid="xx" SharedDllRefCount="yes" Win64="$(var.Win64)">
<CreateFolder />
<File Id="MyUHD.inf" Name="MyUHD.inf" KeyPath="yes" Vital="no" DiskId="1" Source="$(var.WIN64BINARIES)\UHDDriver\MyUHD.inf" />
<File Id="MyUHD_.cat" Name="MyUHD_.cat" Vital="no" DiskId="1" Source="$(var.WIN64BINARIES)\UHDDriver\MyUHD_.cat" />
<Driver AddRemovePrograms="no" DeleteFiles="yes" Legacy="yes" PlugAndPlayPrompt="no" Sequence="2" xmlns="http://schemas.microsoft.com/wix/DifxAppExtension" />
</Component>
<Directory Id="AMD644" Name="AMD64">
<Component Id="MyUHD_AMD64" Guid="xx" KeyPath="yes" SharedDllRefCount="yes" Win64="$(var.Win64)">
<File Id="MyUHD.sys1" Name="MyUHD.sys" Vital="no" DiskId="1" Source="$(var.WIN64BINARIES)\UHDDriver\AMD64\MyUHD.sys" />
</Component>
</Directory>
<Directory Id="X864" Name="x86">
<Component Id="MyUHD_x86" Guid="xx" KeyPath="yes" SharedDllRefCount="yes" Win64="$(var.Win64)">
<File Id="MyUHD.sys" Name="MyUHD.sys" Vital="no" DiskId="1" Source="$(var.WIN64BINARIES)\UHDDriver\X86\MyUHD.sys" />
</Component>
</Directory>
</Directory>
</Directory>
Note that I removed the component Id UHDDriver_Dir
and replaced it with a CreateFolder
tag in the first component, thinking that an empty CreateFolder
simply operates on the last known Directory
tag - is that correct? Am I okay for install/uninstall to remove that component, or do I need a defined component and guid for each dir I create?
Are there other optimizations I am missing here?