[RTL]
[reactos.git] / rostests / apitests / ntdll / RtlAllocateHeap.c
1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Test for RtlAllocateHeap
5 * PROGRAMMER: Pierre Schweitzer <pierre@reactos.org>
6 */
7
8 #include <apitest.h>
9
10 #define WIN32_NO_STATUS
11 #include <ndk/rtlfuncs.h>
12
13 PVOID Buffers[0x100];
14
15 START_TEST(RtlAllocateHeap)
16 {
17 USHORT i;
18 BOOLEAN Aligned = TRUE;
19
20 for (i = 0; i < 0x100; ++i)
21 {
22 SetLastError(0xdeadbeef);
23 Buffers[i] = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_CREATE_ALIGN_16, (i % 16 ) + 1);
24 ASSERT(Buffers[i] != NULL);
25 if (!((ULONG_PTR)Buffers[i] & 0x2))
26 {
27 Aligned = FALSE;
28 }
29 }
30
31 for (i = 0; i < 0x100; ++i)
32 {
33 RtlFreeHeap(RtlGetProcessHeap(), 0, Buffers[i]);
34 }
35
36 ok(Aligned == FALSE, "No unaligned address returned\n");
37 }