diff --git a/boot/freeldr/freeldr/include/peloader.h b/boot/freeldr/freeldr/include/peloader.h index 00a387ef7a0..05214be9621 100644 --- a/boot/freeldr/freeldr/include/peloader.h +++ b/boot/freeldr/freeldr/include/peloader.h @@ -32,6 +32,13 @@ PeLdrLoadImage( _In_ TYPE_OF_MEMORY MemoryType, _Out_ PVOID* ImageBasePA); +BOOLEAN +PeLdrLoadImageEx( + _In_ PCSTR FilePath, + _In_ TYPE_OF_MEMORY MemoryType, + _Out_ PVOID* ImageBasePA, + _In_ BOOLEAN KernelMapping); + BOOLEAN PeLdrAllocateDataTableEntry( IN OUT PLIST_ENTRY ModuleListHead, diff --git a/boot/freeldr/freeldr/lib/peloader.c b/boot/freeldr/freeldr/lib/peloader.c index 857dba43258..13b6895f38b 100644 --- a/boot/freeldr/freeldr/lib/peloader.c +++ b/boot/freeldr/freeldr/lib/peloader.c @@ -820,10 +820,11 @@ PeLdrFreeDataTableEntry( * Addressing mode: physical. **/ BOOLEAN -PeLdrLoadImage( +PeLdrLoadImageEx( _In_ PCSTR FilePath, _In_ TYPE_OF_MEMORY MemoryType, - _Out_ PVOID* ImageBasePA) + _Out_ PVOID* ImageBasePA, + _In_ BOOLEAN KernelMapping) { ULONG FileId; PVOID PhysicalBase; @@ -895,7 +896,7 @@ PeLdrLoadImage( } /* This is the real image base, in form of a virtual address */ - VirtualBase = PaToVa(PhysicalBase); + VirtualBase = KernelMapping ? PaToVa(PhysicalBase) : PhysicalBase; TRACE("Base PA: 0x%p, VA: 0x%p\n", PhysicalBase, VirtualBase); @@ -1009,3 +1010,12 @@ Failure: MmFreeMemory(PhysicalBase); return FALSE; } + +BOOLEAN +PeLdrLoadImage( + _In_ PCSTR FilePath, + _In_ TYPE_OF_MEMORY MemoryType, + _Out_ PVOID* ImageBasePA) +{ + return PeLdrLoadImageEx(FilePath, MemoryType, ImageBasePA, TRUE); +}