mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +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,
|
_In_ TYPE_OF_MEMORY MemoryType,
|
||||||
_Out_ PVOID* ImageBasePA);
|
_Out_ PVOID* ImageBasePA);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
PeLdrLoadImageEx(
|
||||||
|
_In_ PCSTR FilePath,
|
||||||
|
_In_ TYPE_OF_MEMORY MemoryType,
|
||||||
|
_Out_ PVOID* ImageBasePA,
|
||||||
|
_In_ BOOLEAN KernelMapping);
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
PeLdrAllocateDataTableEntry(
|
PeLdrAllocateDataTableEntry(
|
||||||
IN OUT PLIST_ENTRY ModuleListHead,
|
IN OUT PLIST_ENTRY ModuleListHead,
|
||||||
|
|
|
@ -820,10 +820,11 @@ PeLdrFreeDataTableEntry(
|
||||||
* Addressing mode: physical.
|
* Addressing mode: physical.
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
PeLdrLoadImage(
|
PeLdrLoadImageEx(
|
||||||
_In_ PCSTR FilePath,
|
_In_ PCSTR FilePath,
|
||||||
_In_ TYPE_OF_MEMORY MemoryType,
|
_In_ TYPE_OF_MEMORY MemoryType,
|
||||||
_Out_ PVOID* ImageBasePA)
|
_Out_ PVOID* ImageBasePA,
|
||||||
|
_In_ BOOLEAN KernelMapping)
|
||||||
{
|
{
|
||||||
ULONG FileId;
|
ULONG FileId;
|
||||||
PVOID PhysicalBase;
|
PVOID PhysicalBase;
|
||||||
|
@ -895,7 +896,7 @@ PeLdrLoadImage(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is the real image base, in form of a virtual address */
|
/* 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);
|
TRACE("Base PA: 0x%p, VA: 0x%p\n", PhysicalBase, VirtualBase);
|
||||||
|
|
||||||
|
@ -1009,3 +1010,12 @@ Failure:
|
||||||
MmFreeMemory(PhysicalBase);
|
MmFreeMemory(PhysicalBase);
|
||||||
return FALSE;
|
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