ReactOS  0.4.15-dev-3294-ge98684e
trace.c File Reference
#include <rtl.h>
#include <debug.h>
Include dependency graph for trace.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

PRTL_UNLOAD_EVENT_TRACE NTAPI RtlGetUnloadEventTrace (VOID)
 
VOID NTAPI LdrpRecordUnloadEvent (_In_ PLDR_DATA_TABLE_ENTRY LdrEntry)
 
BOOLEAN NTAPI RtlTraceDatabaseAdd (IN PRTL_TRACE_DATABASE Database, IN ULONG Count, IN PVOID *Trace, OUT OPTIONAL PRTL_TRACE_BLOCK *TraceBlock)
 
PRTL_TRACE_DATABASE NTAPI RtlTraceDatabaseCreate (IN ULONG Buckets, IN OPTIONAL SIZE_T MaximumSize, IN ULONG Flags, IN ULONG Tag, IN OPTIONAL RTL_TRACE_HASH_FUNCTION HashFunction)
 
BOOLEAN NTAPI RtlTraceDatabaseDestroy (IN PRTL_TRACE_DATABASE Database)
 
BOOLEAN NTAPI RtlTraceDatabaseEnumerate (IN PRTL_TRACE_DATABASE Database, IN PRTL_TRACE_ENUMERATE TraceEnumerate, IN OUT PRTL_TRACE_BLOCK *TraceBlock)
 
BOOLEAN NTAPI RtlTraceDatabaseFind (IN PRTL_TRACE_DATABASE Database, IN ULONG Count, IN PVOID *Trace, OUT OPTIONAL PRTL_TRACE_BLOCK *TraceBlock)
 
BOOLEAN NTAPI RtlTraceDatabaseLock (IN PRTL_TRACE_DATABASE Database)
 
BOOLEAN NTAPI RtlTraceDatabaseUnlock (IN PRTL_TRACE_DATABASE Database)
 
BOOLEAN NTAPI RtlTraceDatabaseValidate (IN PRTL_TRACE_DATABASE Database)
 

Variables

static RTL_UNLOAD_EVENT_TRACE RtlpUnloadEventTrace [RTL_UNLOAD_EVENT_TRACE_NUMBER]
 
static UINT RtlpUnloadEventTraceIndex = 0
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file trace.c.

Function Documentation

◆ LdrpRecordUnloadEvent()

VOID NTAPI LdrpRecordUnloadEvent ( _In_ PLDR_DATA_TABLE_ENTRY  LdrEntry)

Definition at line 28 of file trace.c.

29 {
30  PIMAGE_NT_HEADERS NtHeaders;
31  UINT Sequence = RtlpUnloadEventTraceIndex++;
33  USHORT StringLen;
34 
35  DPRINT("LdrpRecordUnloadEvent(%wZ, %p - %p)\n", &LdrEntry->BaseDllName, LdrEntry->DllBase,
36  (ULONG_PTR)LdrEntry->DllBase + LdrEntry->SizeOfImage);
37 
38  RtlpUnloadEventTrace[Index].BaseAddress = LdrEntry->DllBase;
39  RtlpUnloadEventTrace[Index].SizeOfImage = LdrEntry->SizeOfImage;
41 
42  NtHeaders = RtlImageNtHeader(LdrEntry->DllBase);
43 
44  if (NtHeaders)
45  {
48  }
49  else
50  {
53  }
54 
55  StringLen = min(LdrEntry->BaseDllName.Length / sizeof(WCHAR), RTL_NUMBER_OF(RtlpUnloadEventTrace[Index].ImageName));
56  RtlCopyMemory(RtlpUnloadEventTrace[Index].ImageName, LdrEntry->BaseDllName.Buffer, StringLen * sizeof(WCHAR));
58  RtlpUnloadEventTrace[Index].ImageName[StringLen] = 0;
59 }
uint32_t ULONG_PTR
Definition: typedefs.h:65
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ WDFCOLLECTION _In_ ULONG Index
static const char * ImageName
Definition: image.c:34
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
#define RTL_UNLOAD_EVENT_TRACE_NUMBER
Definition: rtltypes.h:1229
unsigned short USHORT
Definition: pedump.c:61
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define RtlImageNtHeader
Definition: compat.h:665
static RTL_UNLOAD_EVENT_TRACE RtlpUnloadEventTrace[RTL_UNLOAD_EVENT_TRACE_NUMBER]
Definition: trace.c:13
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define DPRINT
Definition: sndvol32.h:71
static UINT RtlpUnloadEventTraceIndex
Definition: trace.c:14

