mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +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;
|
Size = Sections[i].Misc.VirtualSize;
|
||||||
KeDetachProcess();
|
KeDetachProcess();
|
||||||
|
|
||||||
Status = ZwMapViewOfSection(SectionHandle,
|
if( Offset.u.LowPart )
|
||||||
ProcessHandle,
|
{ // map the section if it is initialized
|
||||||
(PVOID *)&Base,
|
Status = ZwMapViewOfSection(SectionHandle,
|
||||||
0,
|
ProcessHandle,
|
||||||
Size,
|
(PVOID *)&Base,
|
||||||
&Offset,
|
0,
|
||||||
(PULONG)&Size,
|
Size,
|
||||||
0,
|
&Offset,
|
||||||
MEM_COMMIT,
|
(PULONG)&Size,
|
||||||
PAGE_READWRITE);
|
0,
|
||||||
if (!NT_SUCCESS(Status))
|
MEM_COMMIT,
|
||||||
{
|
PAGE_READWRITE);
|
||||||
DbgPrint("Image map view of secion failed (Status %x)\n", Status);
|
if (!NT_SUCCESS(Status))
|
||||||
return(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");
|
DPRINT("Returning\n");
|
||||||
|
|
Loading…
Reference in a new issue