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,6 +187,8 @@ NTSTATUS LdrpMapImage(HANDLE ProcessHandle,
|
||||||
Size = Sections[i].Misc.VirtualSize;
|
Size = Sections[i].Misc.VirtualSize;
|
||||||
KeDetachProcess();
|
KeDetachProcess();
|
||||||
|
|
||||||
|
if( Offset.u.LowPart )
|
||||||
|
{ // map the section if it is initialized
|
||||||
Status = ZwMapViewOfSection(SectionHandle,
|
Status = ZwMapViewOfSection(SectionHandle,
|
||||||
ProcessHandle,
|
ProcessHandle,
|
||||||
(PVOID *)&Base,
|
(PVOID *)&Base,
|
||||||
|
@ -203,6 +205,21 @@ NTSTATUS LdrpMapImage(HANDLE ProcessHandle,
|
||||||
return(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");
|
||||||
*ReturnedImageBase = ImageBase;
|
*ReturnedImageBase = ImageBase;
|
||||||
|
|
Loading…
Reference in a new issue