https://git.reactos.org/?p=reactos.git;a=commitdiff;h=808aea9b72ea722509426…
commit 808aea9b72ea72250942617aca55ebb0a2c5a11c
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Thu Apr 16 19:58:07 2020 +0200
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Apr 26 13:44:01 2020 +0200
[NTDLL_APITEST] Add minimal test for RTL_DEBUG_INFORMATION allocation
---
modules/rostests/apitests/ntdll/CMakeLists.txt | 1 +
.../rostests/apitests/ntdll/RtlDebugInformation.c | 88 ++++++++++++++++++++++
modules/rostests/apitests/ntdll/testlist.c | 2 +
3 files changed, 91 insertions(+)
diff --git a/modules/rostests/apitests/ntdll/CMakeLists.txt
b/modules/rostests/apitests/ntdll/CMakeLists.txt
index ac1804728fc..63ea01f677d 100644
--- a/modules/rostests/apitests/ntdll/CMakeLists.txt
+++ b/modules/rostests/apitests/ntdll/CMakeLists.txt
@@ -42,6 +42,7 @@ list(APPEND SOURCE
RtlBitmap.c
RtlComputePrivatizedDllName_U.c
RtlCopyMappedMemory.c
+ RtlDebugInformation.c
RtlDeleteAce.c
RtlDetermineDosPathNameType.c
RtlDoesFileExists.c
diff --git a/modules/rostests/apitests/ntdll/RtlDebugInformation.c
b/modules/rostests/apitests/ntdll/RtlDebugInformation.c
new file mode 100644
index 00000000000..19d73211e54
--- /dev/null
+++ b/modules/rostests/apitests/ntdll/RtlDebugInformation.c
@@ -0,0 +1,88 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: Test for RTL_DEBUG_INFORMATION
+ * COPYRIGHT: Copyright 2020 Mark Jansen (mark.jansen(a)reactos.org)
+ */
+
+#include "precomp.h"
+
+#ifndef _WIN64
+C_ASSERT(sizeof(RTL_DEBUG_INFORMATION) == 0x68);
+#endif
+
+static void Test_Buffersizes()
+{
+ PRTL_DEBUG_INFORMATION Buffer;
+ NTSTATUS Status;
+
+ Buffer = RtlCreateQueryDebugBuffer(0, FALSE);
+ ok(Buffer != NULL, "Unable to create default buffer\n");
+ if (!Buffer)
+ return;
+
+ ok_ptr(Buffer->ViewBaseClient, Buffer);
+ ok_hex(Buffer->Flags, 0);
+ ok(Buffer->OffsetFree == sizeof(*Buffer) || Buffer->OffsetFree == 0x60,
"Expected %u or %u, got %lu\n", sizeof(*Buffer), 0x60, Buffer->OffsetFree);
+ ok_hex(Buffer->CommitSize, 0x1000);
+ ok_hex(Buffer->ViewSize, 0x400000);
+
+ Status = RtlDestroyQueryDebugBuffer(Buffer);
+ ok_hex(Status, STATUS_SUCCESS);
+
+ Buffer = RtlCreateQueryDebugBuffer(1, FALSE);
+ ok(Buffer != NULL, "Unable to create default buffer\n");
+ if (!Buffer)
+ return;
+
+ ok_ptr(Buffer->ViewBaseClient, Buffer);
+ ok_hex(Buffer->Flags, 0);
+ ok(Buffer->OffsetFree == sizeof(*Buffer) || Buffer->OffsetFree == 0x60,
"Expected %u or %u, got %lu\n", sizeof(*Buffer), 0x60, Buffer->OffsetFree);
+ ok_hex(Buffer->CommitSize, 0x1000);
+ ok_hex(Buffer->ViewSize, 0x1000);
+
+ Status = RtlDestroyQueryDebugBuffer(Buffer);
+ ok_hex(Status, STATUS_SUCCESS);
+
+ Buffer = RtlCreateQueryDebugBuffer(0x1000, FALSE);
+ ok(Buffer != NULL, "Unable to create default buffer\n");
+ if (!Buffer)
+ return;
+
+ ok_ptr(Buffer->ViewBaseClient, Buffer);
+ ok_hex(Buffer->Flags, 0);
+ ok(Buffer->OffsetFree == sizeof(*Buffer) || Buffer->OffsetFree == 0x60,
"Expected %u or %u, got %lu\n", sizeof(*Buffer), 0x60, Buffer->OffsetFree);
+ ok_hex(Buffer->CommitSize, 0x1000);
+ ok_hex(Buffer->ViewSize, 0x1000);
+
+ Status = RtlDestroyQueryDebugBuffer(Buffer);
+ ok_hex(Status, STATUS_SUCCESS);
+
+ Buffer = RtlCreateQueryDebugBuffer(0x1001, FALSE);
+ ok(Buffer != NULL, "Unable to create default buffer\n");
+ if (!Buffer)
+ return;
+
+ ok_ptr(Buffer->ViewBaseClient, Buffer);
+ ok_hex(Buffer->Flags, 0);
+ ok(Buffer->OffsetFree == sizeof(*Buffer) || Buffer->OffsetFree == 0x60,
"Expected %u or %u, got %lu\n", sizeof(*Buffer), 0x60, Buffer->OffsetFree);
+ ok_hex(Buffer->CommitSize, 0x1000);
+ ok_hex(Buffer->ViewSize, 0x2000);
+
+ Status = RtlDestroyQueryDebugBuffer(Buffer);
+ ok_hex(Status, STATUS_SUCCESS);
+
+ Buffer = RtlCreateQueryDebugBuffer(0x7fffffff, FALSE);
+ ok(Buffer == NULL, "Got a valid thing?\n");
+ if (Buffer)
+ {
+ Status = RtlDestroyQueryDebugBuffer(Buffer);
+ ok_hex(Status, STATUS_SUCCESS);
+ }
+}
+
+START_TEST(RtlDebugInformation)
+{
+ Test_Buffersizes();
+ skip("No test for remote debug information yet!\n");
+}
diff --git a/modules/rostests/apitests/ntdll/testlist.c
b/modules/rostests/apitests/ntdll/testlist.c
index 95efbb0f6d8..ac2d0cd529d 100644
--- a/modules/rostests/apitests/ntdll/testlist.c
+++ b/modules/rostests/apitests/ntdll/testlist.c
@@ -41,6 +41,7 @@ extern void func_RtlAllocateHeap(void);
extern void func_RtlBitmap(void);
extern void func_RtlComputePrivatizedDllName_U(void);
extern void func_RtlCopyMappedMemory(void);
+extern void func_RtlDebugInformation(void);
extern void func_RtlDeleteAce(void);
extern void func_RtlDetermineDosPathNameType(void);
extern void func_RtlDosApplyFileIsolationRedirection_Ustr(void);
@@ -111,6 +112,7 @@ const struct test winetest_testlist[] =
{ "RtlBitmapApi", func_RtlBitmap },
{ "RtlComputePrivatizedDllName_U", func_RtlComputePrivatizedDllName_U },
{ "RtlCopyMappedMemory", func_RtlCopyMappedMemory },
+ { "RtlDebugInformation", func_RtlDebugInformation },
{ "RtlDeleteAce", func_RtlDeleteAce },
{ "RtlDetermineDosPathNameType", func_RtlDetermineDosPathNameType },
{ "RtlDosApplyFileIsolationRedirection_Ustr",
func_RtlDosApplyFileIsolationRedirection_Ustr },