From 7feed70d0074ad35bb1cf791a6b14adf4ffa993d Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 11 Oct 2015 21:10:03 +0000 Subject: [PATCH] [NTDLL_APITESTS] Add a test that shows that RtlAllocateHeap() totally ignores HEAP_CREATE_ALIGN_16 svn path=/trunk/; revision=69504 --- rostests/apitests/ntdll/CMakeLists.txt | 1 + rostests/apitests/ntdll/RtlAllocateHeap.c | 37 +++++++++++++++++++++++ rostests/apitests/ntdll/testlist.c | 2 ++ 3 files changed, 40 insertions(+) create mode 100644 rostests/apitests/ntdll/RtlAllocateHeap.c diff --git a/rostests/apitests/ntdll/CMakeLists.txt b/rostests/apitests/ntdll/CMakeLists.txt index e1468192fc0..7345855e6b7 100644 --- a/rostests/apitests/ntdll/CMakeLists.txt +++ b/rostests/apitests/ntdll/CMakeLists.txt @@ -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 index 00000000000..5fb18858e92 --- /dev/null +++ b/rostests/apitests/ntdll/RtlAllocateHeap.c @@ -0,0 +1,37 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Test for RtlAllocateHeap + * PROGRAMMER: Pierre Schweitzer + */ + +#include + +#define WIN32_NO_STATUS +#include + +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"); +} diff --git a/rostests/apitests/ntdll/testlist.c b/rostests/apitests/ntdll/testlist.c index d5bcfbfd08b..2f94af4fbe3 100644 --- a/rostests/apitests/ntdll/testlist.c +++ b/rostests/apitests/ntdll/testlist.c @@ -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 },