mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 09:46:21 +00:00
[UMPNPMGR] PNP_GetDeviceList: Implement the enumeration of all device instances.
This commit is contained in:
parent
6d5a7b1ce3
commit
6183774efa
1 changed files with 51 additions and 4 deletions
|
@ -671,6 +671,54 @@ GetEnumeratorInstanceList(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
CONFIGRET
|
||||||
|
GetAllInstanceList(
|
||||||
|
_Inout_ PWSTR pszBuffer,
|
||||||
|
_Inout_ PDWORD pulLength)
|
||||||
|
{
|
||||||
|
WCHAR szEnumeratorBuffer[MAX_DEVICE_ID_LEN];
|
||||||
|
PWSTR pPtr;
|
||||||
|
DWORD dwIndex, dwEnumeratorLength, dwUsedLength, dwRemainingLength, dwPathLength;
|
||||||
|
DWORD dwError;
|
||||||
|
CONFIGRET ret = CR_SUCCESS;
|
||||||
|
|
||||||
|
dwUsedLength = 0;
|
||||||
|
dwRemainingLength = *pulLength;
|
||||||
|
pPtr = pszBuffer;
|
||||||
|
|
||||||
|
for (dwIndex = 0; ; dwIndex++)
|
||||||
|
{
|
||||||
|
dwEnumeratorLength = MAX_DEVICE_ID_LEN;
|
||||||
|
dwError = RegEnumKeyExW(hEnumKey,
|
||||||
|
dwIndex,
|
||||||
|
szEnumeratorBuffer,
|
||||||
|
&dwEnumeratorLength,
|
||||||
|
NULL, NULL, NULL, NULL);
|
||||||
|
if (dwError != ERROR_SUCCESS)
|
||||||
|
break;
|
||||||
|
|
||||||
|
dwPathLength = dwRemainingLength;
|
||||||
|
ret = GetEnumeratorInstanceList(szEnumeratorBuffer,
|
||||||
|
pPtr,
|
||||||
|
&dwPathLength);
|
||||||
|
if (ret != CR_SUCCESS)
|
||||||
|
break;
|
||||||
|
|
||||||
|
dwUsedLength += dwPathLength - 1;
|
||||||
|
dwRemainingLength += dwPathLength - 1;
|
||||||
|
pPtr += dwPathLength - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == CR_SUCCESS)
|
||||||
|
*pulLength = dwUsedLength + 1;
|
||||||
|
else
|
||||||
|
*pulLength = 0;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Function 10 */
|
/* Function 10 */
|
||||||
DWORD
|
DWORD
|
||||||
WINAPI
|
WINAPI
|
||||||
|
@ -766,7 +814,8 @@ PNP_GetDeviceList(
|
||||||
}
|
}
|
||||||
else /* CM_GETIDLIST_FILTER_NONE */
|
else /* CM_GETIDLIST_FILTER_NONE */
|
||||||
{
|
{
|
||||||
ret = CR_CALL_NOT_IMPLEMENTED;
|
ret = GetAllInstanceList(Buffer,
|
||||||
|
pulLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -889,7 +938,6 @@ GetEnumeratorInstanceListSize(
|
||||||
static
|
static
|
||||||
CONFIGRET
|
CONFIGRET
|
||||||
GetAllInstanceListSize(
|
GetAllInstanceListSize(
|
||||||
_In_ LPCWSTR pszEnumerator,
|
|
||||||
_Out_ PULONG pulLength)
|
_Out_ PULONG pulLength)
|
||||||
{
|
{
|
||||||
WCHAR szEnumeratorBuffer[MAX_DEVICE_ID_LEN];
|
WCHAR szEnumeratorBuffer[MAX_DEVICE_ID_LEN];
|
||||||
|
@ -1016,8 +1064,7 @@ PNP_GetDeviceListSize(
|
||||||
}
|
}
|
||||||
else /* CM_GETIDLIST_FILTER_NONE */
|
else /* CM_GETIDLIST_FILTER_NONE */
|
||||||
{
|
{
|
||||||
ret = GetAllInstanceListSize(pszFilter,
|
ret = GetAllInstanceListSize(pulLength);
|
||||||
pulLength);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add one character for the terminating double UNICODE_NULL */
|
/* Add one character for the terminating double UNICODE_NULL */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue