https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6183774efa3cbaef6a454…
commit 6183774efa3cbaef6a4547c6f9db6fbf1967cd8e
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Dec 30 17:14:43 2018 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Dec 30 17:15:40 2018 +0100
[UMPNPMGR] PNP_GetDeviceList: Implement the enumeration of all device instances.
---
base/services/umpnpmgr/umpnpmgr.c | 55 ++++++++++++++++++++++++++++++++++++---
1 file changed, 51 insertions(+), 4 deletions(-)
diff --git a/base/services/umpnpmgr/umpnpmgr.c b/base/services/umpnpmgr/umpnpmgr.c
index 2583d135ef..2420a47a85 100644
--- a/base/services/umpnpmgr/umpnpmgr.c
+++ b/base/services/umpnpmgr/umpnpmgr.c
@@ -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 */
DWORD
WINAPI
@@ -766,7 +814,8 @@ PNP_GetDeviceList(
}
else /* CM_GETIDLIST_FILTER_NONE */
{
- ret = CR_CALL_NOT_IMPLEMENTED;
+ ret = GetAllInstanceList(Buffer,
+ pulLength);
}
return ret;
@@ -889,7 +938,6 @@ GetEnumeratorInstanceListSize(
static
CONFIGRET
GetAllInstanceListSize(
- _In_ LPCWSTR pszEnumerator,
_Out_ PULONG pulLength)
{
WCHAR szEnumeratorBuffer[MAX_DEVICE_ID_LEN];
@@ -1016,8 +1064,7 @@ PNP_GetDeviceListSize(
}
else /* CM_GETIDLIST_FILTER_NONE */
{
- ret = GetAllInstanceListSize(pszFilter,
- pulLength);
+ ret = GetAllInstanceListSize(pulLength);
}
/* Add one character for the terminating double UNICODE_NULL */