From 24420c2ba13147e65c0758d1da5f7a6baa4cdc88 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 11 Oct 2015 21:49:16 +0000 Subject: [PATCH] [NTDLL_APITESTS] Extend the RtlAllocateHeap() test svn path=/trunk/; revision=69506 --- rostests/apitests/ntdll/RtlAllocateHeap.c | 30 ++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/rostests/apitests/ntdll/RtlAllocateHeap.c b/rostests/apitests/ntdll/RtlAllocateHeap.c index 5fb18858e92..7202a7c3517 100644 --- a/rostests/apitests/ntdll/RtlAllocateHeap.c +++ b/rostests/apitests/ntdll/RtlAllocateHeap.c @@ -15,11 +15,12 @@ PVOID Buffers[0x100]; START_TEST(RtlAllocateHeap) { USHORT i; + HANDLE hHeap; BOOLEAN Aligned = TRUE; + RTL_HEAP_PARAMETERS Parameters = {0}; for (i = 0; i < 0x100; ++i) { - SetLastError(0xdeadbeef); Buffers[i] = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_CREATE_ALIGN_16, (i % 16 ) + 1); ASSERT(Buffers[i] != NULL); if (!((ULONG_PTR)Buffers[i] & 0x2)) @@ -34,4 +35,31 @@ START_TEST(RtlAllocateHeap) } ok(Aligned == FALSE, "No unaligned address returned\n"); + + Aligned = TRUE; + Parameters.Length = sizeof(Parameters); + hHeap = RtlCreateHeap(HEAP_CREATE_ALIGN_16, NULL, 0, 0, NULL, &Parameters); + if (hHeap == NULL) + { + return; + } + + for (i = 0; i < 0x100; ++i) + { + Buffers[i] = RtlAllocateHeap(RtlGetProcessHeap(), 0, (i % 16 ) + 1); + ASSERT(Buffers[i] != NULL); + if (!((ULONG_PTR)Buffers[i] & 0x2)) + { + Aligned = FALSE; + } + } + + for (i = 0; i < 0x100; ++i) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, Buffers[i]); + } + + RtlDestroyHeap(hHeap); + + ok(Aligned == FALSE, "No unaligned address returned\n"); } -- 2.17.1