https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b8cdd1a8799acc381eba6…
commit b8cdd1a8799acc381eba6db6889e94a141185e89
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Thu Dec 7 20:20:03 2023 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Dec 17 22:28:24 2023 +0100
[RTL] Implement RtlGetProcessHeaps
---
sdk/lib/rtl/heap.c | 17 ++---------------
sdk/lib/rtl/heap.h | 1 +
sdk/lib/rtl/heapuser.c | 29 +++++++++++++++++++++++++++++
3 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/sdk/lib/rtl/heap.c b/sdk/lib/rtl/heap.c
index 847051df44c..781c2276c49 100644
--- a/sdk/lib/rtl/heap.c
+++ b/sdk/lib/rtl/heap.c
@@ -3756,7 +3756,7 @@ BOOLEAN NTAPI RtlValidateHeap(
}
/*
- * @implemented
+ * @unimplemented
*/
NTSTATUS NTAPI
RtlEnumProcessHeaps(PHEAP_ENUMERATION_ROUTINE HeapEnumerationRoutine,
@@ -3766,21 +3766,8 @@ RtlEnumProcessHeaps(PHEAP_ENUMERATION_ROUTINE
HeapEnumerationRoutine,
return STATUS_NOT_IMPLEMENTED;
}
-
/*
- * @implemented
- */
-ULONG NTAPI
-RtlGetProcessHeaps(ULONG count,
- HANDLE *heaps)
-{
- UNIMPLEMENTED;
- return 0;
-}
-
-
-/*
- * @implemented
+ * @unimplemented
*/
BOOLEAN NTAPI
RtlValidateProcessHeaps(VOID)
diff --git a/sdk/lib/rtl/heap.h b/sdk/lib/rtl/heap.h
index 5eaefde8b2f..1f0b5436011 100644
--- a/sdk/lib/rtl/heap.h
+++ b/sdk/lib/rtl/heap.h
@@ -339,6 +339,7 @@ BOOLEAN NTAPI
RtlpValidateHeapHeaders(PHEAP Heap, BOOLEAN Recalculate);
/* heapdbg.c */
+NTSYSAPI
HANDLE NTAPI
RtlDebugCreateHeap(ULONG Flags,
PVOID Addr,
diff --git a/sdk/lib/rtl/heapuser.c b/sdk/lib/rtl/heapuser.c
index 0d8cdab5336..c3d3a61a06d 100644
--- a/sdk/lib/rtl/heapuser.c
+++ b/sdk/lib/rtl/heapuser.c
@@ -127,3 +127,32 @@ RtlInitializeHeapManager(VOID)
RtlInitializeCriticalSection(&RtlpProcessHeapsListLock);
}
+ULONG NTAPI
+RtlGetProcessHeaps(_In_ ULONG HeapCount, _Out_cap_(HeapCount) HANDLE *HeapArray)
+{
+ PPEB Peb = RtlGetCurrentPeb();
+
+ RtlEnterCriticalSection(&RtlpProcessHeapsListLock);
+ ULONG nHeaps = Peb->NumberOfHeaps;
+
+ _SEH2_TRY
+ {
+ if (HeapArray)
+ {
+ for (ULONG n = 0; n < min(nHeaps, HeapCount); ++n)
+ {
+ HeapArray[n] = Peb->ProcessHeaps[n];
+ }
+ }
+ }
+ _SEH2_FINALLY
+ {
+ RtlLeaveCriticalSection(&RtlpProcessHeapsListLock);
+ }
+ _SEH2_END;
+
+ /* TODO: Add RtlpDphPageHeapList here */
+
+ return nHeaps;
+}
+