문제

I have been facing a problem in InstallScript to get the list of registry keys for 32- and 64-bit installations.

My machine is Windows Server 2008 64-bit. I can install the SQL Server 2008 32-bit version or 64-bit version on this machine.

Now during the setup I need to know whether either of the SQL Server versions are installed.

As per my understanding,

  • 64-bit applications on 64-bit machine are stored in Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall.
  • 32-bit applications on 64-bit machine are stored in Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall.

I have written a function which should search both these locations for SQL Server installation using the RegDBQueryKey function.

Even if I pass "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall" to RegDBQueryKey, it lists the keys of Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall.

Can anyone help me with this issue?

도움이 되었습니까?

해결책

Set this flag before your call to RegDBQueryKey:

REGDB_OPTIONS = REGDB_OPTION_WOW64_64KEY;

That will disable the default forwarding to the 64-bit version of the key, and give you the 32-bit version. It applies globally, so when you're done make sure to reset the flag using:

REGDB_OPTIONS = REGDB_OPTION_USE_DEFAULT_OPTIONS;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top