From 8d413635dcc385b0165945e0b8871e053ef9c344 Mon Sep 17 00:00:00 2001 From: Christian Ullrich Date: Mon, 9 Dec 2024 14:54:54 +0100 Subject: [PATCH] Install the drivers with short file names (#76) * Install the drivers with short file names This avoids the need to post-process the MSI file to work around http://wixtoolset.org/issues/1422/ (installing ODBC drivers with long file names fails). For compatibility with existing configurations the short-named DLLs are also installed with their original long names. * Remove modify_msi.vbs --- installer/buildInstallers.ps1 | 6 ---- installer/modify_msi.vbs | 52 ----------------------------------- installer/psqlodbcm_cpu.wxs | 6 ++-- 3 files changed, 4 insertions(+), 60 deletions(-) delete mode 100755 installer/modify_msi.vbs diff --git a/installer/buildInstallers.ps1 b/installer/buildInstallers.ps1 index 20e15ef..7ba24ba 100644 --- a/installer/buildInstallers.ps1 +++ b/installer/buildInstallers.ps1 @@ -281,12 +281,6 @@ function buildInstaller([string]$CPUTYPE) throw "Failed to build installer database" } - Write-Host ".`nModifying psqlODBC installer database..." - cscript modify_msi.vbs $INSTBASE\psqlodbc_$CPUTYPE.msi - if ($LASTEXITCODE -ne 0) { - throw "Failed to modify installer database" - } - Write-Host ".`nDone!`n" } catch [Exception] { diff --git a/installer/modify_msi.vbs b/installer/modify_msi.vbs deleted file mode 100755 index 8934411..0000000 --- a/installer/modify_msi.vbs +++ /dev/null @@ -1,52 +0,0 @@ -' -' When the dll name of the driver is not of 8.3-format -' the modification of the FileName is needed -' -' This is to work-around an oversight in Windows Installer, see -' http://wixtoolset.org/issues/1422/ -' -' We remove the short name from the filename field in the File-table -' of the two DLLs that need to be registered as ODBC drivers. Strictly -' speaking, that makes the contents of the table invalid, because a short -' name is mandatory, but Windows Installer seems nevertheless install it -' just fine. - -Option Explicit - -Const msiOpenDatabaseModeTransact = 1 -Const msiViewModifyInsert = 1 -Const msiViewModifyUpdate = 2 -Const query = "SELECT * FROM File" - -Dim installer, database -Dim view, record -Dim pos, filename - -Set installer = Wscript.CreateObject("WindowsInstaller.Installer") -Set database = installer.OpenDatabase(WScript.Arguments(0), _ - msiOpenDatabaseModeTransact) -Set view = database.OpenView(query) -view.Execute - -Set record = view.Fetch -Do While Not record Is Nothing - - filename = record.StringData(3) - pos = InStr(filename, "|psqlodbc") - - If (pos > 0) Then - - ' Remove the ShortName part - filename = Mid(filename, pos + 1) - WScript.echo record.StringData(3) & " -> " & filename - - record.StringData(3) = filename - view.Modify msiViewModifyUpdate, record - - End If - - Set record = view.Fetch - -Loop - -database.Commit diff --git a/installer/psqlodbcm_cpu.wxs b/installer/psqlodbcm_cpu.wxs index f2cd82e..6eff2d0 100644 --- a/installer/psqlodbcm_cpu.wxs +++ b/installer/psqlodbcm_cpu.wxs @@ -52,7 +52,8 @@ - + + @@ -65,7 +66,8 @@ - + +