ReactOS 0.4.15-dev-8131-g4988de4
RtlGetUnloadEventTrace.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 RtlGetUnloadEventTrace
5 * COPYRIGHT: Copyright 2020 Mark Jansen (mark.jansen@reactos.org)
6 */
7
8#include "precomp.h"
9
13
14#ifndef _WIN64
17#endif
18
19static void Test_Dump()
20{
22 UINT n;
23
24 TraceHead = RtlGetUnloadEventTrace();
25 for (n = 0; n < RTL_UNLOAD_EVENT_TRACE_NUMBER; ++n)
26 {
27 ULONG ExpectSequence = n ? n : RTL_UNLOAD_EVENT_TRACE_NUMBER;
28
29 Trace = TraceHead + n;
30
31 ok(Trace->BaseAddress != NULL, "Got no BaseAddress for %u\n", n);
32 ok(Trace->SizeOfImage != 0, "Got no SizeOfImage for %u\n", n);
33 ok(Trace->Sequence == ExpectSequence,
34 "Wrong Sequence: %lu instead of %lu for %u\n", Trace->Sequence, ExpectSequence, n);
35 ok(Trace->TimeDateStamp != 0, "Got no TimeDateStamp for %u\n", n);
36 ok(Trace->CheckSum != 0, "Got no CheckSum for %u\n", n);
37 ok(!wcscmp(Trace->ImageName, L"GetUName.dLl"), "Wrong ImageName for %u: %S\n", n, Trace->ImageName);
38 }
39}
40
41#define TESTDLL "GetUName.dLl"
42static void Test_LoadUnload()
43{
45 static char Buffer[MAX_PATH] = {0};
46
48 ok(mod == NULL, "ERROR, %s already loaded\n", TESTDLL);
49
51 ok(mod != NULL, "ERROR, %s not loaded\n", TESTDLL);
52
53 if (!Buffer[0])
54 {
56 }
57 else
58 {
59 Buffer[0] = '\0';
60 }
61
63
65 ok(mod == NULL, "ERROR, %s still loaded\n", TESTDLL);
66}
67
69{
70 int n;
71 HMODULE Ignore;
72
73 Ignore = LoadLibrary("user32.dll");
74
75 for (n = 0; n <= RTL_UNLOAD_EVENT_TRACE_NUMBER; ++n)
76 {
77 trace("Num: %u\n", n);
79 }
80 Test_Dump();
81
82 FreeLibrary(Ignore);
83}
static void Test_LoadUnload()
static void Test_Dump()
PRTL_UNLOAD_EVENT_TRACE NTAPI RtlGetUnloadEventTrace(VOID)
Definition: trace.c:20
#define TESTDLL
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
#define FreeLibrary(x)
Definition: compat.h:748
#define MAX_PATH
Definition: compat.h:34
#define Trace(x)
Definition: inflate.c:42
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
GLdouble n
Definition: glext.h:7729
static int mod
Definition: i386-dis.c:1288
#define C_ASSERT(e)
Definition: intsafe.h:73
unsigned int UINT
Definition: ndis.h:50
#define RTL_UNLOAD_EVENT_TRACE_NUMBER
Definition: rtltypes.h:1231
#define L(x)
Definition: ntvdm.h:50
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define _countof(array)
Definition: sndvol32.h:70
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG
Definition: typedefs.h:59
#define LoadLibrary
Definition: winbase.h:3862