[NTOS:MM] Save caller address when tracing PFNs

This commit is contained in:
Jérôme Gardou 2021-06-24 16:35:00 +02:00 committed by Jérôme Gardou
parent aae161d061
commit 146337cc50
2 changed files with 6 additions and 1 deletions

View file

@ -275,7 +275,7 @@ void
MI_SET_PROCESS_USTR(PUNICODE_STRING ustr)
{
PWSTR pos, strEnd;
int i;
ULONG i;
if (!ustr->Buffer || ustr->Length == 0)
{
@ -407,6 +407,7 @@ typedef struct _MMPFN
MI_PFN_USAGES PfnUsage;
CHAR ProcessName[16];
#define MI_SET_PFN_PROCESS_NAME(pfn, x) memcpy(pfn->ProcessName, x, min(sizeof(x), sizeof(pfn->ProcessName)))
PVOID CallSite;
#endif
// HACK until WS lists are supported

View file

@ -254,6 +254,7 @@ MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry)
ASSERT(MI_PFN_CURRENT_USAGE != MI_USAGE_NOT_SET);
Entry->PfnUsage = MI_PFN_CURRENT_USAGE;
memcpy(Entry->ProcessName, MI_PFN_CURRENT_PROCESS_NAME, 16);
Entry->CallSite = _ReturnAddress();
MI_PFN_CURRENT_USAGE = MI_USAGE_NOT_SET;
MI_SET_PROCESS2("Not Set");
#endif
@ -462,6 +463,7 @@ MiRemovePageByColor(IN PFN_NUMBER PageIndex,
ASSERT(MI_PFN_CURRENT_USAGE != MI_USAGE_NOT_SET);
Pfn1->PfnUsage = MI_PFN_CURRENT_USAGE;
memcpy(Pfn1->ProcessName, MI_PFN_CURRENT_PROCESS_NAME, 16);
Pfn1->CallSite = _ReturnAddress();
MI_PFN_CURRENT_USAGE = MI_USAGE_NOT_SET;
MI_SET_PROCESS2("Not Set");
#endif
@ -710,6 +712,7 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex)
#if MI_TRACE_PFNS
Pfn1->PfnUsage = MI_USAGE_FREE_PAGE;
RtlZeroMemory(Pfn1->ProcessName, 16);
Pfn1->CallSite = NULL;
#endif
}
@ -940,6 +943,7 @@ MiInsertPageInList(IN PMMPFNLIST ListHead,
ASSERT(MI_PFN_CURRENT_USAGE == MI_USAGE_NOT_SET);
Pfn1->PfnUsage = MI_USAGE_FREE_PAGE;
RtlZeroMemory(Pfn1->ProcessName, 16);
Pfn1->CallSite = NULL;
#endif
}
else if (ListName == ModifiedPageList)