mirror of
https://github.com/reactos/reactos.git
synced 2025-07-26 23:14:17 +00:00
[RTL] Implement LdrpRecordUnloadEvent
This commit is contained in:
parent
7cce7b9c08
commit
d5f0b2b160
3 changed files with 48 additions and 10 deletions
|
@ -158,6 +158,9 @@ LdrpFetchAddressOfEntryPoint(PVOID ImageBase);
|
||||||
VOID NTAPI
|
VOID NTAPI
|
||||||
LdrpFreeUnicodeString(PUNICODE_STRING String);
|
LdrpFreeUnicodeString(PUNICODE_STRING String);
|
||||||
|
|
||||||
|
VOID NTAPI
|
||||||
|
LdrpRecordUnloadEvent(_In_ PLDR_DATA_TABLE_ENTRY LdrEntry);
|
||||||
|
|
||||||
VOID NTAPI
|
VOID NTAPI
|
||||||
LdrpGetShimEngineInterface(VOID);
|
LdrpGetShimEngineInterface(VOID);
|
||||||
|
|
||||||
|
|
|
@ -1449,8 +1449,7 @@ LdrUnloadDll(IN PVOID BaseAddress)
|
||||||
/* Get the current entry */
|
/* Get the current entry */
|
||||||
LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, HashLinks);
|
LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, HashLinks);
|
||||||
|
|
||||||
/* FIXME: Log the Unload Event */
|
LdrpRecordUnloadEvent(LdrEntry);
|
||||||
//LdrpRecordUnloadEvent(LdrEntry);
|
|
||||||
|
|
||||||
/* Set the entry and clear it from the list */
|
/* Set the entry and clear it from the list */
|
||||||
CurrentEntry = LdrEntry;
|
CurrentEntry = LdrEntry;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
static RTL_UNLOAD_EVENT_TRACE RtlpUnloadEventTrace[RTL_UNLOAD_EVENT_TRACE_NUMBER];
|
static RTL_UNLOAD_EVENT_TRACE RtlpUnloadEventTrace[RTL_UNLOAD_EVENT_TRACE_NUMBER];
|
||||||
|
static UINT RtlpUnloadEventTraceIndex = 0;
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
|
@ -22,6 +23,41 @@ RtlGetUnloadEventTrace(VOID)
|
||||||
return RtlpUnloadEventTrace;
|
return RtlpUnloadEventTrace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
LdrpRecordUnloadEvent(_In_ PLDR_DATA_TABLE_ENTRY LdrEntry)
|
||||||
|
{
|
||||||
|
PIMAGE_NT_HEADERS NtHeaders;
|
||||||
|
UINT Sequence = RtlpUnloadEventTraceIndex++;
|
||||||
|
UINT Index = Sequence % RTL_UNLOAD_EVENT_TRACE_NUMBER;
|
||||||
|
USHORT StringLen;
|
||||||
|
|
||||||
|
DPRINT("LdrpRecordUnloadEvent(%wZ, %p - %p)\n", &LdrEntry->BaseDllName, LdrEntry->DllBase,
|
||||||
|
(ULONG_PTR)LdrEntry->DllBase + LdrEntry->SizeOfImage);
|
||||||
|
|
||||||
|
RtlpUnloadEventTrace[Index].BaseAddress = LdrEntry->DllBase;
|
||||||
|
RtlpUnloadEventTrace[Index].SizeOfImage = LdrEntry->SizeOfImage;
|
||||||
|
RtlpUnloadEventTrace[Index].Sequence = Sequence;
|
||||||
|
|
||||||
|
NtHeaders = RtlImageNtHeader(LdrEntry->DllBase);
|
||||||
|
|
||||||
|
if (NtHeaders)
|
||||||
|
{
|
||||||
|
RtlpUnloadEventTrace[Index].TimeDateStamp = NtHeaders->FileHeader.TimeDateStamp;
|
||||||
|
RtlpUnloadEventTrace[Index].CheckSum = NtHeaders->OptionalHeader.CheckSum;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RtlpUnloadEventTrace[Index].TimeDateStamp = 0;
|
||||||
|
RtlpUnloadEventTrace[Index].CheckSum = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringLen = min(LdrEntry->BaseDllName.Length / sizeof(WCHAR), RTL_NUMBER_OF(RtlpUnloadEventTrace[Index].ImageName));
|
||||||
|
RtlCopyMemory(RtlpUnloadEventTrace[Index].ImageName, LdrEntry->BaseDllName.Buffer, StringLen * sizeof(WCHAR));
|
||||||
|
if (StringLen < RTL_NUMBER_OF(RtlpUnloadEventTrace[Index].ImageName))
|
||||||
|
RtlpUnloadEventTrace[Index].ImageName[StringLen] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlTraceDatabaseAdd(IN PRTL_TRACE_DATABASE Database,
|
RtlTraceDatabaseAdd(IN PRTL_TRACE_DATABASE Database,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue