mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 10:22:59 +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 */
|
/* 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);
|
ulTransferLength = 300 * sizeof(WCHAR);
|
||||||
ulLength = 300 * sizeof(WCHAR);
|
ulLength = 300 * sizeof(WCHAR);
|
||||||
ret = PNP_GetDeviceRegProp(BindingHandle,
|
ret = PNP_GetDeviceRegProp(BindingHandle,
|
||||||
|
@ -340,6 +289,57 @@ GetDeviceInstanceKeyPath(
|
||||||
pszBuffer);
|
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:
|
done:
|
||||||
if (pszBuffer != NULL)
|
if (pszBuffer != NULL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue