mirror of
https://github.com/reactos/reactos.git
synced 2025-05-01 19:50:36 +00:00
[SETUPAPI] GetDeviceInstanceKeyPath: Fix temporary buffer allocation, add missing code paths and fix registry paths.
This should fix parts of CORE-13944.
This commit is contained in:
parent
f65b294f21
commit
d57b0ef91e
1 changed files with 31 additions and 15 deletions
|
@ -213,6 +213,14 @@ GetDeviceInstanceKeyPath(
|
||||||
|
|
||||||
TRACE("GetDeviceInstanceKeyPath()\n");
|
TRACE("GetDeviceInstanceKeyPath()\n");
|
||||||
|
|
||||||
|
/* Allocate a buffer for the device id */
|
||||||
|
pszBuffer = MyMalloc(300 * sizeof(WCHAR));
|
||||||
|
if (pszBuffer == NULL)
|
||||||
|
{
|
||||||
|
ERR("MyMalloc() failed\n");
|
||||||
|
return CR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
if (ulFlags & CM_REGISTRY_SOFTWARE)
|
if (ulFlags & CM_REGISTRY_SOFTWARE)
|
||||||
{
|
{
|
||||||
/* Software Key Path */
|
/* Software Key Path */
|
||||||
|
@ -229,7 +237,7 @@ GetDeviceInstanceKeyPath(
|
||||||
L"%s\\%s\\%s\\%s",
|
L"%s\\%s\\%s\\%s",
|
||||||
L"System\\CurrentControlSet\\Hardware Profiles",
|
L"System\\CurrentControlSet\\Hardware Profiles",
|
||||||
L"Current",
|
L"Current",
|
||||||
L"System\\CurrentControlSet\\Control\\Enum",
|
L"System\\CurrentControlSet\\Enum",
|
||||||
pszBuffer);
|
pszBuffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -238,13 +246,30 @@ GetDeviceInstanceKeyPath(
|
||||||
L"%s\\%04lu\\%s\\%s",
|
L"%s\\%04lu\\%s\\%s",
|
||||||
L"System\\CurrentControlSet\\Hardware Profiles",
|
L"System\\CurrentControlSet\\Hardware Profiles",
|
||||||
ulHardwareProfile,
|
ulHardwareProfile,
|
||||||
L"System\\CurrentControlSet\\Control\\Enum",
|
L"System\\CurrentControlSet\\Enum",
|
||||||
pszBuffer);
|
pszBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (ulFlags & CM_REGISTRY_USER)
|
||||||
|
{
|
||||||
|
wsprintfW(pszKeyPath,
|
||||||
|
L"%s\\%s",
|
||||||
|
L"System\\CurrentControlSet\\Enum",
|
||||||
|
pszDeviceInst);
|
||||||
|
|
||||||
|
wcscpy(pszInstancePath,
|
||||||
|
L"Device Parameters");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = CR_CALL_NOT_IMPLEMENTED;
|
SplitDeviceInstanceId(pszDeviceInst,
|
||||||
|
pszBuffer,
|
||||||
|
pszInstancePath);
|
||||||
|
|
||||||
|
wsprintfW(pszKeyPath,
|
||||||
|
L"%s\\%s",
|
||||||
|
L"System\\CurrentControlSet\\Enum",
|
||||||
|
pszBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -253,15 +278,6 @@ GetDeviceInstanceKeyPath(
|
||||||
|
|
||||||
ulTransferLength = 300 * sizeof(WCHAR);
|
ulTransferLength = 300 * sizeof(WCHAR);
|
||||||
ulLength = 300 * sizeof(WCHAR);
|
ulLength = 300 * sizeof(WCHAR);
|
||||||
|
|
||||||
pszBuffer = MyMalloc(ulTransferLength);
|
|
||||||
if (pszBuffer == NULL)
|
|
||||||
{
|
|
||||||
ERR("MyMalloc() failed\n");
|
|
||||||
ret = CR_OUT_OF_MEMORY;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = PNP_GetDeviceRegProp(BindingHandle,
|
ret = PNP_GetDeviceRegProp(BindingHandle,
|
||||||
pszDeviceInst,
|
pszDeviceInst,
|
||||||
CM_DRP_DRIVER,
|
CM_DRP_DRIVER,
|
||||||
|
@ -5288,13 +5304,13 @@ CM_Open_DevNode_Key_Ex(
|
||||||
if (ret != CR_SUCCESS)
|
if (ret != CR_SUCCESS)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
TRACE("pszKeyPath: %S\n", pszKeyPath);
|
ERR("pszKeyPath: %S\n", pszKeyPath);
|
||||||
TRACE("pszInstancePath: %S\n", pszInstancePath);
|
ERR("pszInstancePath: %S\n", pszInstancePath);
|
||||||
|
|
||||||
wcscat(pszKeyPath, L"\\");
|
wcscat(pszKeyPath, L"\\");
|
||||||
wcscat(pszKeyPath, pszInstancePath);
|
wcscat(pszKeyPath, pszInstancePath);
|
||||||
|
|
||||||
TRACE("pszKeyPath: %S\n", pszKeyPath);
|
ERR("pszKeyPath: %S\n", pszKeyPath);
|
||||||
|
|
||||||
if (hMachine == NULL)
|
if (hMachine == NULL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue