ReactOS  0.4.15-dev-2528-g5506091
trace.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Run-Time Library
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * PURPOSE: Rtl Trace Routines
5  */
6 
7 /* INCLUDES *******************************************************************/
8 
9 #include <rtl.h>
10 #define NDEBUG
11 #include <debug.h>
12 
15 
16 /* FUNCTIONS ******************************************************************/
17 
19 NTAPI
21 {
22  /* Just return a pointer to an array, according to MSDN */
23  return RtlpUnloadEventTrace;
24 }
25 
26 VOID
27 NTAPI
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 }
60 
61 BOOLEAN
62 NTAPI
64  IN ULONG Count,
65  IN PVOID *Trace,
66  OUT OPTIONAL PRTL_TRACE_BLOCK *TraceBlock)
67 {
69  return FALSE;
70 }
71 
73 NTAPI
76  IN ULONG Flags,
77  IN ULONG Tag,
78  IN OPTIONAL RTL_TRACE_HASH_FUNCTION HashFunction)
79 {
81  return NULL;
82 }
83 
84 BOOLEAN
85 NTAPI
87 {
89  return FALSE;
90 }
91 
92 BOOLEAN
93 NTAPI
95  IN PRTL_TRACE_ENUMERATE TraceEnumerate,
96  IN OUT PRTL_TRACE_BLOCK *TraceBlock)
97 {
99  return FALSE;
100 }
101 
102 
103 BOOLEAN
104 NTAPI
106  IN ULONG Count,
107  IN PVOID *Trace,
108  OUT OPTIONAL PRTL_TRACE_BLOCK *TraceBlock)
109 {
111  return FALSE;
112 }
113 
114 BOOLEAN
115 NTAPI
117 {
119  return FALSE;
120 }
121 
122 BOOLEAN
123 NTAPI
125 {
127  return FALSE;
128 }
129 
130 BOOLEAN
131 NTAPI
133 {
135  return FALSE;
136 }
PRTL_UNLOAD_EVENT_TRACE NTAPI RtlGetUnloadEventTrace(VOID)
Definition: trace.c:20
#define IN
Definition: typedefs.h:39
BOOLEAN NTAPI RtlTraceDatabaseFind(IN PRTL_TRACE_DATABASE Database, IN ULONG Count, IN PVOID *Trace, OUT OPTIONAL PRTL_TRACE_BLOCK *TraceBlock)
Definition: trace.c:105
VOID NTAPI LdrpRecordUnloadEvent(_In_ PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: trace.c:28
BOOLEAN NTAPI RtlTraceDatabaseUnlock(IN PRTL_TRACE_DATABASE Database)
Definition: trace.c:124
ULONG(NTAPI * RTL_TRACE_HASH_FUNCTION)(ULONG Count, PVOID *Trace)
Definition: rtltypes.h:1808
uint32_t ULONG_PTR
Definition: typedefs.h:65
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
BOOLEAN NTAPI RtlTraceDatabaseLock(IN PRTL_TRACE_DATABASE Database)
Definition: trace.c:116
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183
BOOLEAN NTAPI RtlTraceDatabaseEnumerate(IN PRTL_TRACE_DATABASE Database, IN PRTL_TRACE_ENUMERATE TraceEnumerate, IN OUT PRTL_TRACE_BLOCK *TraceBlock)
Definition: trace.c:94
int Count
Definition: noreturn.cpp:7
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ WDFCOLLECTION _In_ ULONG Index
static const char * ImageName
Definition: image.c:34
BOOLEAN NTAPI RtlTraceDatabaseDestroy(IN PRTL_TRACE_DATABASE Database)
Definition: trace.c:86
Definition: btrfs_drv.h:1922
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
#define _In_
Definition: no_sal2.h:158
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: trace.c:74
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#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 NULL
Definition: types.h:112
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_opt_ PLARGE_INTEGER MaximumSize
Definition: mmfuncs.h:360
#define RtlImageNtHeader
Definition: compat.h:665
BOOLEAN NTAPI RtlTraceDatabaseValidate(IN PRTL_TRACE_DATABASE Database)
Definition: trace.c:132
#define OUT
Definition: typedefs.h:40
static RTL_UNLOAD_EVENT_TRACE RtlpUnloadEventTrace[RTL_UNLOAD_EVENT_TRACE_NUMBER]
Definition: trace.c:13
unsigned int ULONG
Definition: retypes.h:1
#define UNIMPLEMENTED
Definition: debug.h:115
void Trace(const int level, const char *const fmt,...)
Definition: trace.c:30
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define DPRINT
Definition: sndvol32.h:71
BOOLEAN NTAPI RtlTraceDatabaseAdd(IN PRTL_TRACE_DATABASE Database, IN ULONG Count, IN PVOID *Trace, OUT OPTIONAL PRTL_TRACE_BLOCK *TraceBlock)
Definition: trace.c:63
static UINT RtlpUnloadEventTraceIndex
Definition: trace.c:14
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68