[FREELDR] Pass VA instead of PA to PeLdrAllocateDataTableEntry

This allows to create DTEs for loader modules.
This commit is contained in:
Timo Kreuzer 2024-10-03 10:12:29 +02:00
parent 8a5ef4c1cc
commit 6eac9b5891
3 changed files with 10 additions and 6 deletions

View file

@ -44,7 +44,7 @@ PeLdrAllocateDataTableEntry(
IN OUT PLIST_ENTRY ModuleListHead,
IN PCCH BaseDllName,
IN PCCH FullDllName,
IN PVOID BasePA,
IN PVOID BaseVA,
OUT PLDR_DATA_TABLE_ENTRY *NewEntry);
VOID

View file

@ -418,7 +418,7 @@ PeLdrpLoadAndScanReferencedDll(
Success = PeLdrAllocateDataTableEntry(Parent ? Parent->Blink : ModuleListHead,
ImportName,
FullDllName,
BasePA,
PaToVa(BasePA),
DataTableEntry);
if (!Success)
{
@ -682,10 +682,10 @@ PeLdrAllocateDataTableEntry(
IN OUT PLIST_ENTRY ModuleListHead,
IN PCCH BaseDllName,
IN PCCH FullDllName,
IN PVOID BasePA,
IN PVOID BaseVA,
OUT PLDR_DATA_TABLE_ENTRY *NewEntry)
{
PVOID BaseVA = PaToVa(BasePA);
PVOID BasePA = VaToPa(BaseVA);
PWSTR BaseDllNameBuffer, Buffer;
PLDR_DATA_TABLE_ENTRY DataTableEntry;
PIMAGE_NT_HEADERS NtHeaders;

View file

@ -342,7 +342,11 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
}
// Allocate a DTE for it
Success = PeLdrAllocateDataTableEntry(LoadOrderListHead, DllName, DllName, DriverBase, DriverDTE);
Success = PeLdrAllocateDataTableEntry(LoadOrderListHead,
DllName,
DllName,
PaToVa(DriverBase),
DriverDTE);
if (!Success)
{
/* Cleanup and bail out */
@ -542,7 +546,7 @@ LoadModule(
Success = PeLdrAllocateDataTableEntry(&LoaderBlock->LoadOrderListHead,
ImportName,
FullFileName,
BaseAddress,
PaToVa(BaseAddress),
Dte);
if (!Success)
{