Skip to content
⌘ NSIS Forum Archive

Wow64 System32 SQLite3 ODBC Setup Issue

4 posts

NROLF0016#

Wow64 System32 SQLite3 ODBC Setup Issue

Hi *,

In my installer (Win 10, 64bit) I am trying to setup an SQlite3 ODBC dsn by calling a bat file using ExecWait.
The bat file itself contains just one command %WINDIR%\system32\odbcconf with arguments.



When I run the bat file externally (e.g. through double click), DSN wil be created properly.
However when I run the installer I am getting an error message that DSN could not be created due to missing components.

Using Proess Monitor I have found out that external call is trying to access
"HKLM\SOFTWARE\ODBC\ODBCINST.INI\SQLite3 ODBC Driver" which is correct.

However when running the installer, application tries to access
"HKLM\SOFTWARE\WOW6432Node\ODBC\ODBCINST.INI\SQLite3 ODBC Driver" which is incorrect.

I wonder why the installer tries to access WOW6432Node....

It should operate in 64bit mode only and hence not search keys in WOW6432Node.


BTW, the nsODBC plugin does not work either....


Any thoughts or comments on this?
Anders#
The 32-bit version of odbcconf is probably executed (because the parent process is 32-bit). Why odbcconf can't handle this, I don't know.

There is not much point in using a batch file if it contains only a single line.

If you only support Vista and later you can do this:

!include x64.nsh
!include LogicLib.nsh
Section
${If} ${IsWoW64}
  ExecWait '"$sysdir\..\sysnative\odbcconf.exe" /?' ; Vista+ (Or the obscure by-request-only hotfix (KB 942589) for 64-bit XP/2003)
${Else}
  ExecWait '"$sysdir\odbcconf.exe" /?'
${EndIf}
SectionEnd 
Or slightly more risky but should work on 64-bit XP/2003

!include x64.nsh
Section
${DisableX64FSRedirection}
ExecWait '"$sysdir\odbcconf.exe" /?'
${EnableX64FSRedirection}
SectionEnd 
Or a hybrid:

!include x64.nsh
!include LogicLib.nsh
Section
${If} ${FileExists} "$sysdir\..\sysnative\ntdll.dll"
${AndIf} ${IsWoW64}
  ExecWait '"$sysdir\..\sysnative\odbcconf.exe" /?' ; Vista+
${Else}
  ${DisableX64FSRedirection}
  ExecWait '"$sysdir\odbcconf.exe" /?'
  ${EnableX64FSRedirection}
${EndIf}
SectionEnd 
Using Exec and ExecWait with DisableX64FSRedirection should be relatively safe, ExecShell however is not.
NROLF0016#
I am calling WINDIR\system32\odbconf.exe. In this directory there are all 64bit executable including the odbcad32.exe, which is invoked when you manually setup a 64 bit source.


I know it's confusing, but all 64bit related stuff is located %WINDIR%\systm32, while the legacy 32bit can be found under %windir%\syswow64



What can I do other than specifying the path the - in my opinion - correct path WINDIR\system32\odbconf.exe
Anders#
When a 32-bit application accesses %WINDIR%\system32 it is actually accessing %WINDIR%\syswow64.

This is called out specifically @ https://docs.microsoft.com/en-us/win...-communication

A 64-bit executable file located under %windir%\System32 cannot be launched from a 32-bit process, because the file system redirector redirects the path.