We have developed MSI package in Installshiled 2008 Premier Edition and project type is Installscript MSI, recently we bought 2011 and upgrdaded our project to 2011.
In earlier version we used to check the registry entries for Microsoft SQL Express and its path is
**HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL**
Now a new require came to create a package for 64 bit O.S., since O.S. is 64-bit but the registry path for SQL Express in 64 bit is
**HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\Instance Names\SQL**
The registry function RegDBKeyExists
is to check SQL registry's presence, but function is returning a negative number as -2147483646 and fails to read.
setting the option REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY
will not help because we not reading 64 bit related registry Hive.
Don't worry about it so much; Registry Reflection makes this do the right thing without extra code. When a 32-bit app accesses
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL
on a 64-bit machine it will be redirected and seeHKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\Instance Names\SQL
(unless it passes theKEY_WOW64_64KEY
- equivalent to theREGDB_OPTION_WOW64_64KEY
).If you hardcode the Wow6432Node key into your query, this scenario will tend to see the keys under a path including
HKLM\Software\Wow6432Node\Wow6432Node\...
and be unable to find the key you meant to find.