lonewolf32
Level 5

Installing 64-bit components - calling BAT shows strange behavior

Hi I am trying to install Oracle ODP.NET drivers during my Installscript installation, on Windows Server 2008 R2. The oracle drivers come in the form of a series of BAT files, a bunch of subdirectories and helper executables (xcopy install).

One of the Oracle provided batch files that gets called does something like this to create some registry entries:
[CODE]REM setup registry entries for ODP.NET 4
echo Windows Registry Editor Version 5.00 > "%BAT_DIR%"\odp.net.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\ODP.NET] >> "%BAT_DIR%"\odp.net.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\ODP.NET\4.112.2.0] >> "%BAT_DIR%"\odp.net.reg
echo "DllPath"="%REG_DIR%bin" >> "%BAT_DIR%"\odp.net.reg
echo "PromotableTransaction"="promotable" >> "%BAT_DIR%"\odp.net.reg
echo "StatementCacheWithUdts"="1" >> "%BAT_DIR%"\odp.net.reg
echo "TraceFileName"="c:\\odpnet4.trc" >> "%BAT_DIR%"\odp.net.reg
echo "TraceLevel"="0" >> "%BAT_DIR%"\odp.net.reg
echo "TraceOption"="0" >> "%BAT_DIR%"\odp.net.reg
echo "PerformanceCounters"="0" >> "%BAT_DIR%"\odp.net.reg
echo "UdtCacheSize"="4096" >> "%BAT_DIR%"\odp.net.reg
echo "DemandOraclePermission"="0" >> "%BAT_DIR%"\odp.net.reg
echo "SelfTuning"="1" >> "%BAT_DIR%"\odp.net.reg
echo "MaxStatementCacheSize"="100" >> "%BAT_DIR%"\odp.net.reg

regedit /s "%BAT_DIR%\odp.net.reg"
del /q "%BAT_DIR%\odp.net.reg"[/CODE]

Note the registry keys specified. We know from working with 32 and 64 bit OSes that if you run this as a 32 bit process the registry items would get redirected to a \Wow6432Node subkey.

Here is what I don't get. When I run the batch file myself from a command prompt, these reg entries get created in the correct 64 bit registry location. However, when I call the batch file from my install script (using LaunchAppAndWait) the registry keys are redirected under \Wow6432Node.

I get that the installer is probably a 32 bit EXE... however then I don't understand why I am able to then (in InstallScript) copy the registry keys to the proper 64 bit location using RegCopyKeys.

So I found my "solution" by copying the keys over... but I would really like to know the technical reason this is occurring. If anyone has insight I would appreciate it!
Labels (1)
0 Kudos
4 Replies
MichaelU
Flexera
Flexera

Chances are high that the call to regedit is invoking the 32-bit regedit; if you don't ensure that it's a 64-bit batch evaluation, it will use 32-bit paths to launch everything, including regedit.

I actually make use of the 32-bit regedit myself from time to time to properly register a 32-bit .reg file without having to insert the Wow6432Node key references by hand.
0 Kudos
luismcasillas
Level 2


  • Project is compiled/packaged from a 32-bit server.
  • Both 32-bit binaries and 64-bit binaries exist within the project that will need to be deployed to the respective environments.
  • We only provide one installer for both environments. (probably not the best approach)
  • (On a 64-bit targeted machine) the 64-bit files require to be installed into the "System32" folder and NOT the "SysWOW64" Folder


Issues I have faced thus far:

  • I cannot set the component where the 64-bit binaries are configured as a "64-bit component" because the package will not be able to run in a 32-bit machine.
  • Attempted to include an entry into the DirectEditor "MoveFile" table... that did not work.


So my question is:
Is the only solution that I am left with to create a 64-bit installer specifically for this environment? even though there is no registration being executed explicitly by the installer for these files? I understand that the reflection being triggered by the Operating system is natural behavior but would a solution of executing a batch file that would copy the files from one location to the System32 work?

Also if I upgrade the server where the installers are being packaged to a 64-bit machine, would I still be able to create a 32-bit application targeted for 32-bit machines as well as creating 64-bit installer for 64-bit machines?

TIA
0 Kudos
rguggisberg
Level 13

Lonewolf32,
Michael is correct. The reason it works when you run from a CMD prompt is that you are most likely using the 64 bit version of CMD.exe typically found in C:\Windows\System32. Your installer is probably invoking the 32 bit version typically found in C:\Windows\SysWOW64... NO... I did not say that backwards!
0 Kudos
rcuadra
Level 6

lonewolf32 wrote:
Hi I am trying to install Oracle ODP.NET drivers during my Installscript installation, on Windows Server 2008 R2. The oracle drivers come in the form of a series of BAT files, a bunch of subdirectories and helper executables (xcopy install).

One of the Oracle provided batch files that gets called does something like this to create some registry entries:
[CODE]REM setup registry entries for ODP.NET 4
echo Windows Registry Editor Version 5.00 > "%BAT_DIR%"\odp.net.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\ODP.NET] >> "%BAT_DIR%"\odp.net.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\ODP.NET\4.112.2.0] >> "%BAT_DIR%"\odp.net.reg
echo "DllPath"="%REG_DIR%bin" >> "%BAT_DIR%"\odp.net.reg
echo "PromotableTransaction"="promotable" >> "%BAT_DIR%"\odp.net.reg
echo "StatementCacheWithUdts"="1" >> "%BAT_DIR%"\odp.net.reg
echo "TraceFileName"="c:\\odpnet4.trc" >> "%BAT_DIR%"\odp.net.reg
echo "TraceLevel"="0" >> "%BAT_DIR%"\odp.net.reg
echo "TraceOption"="0" >> "%BAT_DIR%"\odp.net.reg
echo "PerformanceCounters"="0" >> "%BAT_DIR%"\odp.net.reg
echo "UdtCacheSize"="4096" >> "%BAT_DIR%"\odp.net.reg
echo "DemandOraclePermission"="0" >> "%BAT_DIR%"\odp.net.reg
echo "SelfTuning"="1" >> "%BAT_DIR%"\odp.net.reg
echo "MaxStatementCacheSize"="100" >> "%BAT_DIR%"\odp.net.reg

regedit /s "%BAT_DIR%\odp.net.reg"
del /q "%BAT_DIR%\odp.net.reg"[/CODE]

Note the registry keys specified. We know from working with 32 and 64 bit OSes that if you run this as a 32 bit process the registry items would get redirected to a \Wow6432Node subkey.

Here is what I don't get. When I run the batch file myself from a command prompt, these reg entries get created in the correct 64 bit registry location. However, when I call the batch file from my install script (using LaunchAppAndWait) the registry keys are redirected under \Wow6432Node.

I get that the installer is probably a 32 bit EXE... however then I don't understand why I am able to then (in InstallScript) copy the registry keys to the proper 64 bit location using RegCopyKeys.

So I found my "solution" by copying the keys over... but I would really like to know the technical reason this is occurring. If anyone has insight I would appreciate it!


Try the following:

//this part will disable the redirection to 32 bit
if (SYSINFO.bIsWow64) then
//set this to point to the 64 bit registry key
Disable(WOW64FSREDIRECTION);
ChangeDirectory(WINSYSDIR64);
else
ChangeDirectory(WINSYSDIR);
endif;

*** Code to launch the batch file ***

//this will re-enable the redirection to 32 bit
if (SYSINFO.bIsWow64) then
Enable(WOW64FSREDIRECTION);
endif;
ChangeDirectory(szCurrDir);


Hope this helps.
0 Kudos