Referenced by LdrUnloadDll().

◆ 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().

◆ RtlTraceDatabaseAdd()

BOOLEAN NTAPI RtlTraceDatabaseAdd ( IN PRTL_TRACE_DATABASE  Database,
IN ULONG  Count,
IN PVOID Trace,
OUT OPTIONAL PRTL_TRACE_BLOCK TraceBlock 
)

Definition at line 63 of file trace.c.

67 {
69  return FALSE;
70 }
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:115

◆ RtlTraceDatabaseCreate()

PRTL_TRACE_DATABASE NTAPI RtlTraceDatabaseCreate ( IN ULONG  Buckets,
IN OPTIONAL SIZE_T  MaximumSize,
IN ULONG  Flags,
IN ULONG  Tag,
IN OPTIONAL RTL_TRACE_HASH_FUNCTION  HashFunction 
)

Definition at line 74 of file trace.c.

79 {
81  return NULL;
82 }
#define NULL
Definition: types.h:112
#define UNIMPLEMENTED
Definition: debug.h:115

◆ RtlTraceDatabaseDestroy()

BOOLEAN NTAPI RtlTraceDatabaseDestroy ( IN PRTL_TRACE_DATABASE  Database)

Definition at line 86 of file trace.c.

87 {
89  return FALSE;
90 }
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:115

◆ RtlTraceDatabaseEnumerate()

BOOLEAN NTAPI RtlTraceDatabaseEnumerate ( IN PRTL_TRACE_DATABASE  Database,
IN PRTL_TRACE_ENUMERATE  TraceEnumerate,
IN OUT PRTL_TRACE_BLOCK TraceBlock 
)

Definition at line 94 of file trace.c.

97 {
99  return FALSE;
100 }
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:115

◆ RtlTraceDatabaseFind()

BOOLEAN NTAPI RtlTraceDatabaseFind ( IN PRTL_TRACE_DATABASE  Database,
IN ULONG  Count,
IN PVOID Trace,
OUT OPTIONAL PRTL_TRACE_BLOCK TraceBlock 
)

Definition at line 105 of file trace.c.

109 {
111  return FALSE;
112 }
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:115

◆ RtlTraceDatabaseLock()

BOOLEAN NTAPI RtlTraceDatabaseLock ( IN PRTL_TRACE_DATABASE  Database)

Definition at line 116 of file trace.c.

117 {
119  return FALSE;
120 }
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:115

◆ RtlTraceDatabaseUnlock()

BOOLEAN NTAPI RtlTraceDatabaseUnlock ( IN PRTL_TRACE_DATABASE  Database)

Definition at line 124 of file trace.c.

125 {
127  return FALSE;
128 }
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:115

◆ RtlTraceDatabaseValidate()

BOOLEAN NTAPI RtlTraceDatabaseValidate ( IN PRTL_TRACE_DATABASE  Database)

Definition at line 132 of file trace.c.

133 {
135  return FALSE;
136 }
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:115

Variable Documentation

◆ RtlpUnloadEventTrace

Definition at line 13 of file trace.c.

Referenced by LdrpRecordUnloadEvent(), and RtlGetUnloadEventTrace().

◆ RtlpUnloadEventTraceIndex

UINT RtlpUnloadEventTraceIndex = 0
static

Definition at line 14 of file trace.c.

Referenced by LdrpRecordUnloadEvent().