0

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.

4

2 回答 2

1

As a follow up to Michael's answer and my comment (i.e. question), here's an InstallScript function to toggle registry reflection:

prototype void EnableRegistryReflection( BOOL );
///////////////////////////////////////////////////////////////////////////////
//                                                                           
// Function:  EnableRegistryReflection
//                                                                           
//  Purpose:  Toogle the automatic conversion of registry keys from 64 to 32 bit equalivents.
//            This is enabled by default.
//                                                                           
///////////////////////////////////////////////////////////////////////////////
function void EnableRegistryReflection( bEnable )
begin
    if( bEnable ) then
        REGDB_OPTIONS = REGDB_OPTIONS & ~REGDB_OPTION_WOW64_64KEY;
    else
        REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;       
    endif;
end;
于 2015-04-22T21:08:09.637 回答
1

不要太担心它;Registry Reflection使这无需额外的代码就能做正确的事。当 32 位应用程序HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL在 64 位机器上访问时,它将被重定向并查看HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\Instance Names\SQL(除非它通过KEY_WOW64_64KEY- 等效于REGDB_OPTION_WOW64_64KEY)。

如果您将 Wow6432Node 键硬编码到查询中,则这种情况往往会在路径下看到键,HKLM\Software\Wow6432Node\Wow6432Node\...并且无法找到您要查找的键。

于 2011-02-10T14:53:22.270 回答