[wix-users] conditional install of device driver using WIX and DIFXAPP because of new/stricter signing requirements in W10

Anthony LaMark anthony at squadratechnologies.com
Sun Jul 16 15:47:45 PDT 2017


Hi,

I need to make a correction to what I wrote below.
Apologies for the bad information.

I did have to use unique GUIDs for the mutually exclusive components (the different drivers).
If I did not, the uninstall call to DIFXAPP would fail and cause a rollback.

Anthony LaMark
squadra technologies
http://www.squadratechnologies.com
562.221.3079

-----Original Message-----
From: Anthony LaMark [mailto:anthony at squadratechnologies.com] 
Sent: Thursday, July 13, 2017 1:40 PM
To: 'WiX Toolset Users Mailing List' <wix-users at lists.wixtoolset.org>
Subject: RE: [wix-users] conditional install of device driver using WIX and DIFXAPP because of new/stricter signing requirements in W10

Hi,

Just in case anyone else hits this issue, here is a working version of dynamically installing different "device driver files" using WIX:

The custom action calls (you may/will set it for your particular scenario) MsiSetProperty on VarX.
Based on the value of VarX, the component matching the Component element Condition will have the device driver files you need to install.

    MsiSetProperty(MSIHANDLE_in, "VarX", "1");

The custom action gets invoked because of:

    <InstallUISequence>
      <Custom Action='CustomActionSetVarX' Before='FindRelatedProducts'>
        <![CDATA[(REMOVE="")]]>
      </Custom>
    </InstallUISequence>
    
    <InstallExecuteSequence>
      <!-- INSTALL and UPGRADES -->
      <Custom Action='CustomActionSetVarX' Before='FindRelatedProducts'>
        <![CDATA[(REMOVE="")]]>
      </Custom>
      ....

Now, put the device driver files into the Component elements.
NOTE BELOW THAT I HAD TO MAKE THE Guids the same value in each Component!!!

          <Component Id='productDriver' Guid='{11111111-1111-1111-1111-111111111111}'>
            <Condition>
              <![CDATA[VarX <> 1]]>
            </Condition>
            <File Id='xSYS' Name='x.sys' DiskId='1'  KeyPath='yes' />
            <File Id='xINF' Name='x.inf' DiskId='1' />
            <File Id='xCAT' Name='x.cat' DiskId='1' />
            <difx:Driver AddRemovePrograms='no' DeleteFiles='yes' ForceInstall='yes' Legacy='yes' PlugAndPlayPrompt='no' Sequence='1'/>
          </Component>
            <Component Id='xDriverMicrosoftSigned' Guid='{11111111-1111-1111-1111-111111111111}'>
              <Condition>
                <![CDATA[VarX = 1]]>
              </Condition>
              <File Id='xSYSMicrosoftSigned' Name='x.sys' DiskId='1' KeyPath='yes' />
              <File Id='xINFMicrosoftSigned' Name='x.inf' DiskId='1' />
              <File Id='xCATMicrosoftSigned' Name='x.cat' DiskId='1' />
              <difx:Driver AddRemovePrograms='no' DeleteFiles='yes' ForceInstall='yes' Legacy='yes' PlugAndPlayPrompt='no' Sequence='1'/>
            </Component>

    <Feature Id="ProductFeatureBinaries"  Title="productBinaries" Level="1">
      <ComponentRef Id='xDriver' />
      <ComponentRef Id='xDriverMicrosoftSigned' />
     ...

I hope this is helpful for someone because it kicked my butt and I almost threw my computer out of the window!!! 😊
Thanks to everyone who contributed to setting me straight.

Anthony LaMark
squadra technologies
http://www.squadratechnologies.com
562.221.3079

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Anthony LaMark
Sent: Thursday, July 13, 2017 9:26 AM
To: 'WiX Toolset Users Mailing List' <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] conditional install of device driver using WIX and DIFXAPP because of new/stricter signing requirements in W10

First, thanks Nir, Tom and Tobias for the inputs and suggestions...you got my brain looking at different concepts and I really appreciate it.

I have taken all your input and have done some new experimenting (I "was" running out of ideas) and have narrowed it down to the fact that the conditional logic I am using is flawed (shocker! 😊).  

I ended up on this page: https://www.firegiant.com/wix/tutorial/com-expression-syntax-miscellanea/expression-syntax/
>From the text on that page:
	PROPERTY This will evaluate to true if the property has been set and has any value, even if this value is false or 0.
	NOT PROPERTY This will evaluate to true if the property has not been set at all.

Therefore, I have modified the customaction dll to either create a private property named DriverCondition if it is W10 or not create a private property named DriverCondition when it is not W10.

Then, the conditions on the two Components look like:
 	<![CDATA[NOT DriverCondition]]> <==This is not a W10 computer
 	<![CDATA[DriverCondition]]> <==This is a W10 computer

But, ideally, I would like to do a comparison of the private property's value (DriverCondition) to a value (preparing for other curve balls that MS comes up with).
The current approach above is really just a boolean (2 states).
What I would really like is:
If (DriverCondition == 0) <== OS less than W10 If (DriverCondition == 1) <== OS is W10 if (DriverCondition == 2) <== This is the next Windows OS after 10 😊
How do you do this with a property and does anyone know where this documentation resides?
The comparison logic seems really sensitive 

Some questions in my head are:
For the comparison constant, do you put no quotes, single quotes, double quotes, what if it is a numeric?, is everything treated like a string? Can you apply xslt transforms on it to make it numeric, etc.
For the property, do you just reference the variable as x, $x, var.x, etc.?

Thanks again for all the great help!

Anthony LaMark
squadra technologies
http://www.squadratechnologies.com
562.221.3079

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Tobias S
Sent: Thursday, July 13, 2017 5:32 AM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] conditional install of device driver using WIX and DIFXAPP because of new/stricter signing requirements in W10

@Anthony: ok... just read same guids for mutually excluding components.
Assume this will in your case cause trouble with the wrong installed files

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/




____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/






More information about the wix-users mailing list