mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[SETUPAPI] GetDeviceInstanceKeyPath: Trying to open the hardware key opens the software key and vice versa. Fix it by swapping the code paths.
This commit is contained in:
parent
faddd38b36
commit
2037bab6c4
1 changed files with 51 additions and 51 deletions
|
@ -236,57 +236,6 @@ GetDeviceInstanceKeyPath(
|
|||
{
|
||||
/* Software Key Path */
|
||||
|
||||
if (ulFlags & CM_REGISTRY_CONFIG)
|
||||
{
|
||||
SplitDeviceInstanceId(pszDeviceInst,
|
||||
pszBuffer,
|
||||
pszInstancePath);
|
||||
|
||||
if (ulHardwareProfile == 0)
|
||||
{
|
||||
wsprintfW(pszKeyPath,
|
||||
L"%s\\%s\\%s\\%s",
|
||||
L"System\\CurrentControlSet\\Hardware Profiles",
|
||||
L"Current",
|
||||
L"System\\CurrentControlSet\\Enum",
|
||||
pszBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
wsprintfW(pszKeyPath,
|
||||
L"%s\\%04lu\\%s\\%s",
|
||||
L"System\\CurrentControlSet\\Hardware Profiles",
|
||||
ulHardwareProfile,
|
||||
L"System\\CurrentControlSet\\Enum",
|
||||
pszBuffer);
|
||||
}
|
||||
}
|
||||
else if (ulFlags & CM_REGISTRY_USER)
|
||||
{
|
||||
wsprintfW(pszKeyPath,
|
||||
L"%s\\%s",
|
||||
L"System\\CurrentControlSet\\Enum",
|
||||
pszDeviceInst);
|
||||
|
||||
wcscpy(pszInstancePath,
|
||||
L"Device Parameters");
|
||||
}
|
||||
else
|
||||
{
|
||||
SplitDeviceInstanceId(pszDeviceInst,
|
||||
pszBuffer,
|
||||
pszInstancePath);
|
||||
|
||||
wsprintfW(pszKeyPath,
|
||||
L"%s\\%s",
|
||||
L"System\\CurrentControlSet\\Enum",
|
||||
pszBuffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Hardware Key Path */
|
||||
|
||||
ulTransferLength = 300 * sizeof(WCHAR);
|
||||
ulLength = 300 * sizeof(WCHAR);
|
||||
ret = PNP_GetDeviceRegProp(BindingHandle,
|
||||
|
@ -340,6 +289,57 @@ GetDeviceInstanceKeyPath(
|
|||
pszBuffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Hardware Key Path */
|
||||
|
||||
if (ulFlags & CM_REGISTRY_CONFIG)
|
||||
{
|
||||
SplitDeviceInstanceId(pszDeviceInst,
|
||||
pszBuffer,
|
||||
pszInstancePath);
|
||||
|
||||
if (ulHardwareProfile == 0)
|
||||
{
|
||||
wsprintfW(pszKeyPath,
|
||||
L"%s\\%s\\%s\\%s",
|
||||
L"System\\CurrentControlSet\\Hardware Profiles",
|
||||
L"Current",
|
||||
L"System\\CurrentControlSet\\Enum",
|
||||
pszBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
wsprintfW(pszKeyPath,
|
||||
L"%s\\%04lu\\%s\\%s",
|
||||
L"System\\CurrentControlSet\\Hardware Profiles",
|
||||
ulHardwareProfile,
|
||||
L"System\\CurrentControlSet\\Enum",
|
||||
pszBuffer);
|
||||
}
|
||||
}
|
||||
else if (ulFlags & CM_REGISTRY_USER)
|
||||
{
|
||||
wsprintfW(pszKeyPath,
|
||||
L"%s\\%s",
|
||||
L"System\\CurrentControlSet\\Enum",
|
||||
pszDeviceInst);
|
||||
|
||||
wcscpy(pszInstancePath,
|
||||
L"Device Parameters");
|
||||
}
|
||||
else
|
||||
{
|
||||
SplitDeviceInstanceId(pszDeviceInst,
|
||||
pszBuffer,
|
||||
pszInstancePath);
|
||||
|
||||
wsprintfW(pszKeyPath,
|
||||
L"%s\\%s",
|
||||
L"System\\CurrentControlSet\\Enum",
|
||||
pszBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
if (pszBuffer != NULL)
|
||||
|
|
Loading…
Reference in a new issue