mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Fixed kernel loader code also to handle uninitialized sections
svn path=/trunk/; revision=1561
This commit is contained in:
parent
207393f045
commit
89e2e7a616
1 changed files with 31 additions and 14 deletions
|
@ -187,21 +187,38 @@ NTSTATUS LdrpMapImage(HANDLE ProcessHandle,
|
|||
Size = Sections[i].Misc.VirtualSize;
|
||||
KeDetachProcess();
|
||||
|
||||
Status = ZwMapViewOfSection(SectionHandle,
|
||||
ProcessHandle,
|
||||
(PVOID *)&Base,
|
||||
0,
|
||||
Size,
|
||||
&Offset,
|
||||
(PULONG)&Size,
|
||||
0,
|
||||
MEM_COMMIT,
|
||||
PAGE_READWRITE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("Image map view of secion failed (Status %x)\n", Status);
|
||||
return(Status);
|
||||
if( Offset.u.LowPart )
|
||||
{ // map the section if it is initialized
|
||||
Status = ZwMapViewOfSection(SectionHandle,
|
||||
ProcessHandle,
|
||||
(PVOID *)&Base,
|
||||
0,
|
||||
Size,
|
||||
&Offset,
|
||||
(PULONG)&Size,
|
||||
0,
|
||||
MEM_COMMIT,
|
||||
PAGE_READWRITE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("Image map view of secion failed (Status %x)\n", Status);
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// allocate the section if it is uninitialized
|
||||
Status = NtAllocateVirtualMemory( ProcessHandle,
|
||||
(PVOID *)&Base,
|
||||
0,
|
||||
&Size,
|
||||
MEM_COMMIT,
|
||||
PAGE_READWRITE );
|
||||
if( !NT_SUCCESS( Status ) )
|
||||
{
|
||||
DPRINT1( "Failed to allocate memory for uninitialized section\n" );
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DPRINT("Returning\n");
|
||||
|
|
Loading…
Reference in a new issue