mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:42:57 +00:00
[FREELDR] PeLdrLoadImage: FileName -> FilePath and make it const.
This commit is contained in:
parent
8b948ff062
commit
7112815e23
2 changed files with 25 additions and 21 deletions
|
@ -28,9 +28,9 @@ extern PELDR_IMPORTDLL_LOAD_CALLBACK PeLdrImportDllLoadCallback;
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
PeLdrLoadImage(
|
PeLdrLoadImage(
|
||||||
IN PCHAR FileName,
|
_In_ PCSTR FilePath,
|
||||||
IN TYPE_OF_MEMORY MemoryType,
|
_In_ TYPE_OF_MEMORY MemoryType,
|
||||||
OUT PVOID *ImageBasePA);
|
_Out_ PVOID* ImageBasePA);
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
PeLdrAllocateDataTableEntry(
|
PeLdrAllocateDataTableEntry(
|
||||||
|
|
|
@ -725,18 +725,22 @@ PeLdrFreeDataTableEntry(
|
||||||
FrLdrHeapFree(Entry, TAG_WLDR_DTE);
|
FrLdrHeapFree(Entry, TAG_WLDR_DTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* PeLdrLoadImage loads the specified image from the file (it doesn't
|
* @brief
|
||||||
* perform any additional operations on the filename, just directly
|
* Loads the specified image from the file.
|
||||||
* calls the file I/O routines), and relocates it so that it's ready
|
*
|
||||||
* to be used when paging is enabled.
|
* PeLdrLoadImage doesn't perform any additional operations on the file path,
|
||||||
* Addressing mode: physical
|
* it just directly calls the file I/O routines. It then relocates the image
|
||||||
*/
|
* so that it's ready to be used when paging is enabled.
|
||||||
|
*
|
||||||
|
* @note
|
||||||
|
* Addressing mode: physical.
|
||||||
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
PeLdrLoadImage(
|
PeLdrLoadImage(
|
||||||
IN PCHAR FileName,
|
_In_ PCSTR FilePath,
|
||||||
IN TYPE_OF_MEMORY MemoryType,
|
_In_ TYPE_OF_MEMORY MemoryType,
|
||||||
OUT PVOID *ImageBasePA)
|
_Out_ PVOID* ImageBasePA)
|
||||||
{
|
{
|
||||||
ULONG FileId;
|
ULONG FileId;
|
||||||
PVOID PhysicalBase;
|
PVOID PhysicalBase;
|
||||||
|
@ -749,13 +753,13 @@ PeLdrLoadImage(
|
||||||
LARGE_INTEGER Position;
|
LARGE_INTEGER Position;
|
||||||
ULONG i, BytesRead;
|
ULONG i, BytesRead;
|
||||||
|
|
||||||
TRACE("PeLdrLoadImage('%s', %ld)\n", FileName, MemoryType);
|
TRACE("PeLdrLoadImage('%s', %ld)\n", FilePath, MemoryType);
|
||||||
|
|
||||||
/* Open the image file */
|
/* Open the image file */
|
||||||
Status = ArcOpen((PSTR)FileName, OpenReadOnly, &FileId);
|
Status = ArcOpen((PSTR)FilePath, OpenReadOnly, &FileId);
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
WARN("ArcOpen('%s') failed. Status: %u\n", FileName, Status);
|
WARN("ArcOpen('%s') failed. Status: %u\n", FilePath, Status);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -763,7 +767,7 @@ PeLdrLoadImage(
|
||||||
Status = ArcRead(FileId, HeadersBuffer, SECTOR_SIZE * 2, &BytesRead);
|
Status = ArcRead(FileId, HeadersBuffer, SECTOR_SIZE * 2, &BytesRead);
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
ERR("ArcRead('%s') failed. Status: %u\n", FileName, Status);
|
ERR("ArcRead('%s') failed. Status: %u\n", FilePath, Status);
|
||||||
ArcClose(FileId);
|
ArcClose(FileId);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -772,7 +776,7 @@ PeLdrLoadImage(
|
||||||
NtHeaders = RtlImageNtHeader(HeadersBuffer);
|
NtHeaders = RtlImageNtHeader(HeadersBuffer);
|
||||||
if (!NtHeaders)
|
if (!NtHeaders)
|
||||||
{
|
{
|
||||||
ERR("No NT header found in \"%s\"\n", FileName);
|
ERR("No NT header found in \"%s\"\n", FilePath);
|
||||||
ArcClose(FileId);
|
ArcClose(FileId);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -780,7 +784,7 @@ PeLdrLoadImage(
|
||||||
/* Ensure this is executable image */
|
/* Ensure this is executable image */
|
||||||
if (((NtHeaders->FileHeader.Characteristics & IMAGE_FILE_EXECUTABLE_IMAGE) == 0))
|
if (((NtHeaders->FileHeader.Characteristics & IMAGE_FILE_EXECUTABLE_IMAGE) == 0))
|
||||||
{
|
{
|
||||||
ERR("Not an executable image \"%s\"\n", FileName);
|
ERR("Not an executable image \"%s\"\n", FilePath);
|
||||||
ArcClose(FileId);
|
ArcClose(FileId);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -801,7 +805,7 @@ PeLdrLoadImage(
|
||||||
|
|
||||||
if (PhysicalBase == NULL)
|
if (PhysicalBase == NULL)
|
||||||
{
|
{
|
||||||
ERR("Failed to alloc %lu bytes for image %s\n", NtHeaders->OptionalHeader.SizeOfImage, FileName);
|
ERR("Failed to alloc %lu bytes for image %s\n", NtHeaders->OptionalHeader.SizeOfImage, FilePath);
|
||||||
ArcClose(FileId);
|
ArcClose(FileId);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -820,7 +824,7 @@ PeLdrLoadImage(
|
||||||
Status = ArcRead(FileId, (PUCHAR)PhysicalBase + sizeof(HeadersBuffer), NtHeaders->OptionalHeader.SizeOfHeaders - sizeof(HeadersBuffer), &BytesRead);
|
Status = ArcRead(FileId, (PUCHAR)PhysicalBase + sizeof(HeadersBuffer), NtHeaders->OptionalHeader.SizeOfHeaders - sizeof(HeadersBuffer), &BytesRead);
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
ERR("ArcRead('%s') failed. Status: %u\n", FileName, Status);
|
ERR("ArcRead('%s') failed. Status: %u\n", FilePath, Status);
|
||||||
// UiMessageBox("Error reading headers.");
|
// UiMessageBox("Error reading headers.");
|
||||||
ArcClose(FileId);
|
ArcClose(FileId);
|
||||||
goto Failure;
|
goto Failure;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue