<?xml version="1.0" encoding="windows-1252"?>
<?if $(var.Platform) = x64 ?>
  <?ifndef OpenSSL ?>
    <?define ProductName = "OpenSC smartcard framework Light (64bit)" ?>
  <?else ?>
    <?define ProductName = "OpenSC smartcard framework (64bit)" ?>
  <?endif ?>
  <?define Win64YesNo="yes" ?>
  <?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
  <?define PlatformUpgradeCode = "{9A449570-69A2-11E0-9CC6-955B4824019B}" ?>
<?else ?>
  <?ifndef OpenSSL ?>
    <?define ProductName = "OpenSC smartcard framework Light" ?>
  <?else ?>
    <?define ProductName = "OpenSC smartcard framework" ?>
  <?endif ?>
  <?define Win64YesNo="no" ?>
  <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
  <?define PlatformUpgradeCode = "{69428F65-B96D-458D-BB87-DBB5FDB35DCE}" ?>
<?endif ?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Product Name="$(var.ProductName)"
           Id="*"
           UpgradeCode="$(var.PlatformUpgradeCode)"
           Language="1033"
           Codepage="1252"
           Version="0.21.0.0"
           Manufacturer="OpenSC Project">
    <Package Platform="$(var.Platform)"
             Description="@VS_FF_PRODUCT_NAME@ Installer"
             Comments="Provided under the terms of the GNU Lesser General Public License (LGPLv2.1+)."
             Manufacturer="OpenSC Project"
             InstallerVersion="300"
             Languages="1033"
             Compressed="yes"
             SummaryCodepage="1252"
             InstallScope="perMachine"/>
    <!-- Setup background images -->
    <WixVariable Id="WixUIBannerBmp" Value="bannrbmp.bmp"/>
    <WixVariable Id="WixUIDialogBmp" Value="dlgbmp.bmp"/>
    <!-- Links in info -->
    <Property Id="ARPHELPLINK" Value="@PRODUCT_BUGREPORT@"/>
    <Property Id="ARPURLINFOABOUT" Value="https://github.com/OpenSC/OpenSC"/>
    <Property Id="ARPURLUPDATEINFO" Value="https://github.com/OpenSC/OpenSC/releases"/>
    <Property Id="ARPCONTACT" Value="https://github.com/OpenSC"/>

	<Icon Id="OpenSC.ico" SourceFile="OpenSC.ico" />
	<Property Id="ARPPRODUCTICON" Value="OpenSC.ico" />

    <!--Custom actions-->
    <Binary Id="customactions" SourceFile="$(var.SOURCE_DIR)\win32\customactions.dll" />
    <CustomAction Id="RemoveSmartCardConfiguration" BinaryKey="customactions" DllEntry="RemoveSmartCardConfiguration" Execute="deferred" Impersonate="no"/>
    <CustomAction Id="AddSmartCardConfiguration" BinaryKey="customactions" DllEntry="AddSmartCardConfiguration" Execute="commit" Impersonate="no"/>
    <CustomAction Id="Start_pkcs11_register.exe" Execute="immediate" Impersonate="yes" Return="asyncNoWait" FileKey="pkcs11_register.exe" ExeCommand="" />

    <Media Id="1" Cabinet="OpenSC.cab" EmbedCab="yes" CompressionLevel="high"/>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Component Id="SCardSvr" Guid="*" Win64="$(var.Win64YesNo)" Permanent="yes">
        <!-- Start SCardSvr Service during startup -->
        <RegistryValue Root="HKLM" Key="System\CurrentControlSet\Services\SCardSvr" Type="integer" Name="Start" Value="2" KeyPath="yes"/>
        <!-- Start SCardSvr Service now -->
        <!-- <ServiceControl Id="StartSCardSvrService" Name="SCardSvr" Start="install" /> -->
      </Component>

      <Directory Id="$(var.PlatformProgramFilesFolder)" Name="PFiles">
        <Directory Id="OpenSC_Project_Dir" Name="OpenSC Project">
          <!-- Most of the stuff goes to the Program Files folder -->
          <Directory Id="INSTALLDIR" Name="OpenSC">
            <!-- opensc.conf sample goes to installation directory -->
            <Component Id="opensc.conf" Guid="*" Win64="$(var.Win64YesNo)">
              <File Source="$(var.SOURCE_DIR)\etc\opensc.conf" Name="opensc.conf" KeyPath="yes"/>
              <!-- -->
              <RegistryKey Root="HKLM" Key="Software\[Manufacturer]\OpenSC">
                <RegistryValue Type="string" Name="ConfigFile" Value="[INSTALLDIR]opensc.conf"/>
                <RegistryValue Type="string" Name="ProfileDir" Value="[INSTALLDIR]profiles"/>
                <RegistryValue Type="string" Name="SmDir" Value="[INSTALLDIR]tools"/>
                <RegistryValue Type="integer" Name="MiniDriverDebug" Value="0"/>
              </RegistryKey>
            </Component>

            <Directory Id="INSTALLDIR_MINIDRIVER" Name="minidriver">
              <Component Id="opensc_minidriver.dll" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\minidriver\opensc-minidriver.dll" Vital="yes"/>
              </Component>
              <!-- install an alias for the Base smart card CSP. Using a different CSP in minidriver installation deactivate the plug and play feature
                  but not all other components like the pin change screen available after ctrl+alt+del.
                  It is because the "80000001" entry is still returning the minidriver dll.-->
              <Component Id="openscBaseCSP" Guid="*" Win64="$(var.Win64YesNo)">
                <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Cryptography\Defaults\Provider\OpenSC CSP">
                  <RegistryValue Type="string" Name="Image Path" Value="basecsp.dll" KeyPath="yes"/>
                  <RegistryValue Type="integer" Name="Type" Value="1"/>
                </RegistryKey>
                <!-- when the x64 installer will install x86 components on x64 plateform too
                    <?if $(var.Platform) = x64 ?>
                    <RegistryKey Root="HKLM" Key="SOFTWARE\Wow6432Node\Microsoft\Cryptography\Defaults\Provider\OpenSC CSP">
                      <RegistryValue Type="string" Name="Image Path" Value="basecsp.dll"/>
                      <RegistryValue Type="integer" Name="Type" Value="1"/>
                    </RegistryKey>
                    <?endif?>
                    -->
              </Component>
              <Component Id="CertPropSvc" Guid="*" Win64="$(var.Win64YesNo)" Permanent="yes">
                <!-- CertPropSvc loads the minidriver and propagates the smart card's
                     certificates to the user's certificate store, see https://technet.microsoft.com/en-us/itpro/windows/keep-secure/smart-card-certificate-propagation-service -->
                <ServiceControl Id="ControlCertPropSvcStart" Name="CertPropSvc" Start="install" Wait="no" />
                <ServiceControl Id="ControlCertPropSvcStop" Name="CertPropSvc" Stop="uninstall" Wait="yes" />
                <RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\CertPropSvc">
                  <RegistryValue Type="integer" Name="Start" Value="2" KeyPath="yes"/>
                </RegistryKey>
              </Component>
            </Directory>

            <Directory Id="INSTALLDIR_PKCS11" Name="pkcs11">
              <Component Id="opensc_pkcs11.dll" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\pkcs11\opensc-pkcs11.dll" Vital="yes"/>
              </Component>
              <Component Id="onepin_opensc_pkcs11.dll" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\pkcs11\onepin-opensc-pkcs11.dll" Vital="yes"/>
              </Component>
            </Directory>

            <!-- Tools have their own folder -->
            <Directory Id="INSTALLDIR_TOOLS" Name="tools">
              <?ifdef zlib ?>
                <Component Id="zlib1.dll" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.zlib)\zlib1.dll" Vital="yes"/>
                </Component>
              <?endif ?>
              <Component Id="opensc.dll" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\libopensc\opensc.dll" Vital="yes"/>
              </Component>
              <Component Id="opensc_asn1.exe" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\tools\opensc-asn1.exe" Vital="yes"/>
              </Component>
              <Component Id="opensc_explorer.exe" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\tools\opensc-explorer.exe" Vital="yes"/>
              </Component>
              <Component Id="opensc_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\tools\opensc-tool.exe" Vital="yes"/>
              </Component>
              <Component Id="opensc_notify.exe" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\tools\opensc-notify.exe" Vital="yes"/>
              </Component>
              <Component Id="pkcs11_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\tools\pkcs11-tool.exe" Vital="yes"/>
              </Component>
              <Component Id="pkcs11_register.exe" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\tools\pkcs11-register.exe" Vital="yes"/>
              </Component>
              <Component Id="cardos_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\tools\cardos-tool.exe" Vital="yes"/>
              </Component>
              <Component Id="egk_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\tools\egk-tool.exe" Vital="yes"/>
              </Component>
              <Component Id="goid_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\tools\goid-tool.exe" Vital="yes"/>
              </Component>
              <Component Id="eidenv.exe" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\tools\eidenv.exe" Vital="yes"/>
              </Component>
              <Component Id="pkcs15_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\tools\pkcs15-tool.exe" Vital="yes"/>
              </Component>
              <Component Id="pkcs15_crypt.exe" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\tools\pkcs15-crypt.exe" Vital="yes"/>
              </Component>
              <Component Id="openpgp_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\tools\openpgp-tool.exe" Vital="yes"/>
              </Component>
              <Component Id="iasecc_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                <File Source="$(var.SOURCE_DIR)\src\tools\iasecc-tool.exe" Vital="yes"/>
              </Component>
              <?ifdef OpenSSL ?>
                <Component Id="smm_local.dll" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\smm\smm-local.dll" Vital="yes"/>
                </Component>
                <Component Id="cryptoflex_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\tools\cryptoflex-tool.exe" Vital="yes"/>
                </Component>
                <Component Id="pkcs15_init.exe" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\tools\pkcs15-init.exe" Vital="yes"/>
                </Component>
                <Component Id="netkey_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\tools\netkey-tool.exe" Vital="yes"/>
                </Component>
                <Component Id="piv_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\tools\piv-tool.exe" Vital="yes"/>
                </Component>
                <Component Id="westcos_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\tools\westcos-tool.exe" Vital="yes"/>
                </Component>
                <Component Id="sc_hsm_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\tools\sc-hsm-tool.exe" Vital="yes"/>
                </Component>
                <Component Id="dnie_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\tools\dnie-tool.exe" Vital="yes"/>
                </Component>
                <Component Id="gids_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\tools\gids-tool.exe" Vital="yes"/>
                </Component>
                <Component Id="npa_tool.exe" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\tools\npa-tool.exe" Vital="yes"/>
                </Component>
              <?endif ?>
              <Component Id="Autostart_tools" Guid="*" Win64="$(var.Win64YesNo)">
                <RegistryKey Root="HKMU" Key="Software\Microsoft\Windows\CurrentVersion\Run">
                  <RegistryValue Type="string" Name="pkcs11-register.exe" Value="[INSTALLDIR_TOOLS]pkcs11-register.exe" />
                </RegistryKey>
              </Component>
              <Component Id="Autostart_native_tools" Guid="*" Win64="$(var.Win64YesNo)">
                <?if $(var.Platform) = "x86"?>
                <Condition>
                  <![CDATA[NOT Msix64]]>
                </Condition>
                <?endif?>
                <RegistryKey Root="HKMU" Key="Software\Microsoft\Windows\CurrentVersion\Run">
                  <RegistryValue Type="string" Name="opensc-notify.exe" Value="[INSTALLDIR_TOOLS]opensc-notify.exe" />
                </RegistryKey>
              </Component>
            </Directory>
            <?ifdef OpenSSL ?>
              <Directory Id="INSTALLDIR_PROFILES" Name="profiles">
                <Component Id="cyberflex.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\cyberflex.profile"/>
                </Component>
                <Component Id="flex.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\flex.profile"/>
                </Component>
                <Component Id="gpk.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\gpk.profile"/>
                </Component>
                <Component Id="miocos.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\miocos.profile"/>
                </Component>
                <Component Id="incrypto34.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\incrypto34.profile"/>
                </Component>
                <Component Id="jcop.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\jcop.profile"/>
                </Component>
                <Component Id="muscle.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\muscle.profile"/>
                </Component>
                <Component Id="pkcs15.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\pkcs15.profile"/>
                </Component>
                <Component Id="asepcos.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\asepcos.profile"/>
                </Component>
                <Component Id="cardos.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\cardos.profile"/>
                </Component>
                <Component Id="entersafe.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\entersafe.profile"/>
                </Component>
                <Component Id="epass2003.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\epass2003.profile"/>
                </Component>
                <Component Id="myeid.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\myeid.profile"/>
                </Component>
                <Component Id="setcos.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\setcos.profile"/>
                </Component>
                <Component Id="starcos.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\starcos.profile"/>
                </Component>
                <Component Id="westcos.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\westcos.profile"/>
                </Component>
                <Component Id="oberthur.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\oberthur.profile"/>
                </Component>
                <Component Id="authentic.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\authentic.profile"/>
                </Component>
                <Component Id="rutoken.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\rutoken.profile"/>
                </Component>
                <Component Id="rutoken_ecp.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\rutoken_ecp.profile"/>
                </Component>
                <Component Id="rutoken_lite.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\rutoken_lite.profile"/>
                </Component>
                <Component Id="ias_adele_admin1.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\ias_adele_admin1.profile"/>
                </Component>
                <Component Id="ias_adele_admin2.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\ias_adele_admin2.profile"/>
                </Component>
                <Component Id="ias_adele_common.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\ias_adele_common.profile"/>
                </Component>
                <Component Id="iasecc_admin_eid.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\iasecc_admin_eid.profile"/>
                </Component>
                <Component Id="iasecc_generic_oberthur.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\iasecc_generic_oberthur.profile"/>
                </Component>
                <Component Id="iasecc_generic_pki.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\iasecc_generic_pki.profile"/>
                </Component>
                <Component Id="iasecc.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\iasecc.profile"/>
                </Component>
                <Component Id="schsm.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\sc-hsm.profile"/>
                </Component>
                <Component Id="openpgp.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\openpgp.profile"/>
                </Component>
                <Component Id="isoApplet.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\isoApplet.profile"/>
                </Component>
                <Component Id="gids.profile" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\src\pkcs15init\gids.profile"/>
                </Component>
              </Directory>
            <?endif ?>
            <?ifdef OpenPACE ?>
              <Directory Id="INSTALLDIR_CVC" Name="cvc">
                <Component Id="DESRCACC100001" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\etc\DESRCACC100001"/>
                </Component>
                <Component Id="DESCHSMCVCA00001" Guid="*" Win64="$(var.Win64YesNo)">
                  <File Source="$(var.SOURCE_DIR)\etc\DESCHSMCVCA00001"/>
                </Component>
              </Directory>
            <?endif ?>
          </Directory>
          <Directory Id="PKCS11SPYINSTALLDIR" Name="PKCS11-Spy">
            <Component Id="pkcs11_spy.dll" Guid="*" Win64="$(var.Win64YesNo)">
              <File Source="$(var.SOURCE_DIR)\src\pkcs11\pkcs11-spy.dll"/>
              <RegistryKey Root="HKLM" Key="Software\[Manufacturer]\PKCS11-Spy">
                <RegistryValue Type="string" Name="Module" Value="[INSTALLDIR_PKCS11]opensc-pkcs11.dll"/>
                <RegistryValue Type="string" Name="Output" Value="%TEMP%\pkcs11-spy.log"/>
              </RegistryKey>
            </Component>
          </Directory>
        </Directory>
      </Directory>
      <Directory Id="ProgramMenuFolder" Name="Programs">
        <Directory Id="ProgramMenuDir" Name="OpenSC Project">
          <Component Id="ProgramMenuDir" Guid="*">
            <util:InternetShortcut Id="OnlineDocumentationShortcut" Name="OpenSC wiki" Target="https://github.com/OpenSC/OpenSC/wiki"/>
            <RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
            <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
          </Component>
        </Directory>
      </Directory>
    </Directory>
    <!-- Set up the features  -->
    <Feature Id="Complete" Level="1" Title="OpenSC software suite" Display="expand">
      <Feature Id="OpenSC_core" Level="1" Title="Core components" Description="Core Libraries and configuration files used by all other components." Absent="disallow">
        <ComponentRef Id="SCardSvr"/>
        <?ifdef zlib ?>
          <ComponentRef Id="zlib1.dll"/>
        <?endif ?>
        <ComponentRef Id="opensc.conf"/>
        <?ifdef OpenSSL ?>
          <ComponentRef Id="smm_local.dll"/>
        <?endif ?>
        <?ifdef OpenPACE ?>
          <ComponentRef Id="DESRCACC100001"/>
          <ComponentRef Id="DESCHSMCVCA00001"/>
        <?endif ?>
      </Feature>
      <Feature Id="OpenSC_pkcs11" Level="1" Title="PKCS#11 module" Description="Security module that can be used by most cross-platform software, for example Firefox, Thunderbird, OpenVPN, etc.">
        <ComponentRef Id="opensc_pkcs11.dll"/>
        <ComponentRef Id="onepin_opensc_pkcs11.dll"/>
      </Feature>
      <Feature Id="PKCS11_spy" Level="1" Title="PKCS#11 Spy module" Description="PKCS#11 module for debugging library invocations.">
        <ComponentRef Id="pkcs11_spy.dll"/>
      </Feature>
      <Feature Id="OpenSC_minidriver" Level="1" Title="Smart card minidriver" Description="Security module that can be used by native Windows applications, for example Edge, Chrome, Microsoft Office, Acrobat Reader, etc.">
        <ComponentRef Id="opensc_minidriver.dll"/>
        <ComponentRef Id="openscBaseCSP"/>
        <ComponentRef Id="CertPropSvc"/>
      </Feature>
      <!-- Tools and profiles are for personalization -->
      <Feature Id="OpenSC_tools" Level="1" Title="Command line tools" Description="OpenSC tools for debugging and smart card personalization.">
        <ComponentRef Id="opensc.dll"/>
        <ComponentRef Id="opensc_asn1.exe"/>
        <ComponentRef Id="opensc_explorer.exe"/>
        <ComponentRef Id="opensc_tool.exe"/>
        <ComponentRef Id="opensc_notify.exe"/>
        <ComponentRef Id="pkcs11_tool.exe"/>
        <ComponentRef Id="pkcs11_register.exe"/>
        <ComponentRef Id="cardos_tool.exe"/>
        <ComponentRef Id="egk_tool.exe"/>
        <ComponentRef Id="goid_tool.exe"/>
        <ComponentRef Id="eidenv.exe"/>
        <ComponentRef Id="pkcs15_tool.exe"/>
        <ComponentRef Id="pkcs15_crypt.exe"/>
        <ComponentRef Id="openpgp_tool.exe"/>
        <ComponentRef Id="iasecc_tool.exe"/>
        <?ifdef OpenSSL ?>
          <ComponentRef Id="cryptoflex_tool.exe"/>
          <ComponentRef Id="pkcs15_init.exe"/>
          <ComponentRef Id="netkey_tool.exe"/>
          <ComponentRef Id="piv_tool.exe"/>
          <ComponentRef Id="westcos_tool.exe"/>
          <ComponentRef Id="sc_hsm_tool.exe"/>
          <ComponentRef Id="dnie_tool.exe"/>
          <ComponentRef Id="gids_tool.exe"/>
          <ComponentRef Id="npa_tool.exe"/>
          <ComponentRef Id="cyberflex.profile"/>
          <ComponentRef Id="flex.profile"/>
          <ComponentRef Id="gpk.profile"/>
          <ComponentRef Id="miocos.profile"/>
          <ComponentRef Id="incrypto34.profile"/>
          <ComponentRef Id="jcop.profile"/>
          <ComponentRef Id="muscle.profile"/>
          <ComponentRef Id="pkcs15.profile"/>
          <ComponentRef Id="asepcos.profile"/>
          <ComponentRef Id="cardos.profile"/>
          <ComponentRef Id="entersafe.profile"/>
          <ComponentRef Id="epass2003.profile"/>
          <ComponentRef Id="myeid.profile"/>
          <ComponentRef Id="setcos.profile"/>
          <ComponentRef Id="starcos.profile"/>
          <ComponentRef Id="westcos.profile"/>
          <ComponentRef Id="oberthur.profile"/>
          <ComponentRef Id="authentic.profile"/>
          <ComponentRef Id="rutoken.profile"/>
          <ComponentRef Id="rutoken_ecp.profile"/>
          <ComponentRef Id="rutoken_lite.profile"/>
          <ComponentRef Id="ias_adele_admin1.profile"/>
          <ComponentRef Id="ias_adele_admin2.profile"/>
          <ComponentRef Id="ias_adele_common.profile"/>
          <ComponentRef Id="iasecc_admin_eid.profile"/>
          <ComponentRef Id="iasecc_generic_oberthur.profile"/>
          <ComponentRef Id="iasecc_generic_pki.profile"/>
          <ComponentRef Id="iasecc.profile"/>
          <ComponentRef Id="schsm.profile"/>
          <ComponentRef Id="openpgp.profile"/>
          <ComponentRef Id="isoApplet.profile"/>
          <ComponentRef Id="gids.profile"/>
        <?endif ?>
        <Feature Id="OpenSC_autostart" Level="1" Title="Autostart entries" Description="After login, automatically register the PKCS#11 module and start smart card notifications.">
          <ComponentRef Id="Autostart_tools"/>
          <ComponentRef Id="Autostart_native_tools"/>
        </Feature>
      </Feature>
      <Feature Id="OpenSC_menu" Level="1" Title="Start menu entries" Description="Add documentation links to the start menu.">
        <ComponentRef Id="ProgramMenuDir"/>
      </Feature>
    </Feature>
    <UI Id='Mondo'>
      <UIRef Id="WixUI_Mondo"/>
      <UIRef Id="WixUI_ErrorProgressText"/>

      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="3">1</Publish>
      <Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3">1</Publish>
    </UI>

    <InstallExecuteSequence>
      <!-- UnInstall sequence -->
      <!-- clean the smart card registration (only at uninstall of the feature OpenSC_minidriver) -->
      <Custom Action='RemoveSmartCardConfiguration' Before="RemoveFiles">
        <![CDATA[(NOT UPGRADINGPRODUCTCODE) AND (&OpenSC_minidriver=2) AND (!OpenSC_minidriver=3) ]]>
      </Custom>

      <!-- Install sequence -->
      <!-- add the smart card registration (only at install of the feature OpenSC_minidriver) -->
      <Custom Action='AddSmartCardConfiguration' Before="RemoveSmartCardConfiguration">
        <![CDATA[ (NOT (REMOVE="ALL")) AND (NOT UPGRADINGPRODUCTCODE) AND (&OpenSC_minidriver=3) AND (!OpenSC_minidriver=2) ]]>
      </Custom>

      <!-- smart pkcs11-register.exe (only at install of the feature OpenSC_autostart) -->
      <Custom Action="Start_pkcs11_register.exe" After="InstallFinalize">
        <![CDATA[ (NOT (REMOVE="ALL")) AND (NOT UPGRADINGPRODUCTCODE) AND (&OpenSC_autostart=3) AND (!OpenSC_autostart=2) ]]>
      </Custom>

    </InstallExecuteSequence>
  </Product>
</Wix>
