Commit a9d74cf9 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

setupapi: Respect samDesired in SetupDiOpenClassRegKeyExW.

parent 243ac3ed
...@@ -2337,7 +2337,6 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW( ...@@ -2337,7 +2337,6 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
PCWSTR MachineName, PCWSTR MachineName,
PVOID Reserved) PVOID Reserved)
{ {
WCHAR bracedGuidString[39];
HKEY hClassesKey; HKEY hClassesKey;
HKEY hClassKey; HKEY hClassKey;
LPCWSTR lpKeyName; LPCWSTR lpKeyName;
...@@ -2363,24 +2362,36 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW( ...@@ -2363,24 +2362,36 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
if (!ClassGuid)
{
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
lpKeyName, lpKeyName,
0, 0,
KEY_ALL_ACCESS, samDesired,
&hClassesKey)) &hClassesKey))
{ {
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
if (ClassGuid == NULL)
return hClassesKey; return hClassesKey;
}
else
{
WCHAR bracedGuidString[39];
SETUPDI_GuidToString(ClassGuid, bracedGuidString); SETUPDI_GuidToString(ClassGuid, bracedGuidString);
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
lpKeyName,
0,
samDesired,
&hClassesKey))
{
return INVALID_HANDLE_VALUE;
}
if (RegOpenKeyExW(hClassesKey, if (RegOpenKeyExW(hClassesKey,
bracedGuidString, bracedGuidString,
0, 0,
KEY_ALL_ACCESS, samDesired,
&hClassKey)) &hClassKey))
{ {
RegCloseKey(hClassesKey); RegCloseKey(hClassesKey);
...@@ -2390,6 +2401,7 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW( ...@@ -2390,6 +2401,7 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
RegCloseKey(hClassesKey); RegCloseKey(hClassesKey);
return hClassKey; return hClassKey;
}
} }
/*********************************************************************** /***********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment