0

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?

Jon
  • 1,675
  • 26
  • 57
  • Why dont you harvest the files with heat instead of manually doing it ? – Chris Tanev Mar 16 '16 at 14:32
  • Mostly because it's already done. Plus the files come from multiple locations (and not all files in a given location are to be included) so managing with heat would be more of a nuisance than anything. – Jon Mar 16 '16 at 14:41
  • Odd thing is, there are other Components within other Directory tags adding files and such, and there are no CreateFolder statements... does the Directory tag create the specified folder? – Jon Mar 16 '16 at 14:43
  • I only have 1 Create Folder - at the end of the first Component , and i added it because it doesnt work without it lol , in the generated heat i have no create folder at all but over 5k lines which i no way would be able to do myself(lots of files). – Chris Tanev Mar 16 '16 at 14:54
  • I used heat for the javadocs and sample code collections... takes those thoughts away. I also found that, the directory wrapping a component will be created once a file is installed to it. – Jon Mar 16 '16 at 15:05

0 Answers0