https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e1eb9e3620b03e753f7a4…
commit e1eb9e3620b03e753f7a4755cbcf4fcb786da5e2
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Thu Jun 29 18:06:02 2023 +0200
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Thu Jun 29 18:06:02 2023 +0200
[UMPNPMGR] PNP_Get(First/Next)LogConf: return proper tags for the resource list case
---
base/services/umpnpmgr/rpcserver.c | 36 ++++++++++++++++++++++--------------
1 file changed, 22 insertions(+), 14 deletions(-)
diff --git a/base/services/umpnpmgr/rpcserver.c b/base/services/umpnpmgr/rpcserver.c
index 355bd75e4e3..4e57e261e13 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -4237,7 +4237,7 @@ PNP_GetFirstLogConf(
goto done;
}
- DPRINT("Data size %lu\n", ulDataSize);
+ DPRINT1("Data size %lu\n", ulDataSize);
if (ulDataSize == 0 || lpData == NULL)
{
DPRINT1("No config data available!\n");
@@ -4248,21 +4248,15 @@ PNP_GetFirstLogConf(
/* Get the first tag */
if (RegDataType == REG_RESOURCE_LIST)
{
- DPRINT("REG_RESOURCE_LIST\n");
+ DPRINT("REG_RESOURCE_LIST->Count %lu\n",
((PCM_RESOURCE_LIST)lpData)->Count);
- DPRINT("ResourceList->Count %lu\n",
((PCM_RESOURCE_LIST)lpData)->Count);
+ /* Indicate that we reached the end of the list */
if (((PCM_RESOURCE_LIST)lpData)->Count == 0)
{
DPRINT1("No resource descriptors!\n");
ret = CR_NO_MORE_LOG_CONF;
goto done;
}
-
- DPRINT("lpData %p\n", lpData);
- DPRINT("&List[0] %p\n",
&(((PCM_RESOURCE_LIST)lpData)->List[0]));
-
- *pulLogConfTag =
(DWORD)((DWORD_PTR)&(((PCM_RESOURCE_LIST)lpData)->List[0]) - (DWORD_PTR)lpData);
- DPRINT("Offset (Tag): 0x%08lx\n", *pulLogConfTag);
}
else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST)
{
@@ -4347,13 +4341,24 @@ PNP_GetNextLogConf(
goto done;
}
- /* FIXME: Get the next tag */
+ /* Check if the next entry is available */
if (RegDataType == REG_RESOURCE_LIST)
{
- DPRINT1("FIXME: REG_RESOURCE_LIST\n");
- /* FIXME */
- ret = CR_NO_MORE_LOG_CONF;
- goto done;
+ DPRINT("REG_RESOURCE_LIST->Count %lu\n",
((PCM_RESOURCE_LIST)lpData)->Count);
+
+ /* Fail, if we are beyond the end of the list */
+ if (ulCurrentTag >= ((PCM_RESOURCE_LIST)lpData)->Count)
+ {
+ ret = CR_INVALID_LOG_CONF;
+ goto done;
+ }
+
+ /* Indicate that we reached the end of the list */
+ if (ulCurrentTag == ((PCM_RESOURCE_LIST)lpData)->Count - 1)
+ {
+ ret = CR_NO_MORE_LOG_CONF;
+ goto done;
+ }
}
else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST)
{
@@ -4363,6 +4368,9 @@ PNP_GetNextLogConf(
goto done;
}
+ /* Return the next tag value */
+ *pulNextTag = ulCurrentTag + 1;
+
done:
if (lpData != NULL)
HeapFree(GetProcessHeap(), 0, lpData);