setupapi: Respect samDesired in SetupDiOpenClassRegKeyExW.

This commit is contained in:
Juan Lang 2007-09-21 11:32:24 -07:00 committed by Alexandre Julliard
parent 243ac3ed75
commit a9d74cf994

View file

@ -2337,7 +2337,6 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
PCWSTR MachineName,
PVOID Reserved)
{
WCHAR bracedGuidString[39];
HKEY hClassesKey;
HKEY hClassKey;
LPCWSTR lpKeyName;
@ -2363,24 +2362,36 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
return INVALID_HANDLE_VALUE;
}
if (!ClassGuid)
{
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
lpKeyName,
0,
KEY_ALL_ACCESS,
samDesired,
&hClassesKey))
{
return INVALID_HANDLE_VALUE;
}
if (ClassGuid == NULL)
return hClassesKey;
}
else
{
WCHAR bracedGuidString[39];
SETUPDI_GuidToString(ClassGuid, bracedGuidString);
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
lpKeyName,
0,
samDesired,
&hClassesKey))
{
return INVALID_HANDLE_VALUE;
}
if (RegOpenKeyExW(hClassesKey,
bracedGuidString,
0,
KEY_ALL_ACCESS,
samDesired,
&hClassKey))
{
RegCloseKey(hClassesKey);
@ -2391,6 +2402,7 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
return hClassKey;
}
}
/***********************************************************************
* SetupDiOpenDeviceInterfaceW (SETUPAPI.@)