mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[UMPNPMGR] PNP_GetDeviceList: Implement the enumeration of device instances for a given enumerator.
This commit is contained in:
parent
71fefa32db
commit
4f37d96857
1 changed files with 74 additions and 1 deletions
|
@ -544,6 +544,7 @@ GetDeviceInstanceList(
|
|||
PWSTR pPtr;
|
||||
CONFIGRET ret = CR_SUCCESS;
|
||||
|
||||
/* Open the device key */
|
||||
dwError = RegOpenKeyExW(hEnumKey,
|
||||
pszDevice,
|
||||
0,
|
||||
|
@ -600,6 +601,76 @@ GetDeviceInstanceList(
|
|||
}
|
||||
|
||||
|
||||
CONFIGRET
|
||||
GetEnumeratorInstanceList(
|
||||
_In_ PWSTR pszEnumerator,
|
||||
_Inout_ PWSTR pszBuffer,
|
||||
_Inout_ PDWORD pulLength)
|
||||
{
|
||||
WCHAR szDeviceBuffer[MAX_DEVICE_ID_LEN];
|
||||
WCHAR szPathBuffer[512];
|
||||
HKEY hEnumeratorKey;
|
||||
PWSTR pPtr;
|
||||
DWORD dwIndex, dwDeviceLength, dwUsedLength, dwRemainingLength, dwPathLength;
|
||||
DWORD dwError;
|
||||
CONFIGRET ret = CR_SUCCESS;
|
||||
|
||||
/* Open the enumerator key */
|
||||
dwError = RegOpenKeyExW(hEnumKey,
|
||||
pszEnumerator,
|
||||
0,
|
||||
KEY_ENUMERATE_SUB_KEYS,
|
||||
&hEnumeratorKey);
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
DPRINT("Failed to open the enumerator key (Error %lu)\n", dwError);
|
||||
return CR_REGISTRY_ERROR;
|
||||
}
|
||||
|
||||
dwUsedLength = 0;
|
||||
dwRemainingLength = *pulLength;
|
||||
pPtr = pszBuffer;
|
||||
|
||||
for (dwIndex = 0; ; dwIndex++)
|
||||
{
|
||||
dwDeviceLength = MAX_DEVICE_ID_LEN;
|
||||
dwError = RegEnumKeyExW(hEnumeratorKey,
|
||||
dwIndex,
|
||||
szDeviceBuffer,
|
||||
&dwDeviceLength,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
break;
|
||||
|
||||
wsprintf(szPathBuffer, L"%s\\%s", pszEnumerator, szDeviceBuffer);
|
||||
DPRINT("Path: %S\n", szPathBuffer);
|
||||
|
||||
dwPathLength = dwRemainingLength;
|
||||
ret = GetDeviceInstanceList(szPathBuffer,
|
||||
pPtr,
|
||||
&dwPathLength);
|
||||
if (ret != CR_SUCCESS)
|
||||
break;
|
||||
|
||||
dwUsedLength += dwPathLength - 1;
|
||||
dwRemainingLength += dwPathLength - 1;
|
||||
pPtr += dwPathLength - 1;
|
||||
}
|
||||
|
||||
RegCloseKey(hEnumeratorKey);
|
||||
|
||||
if (ret == CR_SUCCESS)
|
||||
*pulLength = dwUsedLength + 1;
|
||||
else
|
||||
*pulLength = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Function 10 */
|
||||
DWORD
|
||||
WINAPI
|
||||
|
@ -688,7 +759,9 @@ PNP_GetDeviceList(
|
|||
}
|
||||
else
|
||||
{
|
||||
ret = CR_CALL_NOT_IMPLEMENTED;
|
||||
ret = GetEnumeratorInstanceList(pszFilter,
|
||||
Buffer,
|
||||
pulLength);
|
||||
}
|
||||
}
|
||||
else /* CM_GETIDLIST_FILTER_NONE */
|
||||
|
|
Loading…
Reference in a new issue