mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed loader bug with uninitialized sections
svn path=/trunk/; revision=1557
This commit is contained in:
parent
e6c8459347
commit
b6593ffc1b
1 changed files with 32 additions and 16 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: utils.c,v 1.35 2000/12/07 17:00:12 jean Exp $
|
/* $Id: utils.c,v 1.36 2001/01/23 04:37:13 phreak Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -534,7 +534,8 @@ NTSTATUS LdrMapSections(HANDLE ProcessHandle,
|
||||||
DPRINT("Mapping section %d offset %x base %x size %x\n",
|
DPRINT("Mapping section %d offset %x base %x size %x\n",
|
||||||
i, Offset.u.LowPart, Base, Sections[i].Misc.VirtualSize);
|
i, Offset.u.LowPart, Base, Sections[i].Misc.VirtualSize);
|
||||||
DPRINT("Size %x\n", Sections[i].SizeOfRawData);
|
DPRINT("Size %x\n", Sections[i].SizeOfRawData);
|
||||||
|
if( Offset.u.LowPart )
|
||||||
|
{ // only map section if it is initialized
|
||||||
Status = ZwMapViewOfSection(SectionHandle,
|
Status = ZwMapViewOfSection(SectionHandle,
|
||||||
ProcessHandle,
|
ProcessHandle,
|
||||||
(PVOID*)&Base,
|
(PVOID*)&Base,
|
||||||
|
@ -547,10 +548,25 @@ NTSTATUS LdrMapSections(HANDLE ProcessHandle,
|
||||||
PAGE_READWRITE);
|
PAGE_READWRITE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Failed to map section");
|
DPRINT1("Failed to map section");
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// allocate pure memory for uninitialized section
|
||||||
|
Status = NtAllocateVirtualMemory( NtCurrentProcess(),
|
||||||
|
(PVOID *)&Base,
|
||||||
|
0,
|
||||||
|
&Size,
|
||||||
|
MEM_COMMIT,
|
||||||
|
PAGE_READWRITE );
|
||||||
|
if( !NT_SUCCESS( Status ) )
|
||||||
|
{
|
||||||
|
DPRINT1( "Failed to allocate memory for uninitialized section\n" );
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue