<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Module
    Id="psqlODBC"
    Version="$(var.VERSION)"
    Language="1033">
    
    <Package 
      Id="ACF10866-5C01-46f0-90F0-D5618638CA48"
      Description="PostgreSQL ODBC Driver"
      Keywords="PostgreSQL, ODBC"
      Manufacturer="PostgreSQL Global Development Group" 
      InstallerVersion="150"
      Platforms="Intel" 
      Languages="1033"
      SummaryCodepage="1252" />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="BINDIR" Name=".">
        <Component Id="psqlodbc.files" Guid="00A1ACE3-B7C2-41b8-A1F1-DB565990DA4E">
          <!-- PostgreSQL -->
		<File Id="psqlodbc35w.dll" Name="psqlodbc35w.dll" Source="./win32_dll/psqlodbc35w.dll" />
		<File Id="libssl_1_1.dll" Name="libssl-1_1.dll" Source="./win32_dll/libssl-1_1.dll" KeyPath="yes" />
		<File Id="libcrypto_1_1.dll" Name="libcrypto-1_1.dll" Source="./win32_dll/libcrypto-1_1.dll" KeyPath="no" />
          
          <!-- Note, installing the driver properly (IE, using ODBCDriver) has proven unreliable -->
          <!--       so we install the registry keys manually ourselves.                         -->

          <RegistryValue Id="psqlodbc35w.reg.1" Root="HKLM" Key="SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" Name="PostgreSQL Unicode" Type="string" Value="Installed" />
          <RegistryValue Id="psqlodbc35w.reg.2" Root="HKLM" Key="SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL Unicode" Name="APILevel" Type="string" Value="1" />
          <RegistryValue Id="psqlodbc35w.reg.3" Root="HKLM" Key="SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL Unicode" Name="ConnectFunctions" Type="string" Value="YYN" />
          <RegistryValue Id="psqlodbc35w.reg.4" Root="HKLM" Key="SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL Unicode" Name="Driver" Type="string" Value="[#psqlodbc35w.dll]" />
          <RegistryValue Id="psqlodbc35w.reg.5" Root="HKLM" Key="SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL Unicode" Name="DriverODBCVer" Type="string" Value="03.51" />
          <RegistryValue Id="psqlodbc35w.reg.6" Root="HKLM" Key="SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL Unicode" Name="FileUsage" Type="string" Value="0" />
          <RegistryValue Id="psqlodbc35w.reg.7" Root="HKLM" Key="SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL Unicode" Name="Setup" Type="string" Value="[#psqlodbc35w.dll]" />
          <RegistryValue Id="psqlodbc35w.reg.8" Root="HKLM" Key="SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL Unicode" Name="SQLLevel" Type="string" Value="1" />
          <RegistryValue Id="psqlodbc35w.reg.9" Root="HKLM" Key="SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL Unicode" Name="UsageCount" Type="integer" Value="1" />
        </Component>
      </Directory>
    </Directory>

  </Module>
</Wix>
