ReactOS  0.4.15-dev-489-g75a0787
RtlDebugInformation.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS api tests
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: Test for RTL_DEBUG_INFORMATION
5  * COPYRIGHT: Copyright 2020 Mark Jansen (mark.jansen@reactos.org)
6  */
7 
8 #include "precomp.h"
9 
10 #ifndef _WIN64
11 C_ASSERT(sizeof(RTL_DEBUG_INFORMATION) == 0x68);
12 #endif
13 
14 static void Test_Buffersizes()
15 {
18 
20  ok(Buffer != NULL, "Unable to create default buffer\n");
21  if (!Buffer)
22  return;
23 
24  ok_ptr(Buffer->ViewBaseClient, Buffer);
25  ok_hex(Buffer->Flags, 0);
26  ok(Buffer->OffsetFree == sizeof(*Buffer) || Buffer->OffsetFree == 0x60, "Expected %u or %u, got %lu\n", sizeof(*Buffer), 0x60, Buffer->OffsetFree);
27  ok_hex(Buffer->CommitSize, 0x1000);
28  ok_hex(Buffer->ViewSize, 0x400000);
29 
32 
34  ok(Buffer != NULL, "Unable to create default buffer\n");
35  if (!Buffer)
36  return;
37 
38  ok_ptr(Buffer->ViewBaseClient, Buffer);
39  ok_hex(Buffer->Flags, 0);
40  ok(Buffer->OffsetFree == sizeof(*Buffer) || Buffer->OffsetFree == 0x60, "Expected %u or %u, got %lu\n", sizeof(*Buffer), 0x60, Buffer->OffsetFree);
41  ok_hex(Buffer->CommitSize, 0x1000);
42  ok_hex(Buffer->ViewSize, 0x1000);
43 
46 
48  ok(Buffer != NULL, "Unable to create default buffer\n");
49  if (!Buffer)
50  return;
51 
52  ok_ptr(Buffer->ViewBaseClient, Buffer);
53  ok_hex(Buffer->Flags, 0);
54  ok(Buffer->OffsetFree == sizeof(*Buffer) || Buffer->OffsetFree == 0x60, "Expected %u or %u, got %lu\n", sizeof(*Buffer), 0x60, Buffer->OffsetFree);
55  ok_hex(Buffer->CommitSize, 0x1000);
56  ok_hex(Buffer->ViewSize, 0x1000);
57 
60 
62  ok(Buffer != NULL, "Unable to create default buffer\n");
63  if (!Buffer)
64  return;
65 
66  ok_ptr(Buffer->ViewBaseClient, Buffer);
67  ok_hex(Buffer->Flags, 0);
68  ok(Buffer->OffsetFree == sizeof(*Buffer) || Buffer->OffsetFree == 0x60, "Expected %u or %u, got %lu\n", sizeof(*Buffer), 0x60, Buffer->OffsetFree);
69  ok_hex(Buffer->CommitSize, 0x1000);
70  ok_hex(Buffer->ViewSize, 0x2000);
71 
74 
75  Buffer = RtlCreateQueryDebugBuffer(0x7fffffff, FALSE);
76  ok(Buffer == NULL, "Got a valid thing?\n");
77  if (Buffer)
78  {
81  }
82 }
83 
84 
85 static void Test_ProcessModules(void)
86 {
89  ULONG RequiredSize = 0;
90  PRTL_PROCESS_MODULES ExpectedModules;
91 
93  ok(Buffer != NULL, "Unable to create default buffer\n");
94  if (!Buffer)
95  return;
96 
99 
100  RequiredSize;
101  ExpectedModules = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, RequiredSize);
102 
105  if (NT_SUCCESS(Status))
106  {
107 
110  if (SUCCEEDED(Status))
111  {
112  ok(!memcmp(ExpectedModules, Buffer->Modules, RequiredSize), "Unexpected difference!\n");
113  }
114  }
115  if (ExpectedModules)
116  HeapFree(GetProcessHeap(), 0, ExpectedModules);
117 
120 }
121 
122 
123 START_TEST(RtlDebugInformation)
124 {
127 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
C_ASSERT(sizeof(RTL_DEBUG_INFORMATION)==0x68)
LONG NTSTATUS
Definition: precomp.h:26
#define ok_ptr(expression, result)
Definition: atltest.h:108
static void Test_Buffersizes()
NTSYSAPI PRTL_DEBUG_INFORMATION NTAPI RtlCreateQueryDebugBuffer(_In_ ULONG Size, _In_ BOOLEAN EventPair)
Definition: dbgbuffer.c:66
#define ok_hex(expression, result)
Definition: atltest.h:94
smooth NULL
Definition: ftsmooth.c:416
static void Test_ProcessModules(void)
Definition: bufpool.h:45
#define RTL_DEBUG_QUERY_MODULES
Definition: rtltypes.h:364
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
#define GetProcessHeap()
Definition: compat.h:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI LdrQueryProcessModuleInformation(IN PRTL_PROCESS_MODULES ModuleInformation, IN ULONG Size, OUT PULONG ReturnedSize OPTIONAL)
Definition: ldrapi.c:1107
NTSYSAPI NTSTATUS NTAPI RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_INFORMATION DebugBuffer)
Status
Definition: gdiplustypes.h:24
NTSYSAPI NTSTATUS NTAPI RtlQueryProcessDebugInformation(_In_ ULONG ProcessId, _In_ ULONG DebugInfoClassMask, _Inout_ PRTL_DEBUG_INFORMATION DebugBuffer)
#define ok(value,...)
Definition: atltest.h:57
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
unsigned int ULONG
Definition: retypes.h:1
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define HeapFree(x, y, z)
Definition: compat.h:403
START_TEST(RtlDebugInformation)
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158
#define SUCCEEDED(hr)
Definition: intsafe.h:57