PDA

View Full Version : Get Registry Key on Windows 2008 Server 64 bit



NewsArchive
05-19-2010, 02:16 AM
Ok, I have read over the other posts I found on Registry and 64bit os.

Still not sure why I am having the problem I am having.

Synopsis:
Get the SQL paths from the registry, so I know where to put the datafiles I
am installing/updating.

Code:
Set Variable %SQL_MSSQLKEY% to FUNCTION:Get Registry Key
Value("MyInstanceName") from
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance
Names\SQL"
If %_SB_ERRORCODE% Does Not Equal "0" Then
Set Variable %SQL_DATAPATH% to FUNCTION:Get Registry Key
Value("SQLDataRoot") from "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft
SQL Server\%SQL_MSSQLKEY%\Setup"
Set Variable %SQL_BACKUPPATH% to FUNCTION:Get Registry Key
Value("BackupDirectory") from
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL
Server\%SQL_MSSQLKEY%\MSSQLServer"
Else
Display Message Box "It appears there was an error accessing the
follow..." -- "Error Accessing Registry"
End

Results:
This works perfectly on any 32 bit OS, but it appears that on 64 bit OS, it
is looking in the Wow6432Node section. Since SQL registry keys aren't
there, I get errors.
So, how do I force access into the regular 64 bit area of the registry?

Notes:
Install IS code signed. This particular install is not using any clarion
apps. Simply installs a SQL MyDatabase.BAK file, and then runs a restore
script.

Glenn Paschal

NewsArchive
05-19-2010, 02:17 AM
Glenn,

> This works perfectly on any 32 bit OS, but it appears that on 64 bit OS,
> it is looking in the Wow6432Node section. Since SQL registry keys aren't
> there, I get errors.
> So, how do I force access into the regular 64 bit area of the registry?

See "Set x64 Mode..." function. To read a 64-bit registry key, you have to
switch the application to 64-bit mode.

Don't forget to set it back to 32-bit after you handled your 64-bit stuff.
Otherwise, the installer continues in 64-bit mode.

Friedrich

NewsArchive
05-19-2010, 02:17 AM
Ok, this makes sense... how do you switch modes back and forth from 32 to 64
bit modes?

Thanks Friedrich!

--Glenn.

NewsArchive
05-19-2010, 02:18 AM
Glenn,

> Ok, this makes sense... how do you switch modes back and forth from 32 to
> 64 bit modes?

See attached screenshot. If you set it to "Enable x64 Support" then the
installer will switch into 64-bit mode on 64-bit operating systems. If you
set it to "Disable x64 Support" then it will go back to 32-bit processing
mode.

In other words, before you read the 64-bit key, enable x64 mode. Then read
the key and after that, disable 64-bit mode so your installer continues in
32-bit.

Friedrich

NewsArchive
05-19-2010, 02:19 AM
Notes: I was doing some more research and was looking at the General
Information / Generator tab.
I was reading in the help file (yes, I actually use the help file! <grin>)
and set the Installer Type to 32/64 bit hybrid.

The Get Registry Key functions are now returning the correct values, but I
get an error right after the welcome screen.
"The specified module could not be found. (msls31.dll)"

I have no code in the dialog loop, and the only dialogs I am using is the
Welcome, License Agreement, and Finish. (Very basic install).

Still digging...

Thanks,
--Glenn.

NewsArchive
05-19-2010, 02:19 AM
Glenn,

> Notes: I was doing some more research and was looking at the General
> Information / Generator tab.
> I was reading in the help file (yes, I actually use the help file!
> <grin>) and set the Installer Type to 32/64 bit hybrid.

I assume, your application is not native 64-bit, so it does not make sense
to set the installer to 64-bit ;-)

You would use a hybrid 32-bit installer to install a 32-bit application on
32-bit Windows and a native 64-bit application on 64-bit Windows from the
same setup.exe.

> The Get Registry Key functions are now returning the correct values,

Switch back your installer to 32-bit immediately <g> What you are doing is
not correct!

> but I get an error right after the welcome screen.
> "The specified module could not be found. (msls31.dll)"
> I have no code in the dialog loop, and the only dialogs I am using is the
> Welcome, License Agreement, and Finish. (Very basic install).

The following discusses your msls31.dll issue:
http://www.lindersoft.com/forums/showthread.php?t=9589

Friedrich

NewsArchive
05-19-2010, 02:20 AM
Awesome. Thanks for the help on both branches of this thread.
Will fix my RTF and go from there.
And, yes, I switched it back to 32 bit (Thank you, may I have another?) <g>

Glenn Paschal

NewsArchive
05-19-2010, 02:20 AM
> Awesome. Thanks for the help on both branches of this thread.
> Will fix my RTF and go from there.
> And, yes, I switched it back to 32 bit (Thank you, may I have another?)
> <g>

<G> :)

Friedrich