On 4/19/22 19:33, Rémi Bernon wrote:
Signed-off-by: Rémi Bernon rbernon@codeweavers.com
dlls/kernel32/tests/heap.c | 126 +++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+)
diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c index 104eced3bf4..7195907ff03 100644 --- a/dlls/kernel32/tests/heap.c +++ b/dlls/kernel32/tests/heap.c @@ -37,6 +37,9 @@ #define HEAP_VALIDATE_ALL 0x20000000 #define HEAP_VALIDATE_PARAMS 0x40000000
+#define BLOCK_ALIGN (2 * sizeof(void *) - 1) +#define ALIGN_BLOCK_SIZE(x) (((x) + BLOCK_ALIGN) & ~BLOCK_ALIGN)
- /* use function pointers to avoid warnings for invalid parameter tests */ static LPVOID (WINAPI *pHeapAlloc)(HANDLE,DWORD,SIZE_T); static LPVOID (WINAPI *pHeapReAlloc)(HANDLE,DWORD,LPVOID,SIZE_T);
@@ -1729,6 +1732,128 @@ static void test_LocalAlloc(void) } }
+static void test_block_layout( HANDLE heap, DWORD global_flags, DWORD heap_flags ) +{
- DWORD padd_flags = HEAP_VALIDATE | HEAP_VALIDATE_ALL | HEAP_VALIDATE_PARAMS;
- SIZE_T expect_size, alloc_size, tail_size, extra_size;
- unsigned char *ptr0, *ptr1, *ptr2;
- char tail_buf[64], padd_buf[64];
- BOOL ret;
- if (global_flags & (FLG_HEAP_DISABLE_COALESCING|FLG_HEAP_PAGE_ALLOCS|FLG_POOL_ENABLE_TAGGING|
FLG_HEAP_ENABLE_TAGGING|FLG_HEAP_ENABLE_TAG_BY_DLL))
- {
skip( "skipping not yet implemented block layout tests\n" );
return;
- }
- if (!global_flags) extra_size = 8;
- else extra_size = 2 * sizeof(void *);
- if (heap_flags & HEAP_TAIL_CHECKING_ENABLED) extra_size += 2 * sizeof(void *);
- if (heap_flags & padd_flags) extra_size += 2 * sizeof(void *);
- if (!(heap_flags & HEAP_TAIL_CHECKING_ENABLED)) tail_size = 0;
- else tail_size = 2 * sizeof(void *);
- memset(padd_buf, 0, sizeof(padd_buf));
- memset(tail_buf, 0xab, sizeof(tail_buf));
Hmm, padd_buf is only really used in PATCH 7. Doesn't seem to cause any warning but I can re-split and resend 5-7 later if it's better.