mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[NTDLL_APITEST] Add test for RtlGetProcessHeaps
This commit is contained in:
parent
b8cdd1a879
commit
e8f9564c20
3 changed files with 51 additions and 0 deletions
|
@ -79,6 +79,7 @@ list(APPEND SOURCE
|
|||
RtlGetLengthWithoutTrailingPathSeperators.c
|
||||
RtlGetLongestNtPathLength.c
|
||||
RtlGetNtProductType.c
|
||||
RtlGetProcessHeaps.c
|
||||
RtlGetUnloadEventTrace.c
|
||||
RtlHandle.c
|
||||
RtlImageDirectoryEntryToData.c
|
||||
|
|
48
modules/rostests/apitests/ntdll/RtlGetProcessHeaps.c
Normal file
48
modules/rostests/apitests/ntdll/RtlGetProcessHeaps.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
|
||||
* PURPOSE: Test for RtlGetProcessHeaps
|
||||
* COPYRIGHT: Copyright 2023 Mark Jansen <mark.jansen@reactos.org>
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
START_TEST(RtlGetProcessHeaps)
|
||||
{
|
||||
HANDLE HeapArray[40] = {0};
|
||||
ULONG MaxHeapArraySize = _countof(HeapArray);
|
||||
|
||||
// Can call it with NULL
|
||||
ULONG InitialNumHeaps = RtlGetProcessHeaps(0, NULL);
|
||||
ok(InitialNumHeaps > 0, "Expected at least one heap\n");
|
||||
ok(InitialNumHeaps < MaxHeapArraySize, "Expected less heaps, got %lu\n", InitialNumHeaps);
|
||||
|
||||
// Grab all heaps
|
||||
ULONG NumHeaps = RtlGetProcessHeaps(MaxHeapArraySize, HeapArray);
|
||||
ok_eq_ulong(NumHeaps, InitialNumHeaps);
|
||||
for (ULONG n = 0; n < min(NumHeaps, MaxHeapArraySize); ++n)
|
||||
{
|
||||
ok(HeapArray[n] != NULL, "Heap[%lu] == NULL\n", n);
|
||||
}
|
||||
|
||||
PVOID HeapPtr = RtlCreateHeap(HEAP_GROWABLE, NULL, 0, 0x10000, NULL, NULL);
|
||||
|
||||
memset(HeapArray, 0, sizeof(HeapArray));
|
||||
NumHeaps = RtlGetProcessHeaps(MaxHeapArraySize, HeapArray);
|
||||
ok_eq_ulong(InitialNumHeaps + 1, NumHeaps);
|
||||
if (NumHeaps > 0 && NumHeaps <= MaxHeapArraySize)
|
||||
{
|
||||
// A new heap is added at the end
|
||||
ok_ptr(HeapArray[NumHeaps - 1], HeapPtr);
|
||||
}
|
||||
|
||||
RtlDestroyHeap(HeapPtr);
|
||||
|
||||
// Just ask for one heap, the number of heaps available is returned, but only one heap ptr filled!
|
||||
memset(HeapArray, 0xff, sizeof(HeapArray));
|
||||
NumHeaps = RtlGetProcessHeaps(1, HeapArray);
|
||||
ok_eq_ulong(NumHeaps, InitialNumHeaps);
|
||||
|
||||
ok_ptr(HeapArray[0], RtlGetProcessHeap()); // First item is the process heap
|
||||
ok_ptr(HeapArray[1], INVALID_HANDLE_VALUE); // Next item is not touched!
|
||||
}
|
|
@ -76,6 +76,7 @@ extern void func_RtlGetLengthWithoutLastFullDosOrNtPathElement(void);
|
|||
extern void func_RtlGetLengthWithoutTrailingPathSeperators(void);
|
||||
extern void func_RtlGetLongestNtPathLength(void);
|
||||
extern void func_RtlGetNtProductType(void);
|
||||
extern void func_RtlGetProcessHeaps(void);
|
||||
extern void func_RtlGetUnloadEventTrace(void);
|
||||
extern void func_RtlHandle(void);
|
||||
extern void func_RtlImageDirectoryEntryToData(void);
|
||||
|
@ -175,6 +176,7 @@ const struct test winetest_testlist[] =
|
|||
{ "RtlGetLengthWithoutTrailingPathSeperators", func_RtlGetLengthWithoutTrailingPathSeperators },
|
||||
{ "RtlGetLongestNtPathLength", func_RtlGetLongestNtPathLength },
|
||||
{ "RtlGetNtProductType", func_RtlGetNtProductType },
|
||||
{ "RtlGetProcessHeaps", func_RtlGetProcessHeaps },
|
||||
{ "RtlGetUnloadEventTrace", func_RtlGetUnloadEventTrace },
|
||||
{ "RtlHandle", func_RtlHandle },
|
||||
{ "RtlImageDirectoryEntryToData", func_RtlImageDirectoryEntryToData },
|
||||
|
|
Loading…
Reference in a new issue