From c1b9bb57004fb5809ce47570dd717066ab392ffd Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 14 Jul 2024 16:57:17 +0200 Subject: [PATCH] [UMPNPMGR] Add requirements list support to PNP_GetFirstLogConf and PNP_GetNextLogConf --- base/services/umpnpmgr/rpcserver.c | 35 ++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/base/services/umpnpmgr/rpcserver.c b/base/services/umpnpmgr/rpcserver.c index a8385d5221b..db6a474a0f6 100644 --- a/base/services/umpnpmgr/rpcserver.c +++ b/base/services/umpnpmgr/rpcserver.c @@ -4250,7 +4250,7 @@ PNP_GetFirstLogConf( { DPRINT("REG_RESOURCE_LIST->Count %lu\n", ((PCM_RESOURCE_LIST)lpData)->Count); - /* Indicate that we reached the end of the list */ + /* Fail, if we do not have any resource */ if (((PCM_RESOURCE_LIST)lpData)->Count == 0) { DPRINT1("No resource descriptors!\n"); @@ -4260,10 +4260,15 @@ PNP_GetFirstLogConf( } else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST) { - DPRINT1("FIXME: REG_RESOURCE_REQUIREMENTS_LIST\n"); - /* FIXME */ - ret = CR_NO_MORE_LOG_CONF; - goto done; + DPRINT("REG_RESOURCE_REQUIREMENTS_LIST->AlternativeLists %lu\n", + ((PIO_RESOURCE_REQUIREMENTS_LIST)lpData)->AlternativeLists); + + /* Fail, if we do not have any requirements */ + if (((PIO_RESOURCE_REQUIREMENTS_LIST)lpData)->AlternativeLists == 0) + { + ret = CR_NO_MORE_LOG_CONF; + goto done; + } } done: @@ -4362,10 +4367,22 @@ PNP_GetNextLogConf( } else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST) { - DPRINT1("FIXME: REG_RESOURCE_REQUIREMENTS_LIST\n"); - /* FIXME */ - ret = CR_NO_MORE_LOG_CONF; - goto done; + DPRINT("REG_RESOURCE_REQUIREMENTS_LIST->AlternativeLists %lu\n", + ((PIO_RESOURCE_REQUIREMENTS_LIST)lpData)->AlternativeLists); + + /* Fail, if we are beyond the end of the list */ + if (ulCurrentTag >= ((PIO_RESOURCE_REQUIREMENTS_LIST)lpData)->AlternativeLists) + { + ret = CR_INVALID_LOG_CONF; + goto done; + } + + /* Indicate that we reached the end of the list */ + if (ulCurrentTag == ((PIO_RESOURCE_REQUIREMENTS_LIST)lpData)->AlternativeLists - 1) + { + ret = CR_NO_MORE_LOG_CONF; + goto done; + } } /* Return the next tag value */