mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[FREELDR] Implement PeLdrLoadImageEx
This allows to load an image as freeldr extension code. TODO: - Add global bootloader DTE list - Add wrapper function that also processes imports - Use this for scsiport
This commit is contained in:
parent
bee8e81d5a
commit
8a5ef4c1cc
2 changed files with 20 additions and 3 deletions
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue