r192331 - Use KEY_WOW64_32KEY when reading the registry in WindowsToolChain.cpp (PR17033)
Yaron Keren
yaron.keren at gmail.com
Thu Oct 10 01:57:00 PDT 2013
Hi Hans,
This looks good to me.
What is the advantage of building clang.exe as a 64-bit app?
Yaron
2013/10/10 Hans Wennborg <hans at hanshq.net>
> Author: hans
> Date: Wed Oct 9 18:41:48 2013
> New Revision: 192331
>
> URL: http://llvm.org/viewvc/llvm-project?rev=192331&view=rev
> Log:
> Use KEY_WOW64_32KEY when reading the registry in WindowsToolChain.cpp
> (PR17033)
>
> This exposes a 32-bit view of the registry even when Clang is built as a
> 64-bit
> program. Since Visual Studio is a 32-bit application, this is necessary
> for us
> to find it.
>
> Modified:
> cfe/trunk/lib/Driver/WindowsToolChain.cpp
>
> Modified: cfe/trunk/lib/Driver/WindowsToolChain.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/WindowsToolChain.cpp?rev=192331&r1=192330&r2=192331&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Driver/WindowsToolChain.cpp (original)
> +++ cfe/trunk/lib/Driver/WindowsToolChain.cpp Wed Oct 9 18:41:48 2013
> @@ -126,7 +126,8 @@ static bool getSystemRegistryString(cons
> strncpy(partialKey, subKey, partialKeyLength);
> partialKey[partialKeyLength] = '\0';
> HKEY hTopKey = NULL;
> - lResult = RegOpenKeyEx(hRootKey, partialKey, 0, KEY_READ, &hTopKey);
> + lResult = RegOpenKeyEx(hRootKey, partialKey, 0, KEY_READ |
> KEY_WOW64_32KEY,
> + &hTopKey);
> if (lResult == ERROR_SUCCESS) {
> char keyName[256];
> int bestIndex = -1;
> @@ -159,7 +160,8 @@ static bool getSystemRegistryString(cons
> strncat(bestName, nextKey, sizeof(bestName) - 1);
> bestName[sizeof(bestName) - 1] = '\0';
> // Open the chosen key path remainder.
> - lResult = RegOpenKeyEx(hTopKey, bestName, 0, KEY_READ, &hKey);
> + lResult = RegOpenKeyEx(hTopKey, bestName, 0, KEY_READ |
> KEY_WOW64_32KEY,
> + &hKey);
> if (lResult == ERROR_SUCCESS) {
> lResult = RegQueryValueEx(hKey, valueName, NULL, &valueType,
> (LPBYTE)value, &valueSize);
> @@ -171,7 +173,8 @@ static bool getSystemRegistryString(cons
> RegCloseKey(hTopKey);
> }
> } else {
> - lResult = RegOpenKeyEx(hRootKey, subKey, 0, KEY_READ, &hKey);
> + lResult = RegOpenKeyEx(hRootKey, subKey, 0, KEY_READ |
> KEY_WOW64_32KEY,
> + &hKey);
> if (lResult == ERROR_SUCCESS) {
> lResult = RegQueryValueEx(hKey, valueName, NULL, &valueType,
> (LPBYTE)value, &valueSize);
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131010/95231e58/attachment.html>
More information about the cfe-commits
mailing list