[NTDLL_APITESTS]
authorPierre Schweitzer <pierre@reactos.org>
Sun, 11 Oct 2015 21:10:03 +0000 (21:10 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 11 Oct 2015 21:10:03 +0000 (21:10 +0000)
Add a test that shows that RtlAllocateHeap() totally ignores HEAP_CREATE_ALIGN_16

svn path=/trunk/; revision=69504

rostests/apitests/ntdll/CMakeLists.txt
rostests/apitests/ntdll/RtlAllocateHeap.c [new file with mode: 0644]
rostests/apitests/ntdll/testlist.c

index e146819..7345855 100644 (file)
@@ -17,6 +17,7 @@ list(APPEND SOURCE
     NtQuerySystemEnvironmentValue.c
     NtQueryVolumeInformationFile.c
     NtSaveKey.c
+    RtlAllocateHeap.c
     RtlBitmap.c
     RtlCopyMappedMemory.c
     RtlDetermineDosPathNameType.c
diff --git a/rostests/apitests/ntdll/RtlAllocateHeap.c b/rostests/apitests/ntdll/RtlAllocateHeap.c
new file mode 100644 (file)
index 0000000..5fb1885
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         GPLv2+ - See COPYING in the top level directory
+ * PURPOSE:         Test for RtlAllocateHeap
+ * PROGRAMMER:      Pierre Schweitzer <pierre@reactos.org>
+ */
+
+#include <apitest.h>
+
+#define WIN32_NO_STATUS
+#include <ndk/rtlfuncs.h>
+
+PVOID Buffers[0x100];
+
+START_TEST(RtlAllocateHeap)
+{
+    USHORT i;
+    BOOLEAN Aligned = TRUE;
+
+    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))
+        {
+            Aligned = FALSE;
+        }
+    }
+
+    for (i = 0; i < 0x100; ++i)
+    {
+        RtlFreeHeap(RtlGetProcessHeap(), 0, Buffers[i]);
+    }
+
+    ok(Aligned  == FALSE, "No unaligned address returned\n");
+}
index d5bcfbf..2f94af4 100644 (file)
@@ -21,6 +21,7 @@ extern void func_NtQuerySystemEnvironmentValue(void);
 extern void func_NtQueryVolumeInformationFile(void);
 extern void func_NtSaveKey(void);
 extern void func_NtSystemInformation(void);
+extern void func_RtlAllocateHeap(void);
 extern void func_RtlBitmap(void);
 extern void func_RtlCopyMappedMemory(void);
 extern void func_RtlDetermineDosPathNameType(void);
@@ -60,6 +61,7 @@ const struct test winetest_testlist[] =
     { "NtQueryVolumeInformationFile",   func_NtQueryVolumeInformationFile },
     { "NtSaveKey",                      func_NtSaveKey},
     { "NtSystemInformation",            func_NtSystemInformation },
+    { "RtlAllocateHeap",                func_RtlAllocateHeap },
     { "RtlBitmapApi",                   func_RtlBitmap },
     { "RtlCopyMappedMemory",            func_RtlCopyMappedMemory },
     { "RtlDetermineDosPathNameType",    func_RtlDetermineDosPathNameType },