ReactOS  0.4.15-dev-3173-g40ee59d
RtlGetUnloadEventTrace.c File Reference
#include "precomp.h"
Include dependency graph for RtlGetUnloadEventTrace.c:

Go to the source code of this file.

Macros

#define TESTDLL   "GetUName.dLl"
 

Functions

PRTL_UNLOAD_EVENT_TRACE NTAPI RtlGetUnloadEventTrace (VOID)
 
 C_ASSERT (sizeof(RTL_UNLOAD_EVENT_TRACE)==84)
 
 C_ASSERT (sizeof(RTL_UNLOAD_EVENT_TRACE) *RTL_UNLOAD_EVENT_TRACE_NUMBER==0x540)
 
static void Test_Dump ()
 
static void Test_LoadUnload ()
 
 START_TEST (RtlGetUnloadEventTrace)
 

Macro Definition Documentation

◆ TESTDLL

#define TESTDLL   "GetUName.dLl"

Definition at line 41 of file RtlGetUnloadEventTrace.c.

Function Documentation

◆ C_ASSERT() [1/2]

C_ASSERT ( sizeof(RTL_UNLOAD_EVENT_TRACE = =84)

◆ C_ASSERT() [2/2]

C_ASSERT ( sizeof(RTL_UNLOAD_EVENT_TRACE) *  RTL_UNLOAD_EVENT_TRACE_NUMBER = =0x540)

◆ RtlGetUnloadEventTrace()

PRTL_UNLOAD_EVENT_TRACE NTAPI RtlGetUnloadEventTrace ( VOID  )

Definition at line 20 of file trace.c.

21 {
22  /* Just return a pointer to an array, according to MSDN */
23  return RtlpUnloadEventTrace;
24 }
static RTL_UNLOAD_EVENT_TRACE RtlpUnloadEventTrace[RTL_UNLOAD_EVENT_TRACE_NUMBER]
Definition: trace.c:13

Referenced by Test_Dump().

◆ START_TEST()

START_TEST ( RtlGetUnloadEventTrace  )

Definition at line 68 of file RtlGetUnloadEventTrace.c.

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 }
#define LoadLibrary
Definition: winbase.h:3718
GLdouble n
Definition: glext.h:7729
static void Test_Dump()
static void Test_LoadUnload()
#define FreeLibrary(x)
Definition: compat.h:607
#define trace
Definition: atltest.h:70
#define RTL_UNLOAD_EVENT_TRACE_NUMBER
Definition: rtltypes.h:1229

◆ Test_Dump()

static void Test_Dump ( )
static

Definition at line 19 of file RtlGetUnloadEventTrace.c.

20 {
21  PRTL_UNLOAD_EVENT_TRACE TraceHead, Trace;
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 }
GLdouble n
Definition: glext.h:7729
PRTL_UNLOAD_EVENT_TRACE NTAPI RtlGetUnloadEventTrace(VOID)
Definition: trace.c:20
static const WCHAR L[]
Definition: oid.c:1250
#define Trace(x)
Definition: inflate.c:42
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define RTL_UNLOAD_EVENT_TRACE_NUMBER
Definition: rtltypes.h:1229
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1

Referenced by START_TEST().

◆ Test_LoadUnload()

static void Test_LoadUnload ( )
static

Definition at line 42 of file RtlGetUnloadEventTrace.c.

43 {
44  HMODULE mod;
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 }
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
Definition: bufpool.h:45
#define FreeLibrary(x)
Definition: compat.h:607
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
#define TESTDLL
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
static int mod
Definition: i386-dis.c:1281

Referenced by START_TEST().