https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6eac9b58913780ec0dd5f…
commit 6eac9b58913780ec0dd5f0d8b8bb81ed9fcf27e4
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Thu Oct 3 10:12:29 2024 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sat Nov 2 17:31:57 2024 +0200
[FREELDR] Pass VA instead of PA to PeLdrAllocateDataTableEntry
This allows to create DTEs for loader modules.
---
boot/freeldr/freeldr/include/peloader.h | 2 +-
boot/freeldr/freeldr/lib/peloader.c | 6 +++---
boot/freeldr/freeldr/ntldr/winldr.c | 8 ++++++--
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/boot/freeldr/freeldr/include/peloader.h
b/boot/freeldr/freeldr/include/peloader.h
index 05214be9621..4e7901e8b89 100644
--- a/boot/freeldr/freeldr/include/peloader.h
+++ b/boot/freeldr/freeldr/include/peloader.h
@@ -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
diff --git a/boot/freeldr/freeldr/lib/peloader.c b/boot/freeldr/freeldr/lib/peloader.c
index 13b6895f38b..7d404b09a0b 100644
--- a/boot/freeldr/freeldr/lib/peloader.c
+++ b/boot/freeldr/freeldr/lib/peloader.c
@@ -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;
diff --git a/boot/freeldr/freeldr/ntldr/winldr.c b/boot/freeldr/freeldr/ntldr/winldr.c
index 4b4d46204ae..f3405b70ba3 100644
--- a/boot/freeldr/freeldr/ntldr/winldr.c
+++ b/boot/freeldr/freeldr/ntldr/winldr.c
@@ -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)
{