Old 27th April 2020, 11:54   #1
NROLF0016
Junior Member
 
Join Date: Apr 2020
Posts: 7
Question 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?
NROLF0016 is offline   Reply With Quote
Old 27th April 2020, 12:50   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
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:

PHP Code:
!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

PHP Code:
!include x64.nsh

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

PHP Code:
!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.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 27th April 2020, 13:10   #3
NROLF0016
Junior Member
 
Join Date: Apr 2020
Posts: 7
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
NROLF0016 is offline   Reply With Quote
Old 27th April 2020, 13:16   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
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

Quote:
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.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
sqlite odbc 32bit 64bit, sysnative, wow64

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump