https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e88a6b2053d403f288546…
commit e88a6b2053d403f288546694d8a7079c34180925
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sat Mar 2 20:52:52 2019 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sat Mar 2 20:59:12 2019 +0100
[SETUPAPI] Implement CM_Next_Range()
---
dll/win32/setupapi/cfgmgr.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c
index 0a3035d6ae..6af41f2910 100644
--- a/dll/win32/setupapi/cfgmgr.c
+++ b/dll/win32/setupapi/cfgmgr.c
@@ -72,6 +72,7 @@ typedef struct _NOTIFY_DATA
typedef struct _INTERNAL_RANGE
{
LIST_ENTRY ListEntry;
+ struct _INTERNAL_RANGE_LIST *pRangeList;
DWORDLONG ullStart;
DWORDLONG ullEnd;
} INTERNAL_RANGE, *PINTERNAL_RANGE;
@@ -1065,6 +1066,7 @@ CM_Add_Range(
goto done;
}
+ pRange->pRangeList = pRangeList;
pRange->ullStart = ullStartValue;
pRange->ullEnd = ullEndValue;
@@ -5900,10 +5902,51 @@ CM_Next_Range(
_Out_ PDWORDLONG pullEnd,
_In_ ULONG ulFlags)
{
+ PINTERNAL_RANGE_LIST pRangeList;
+ PINTERNAL_RANGE pRange;
+ PLIST_ENTRY ListEntry;
+ CONFIGRET ret = CR_SUCCESS;
+
FIXME("CM_Next_Range(%p %p %p %lx)\n",
preElement, pullStart, pullEnd, ulFlags);
- return CR_CALL_NOT_IMPLEMENTED;
+ pRange = (PINTERNAL_RANGE)preElement;
+
+ if (pRange == NULL || pRange->pRangeList == NULL)
+ return CR_FAILURE;
+
+ if (pullStart == NULL || pullEnd == NULL)
+ return CR_INVALID_POINTER;
+
+ if (ulFlags != 0)
+ return CR_INVALID_FLAG;
+
+ pRangeList = pRange->pRangeList;
+
+ /* Lock the range list */
+ WaitForSingleObject(pRangeList->hMutex, INFINITE);
+
+ /* Fail, if we reached the end of the list */
+ if (pRange->ListEntry.Flink == &pRangeList->ListHead)
+ {
+ ret = CR_FAILURE;
+ goto done;
+ }
+
+ /* Get the next range */
+ ListEntry = pRangeList->ListHead.Flink;
+ pRange = CONTAINING_RECORD(ListEntry, INTERNAL_RANGE, ListEntry);
+
+ /* Return the range data */
+ *pullStart = pRange->ullStart;
+ *pullEnd = pRange->ullEnd;
+ *preElement = (RANGE_ELEMENT)pRange;
+
+done:
+ /* Unlock the range list */
+ ReleaseMutex(pRangeList->hMutex);
+
+ return ret;
}