mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 04:13:34 +00:00
[NTOS/MM]
- Remove IMG_SCN_TYPE_NOLOAD support which was firstly removed by Alex, then reenabled by Herve. Hopefully it works this time. - Return proper image size after successfully mapping an image section (previously, 0 was always returned). The change above is necessary for returning correct size. svn path=/trunk/; revision=51192
This commit is contained in:
@@ -4326,14 +4326,11 @@ MmUnmapViewOfSection(PEPROCESS Process,
|
||||
* and calculate the image base address */
|
||||
for (i = 0; i < NrSegments; i++)
|
||||
{
|
||||
if (!(SectionSegments[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD))
|
||||
{
|
||||
if (Segment == &SectionSegments[i])
|
||||
{
|
||||
ImageBaseAddress = (char*)BaseAddress - (ULONG_PTR)SectionSegments[i].VirtualAddress;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (Segment == &SectionSegments[i])
|
||||
{
|
||||
ImageBaseAddress = (char*)BaseAddress - (ULONG_PTR)SectionSegments[i].VirtualAddress;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= NrSegments)
|
||||
{
|
||||
@@ -4342,13 +4339,10 @@ MmUnmapViewOfSection(PEPROCESS Process,
|
||||
|
||||
for (i = 0; i < NrSegments; i++)
|
||||
{
|
||||
if (!(SectionSegments[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD))
|
||||
{
|
||||
PVOID SBaseAddress = (PVOID)
|
||||
((char*)ImageBaseAddress + (ULONG_PTR)SectionSegments[i].VirtualAddress);
|
||||
PVOID SBaseAddress = (PVOID)
|
||||
((char*)ImageBaseAddress + (ULONG_PTR)SectionSegments[i].VirtualAddress);
|
||||
|
||||
Status = MmUnmapViewOfSegment(AddressSpace, SBaseAddress);
|
||||
}
|
||||
Status = MmUnmapViewOfSegment(AddressSpace, SBaseAddress);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -4625,13 +4619,10 @@ MmMapViewOfSection(IN PVOID SectionObject,
|
||||
ImageSize = 0;
|
||||
for (i = 0; i < NrSegments; i++)
|
||||
{
|
||||
if (!(SectionSegments[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD))
|
||||
{
|
||||
ULONG_PTR MaxExtent;
|
||||
MaxExtent = (ULONG_PTR)SectionSegments[i].VirtualAddress +
|
||||
SectionSegments[i].Length;
|
||||
ImageSize = max(ImageSize, MaxExtent);
|
||||
}
|
||||
ULONG_PTR MaxExtent;
|
||||
MaxExtent = (ULONG_PTR)SectionSegments[i].VirtualAddress +
|
||||
SectionSegments[i].Length;
|
||||
ImageSize = max(ImageSize, MaxExtent);
|
||||
}
|
||||
|
||||
ImageSectionObject->ImageSize = ImageSize;
|
||||
@@ -4659,29 +4650,27 @@ MmMapViewOfSection(IN PVOID SectionObject,
|
||||
|
||||
for (i = 0; i < NrSegments; i++)
|
||||
{
|
||||
if (!(SectionSegments[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD))
|
||||
{
|
||||
PVOID SBaseAddress = (PVOID)
|
||||
((char*)ImageBase + (ULONG_PTR)SectionSegments[i].VirtualAddress);
|
||||
MmLockSectionSegment(&SectionSegments[i]);
|
||||
Status = MmMapViewOfSegment(AddressSpace,
|
||||
Section,
|
||||
&SectionSegments[i],
|
||||
&SBaseAddress,
|
||||
SectionSegments[i].Length,
|
||||
SectionSegments[i].Protection,
|
||||
0,
|
||||
0);
|
||||
MmUnlockSectionSegment(&SectionSegments[i]);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
PVOID SBaseAddress = (PVOID)
|
||||
((char*)ImageBase + (ULONG_PTR)SectionSegments[i].VirtualAddress);
|
||||
MmLockSectionSegment(&SectionSegments[i]);
|
||||
Status = MmMapViewOfSegment(AddressSpace,
|
||||
Section,
|
||||
&SectionSegments[i],
|
||||
&SBaseAddress,
|
||||
SectionSegments[i].Length,
|
||||
SectionSegments[i].Protection,
|
||||
0,
|
||||
0);
|
||||
MmUnlockSectionSegment(&SectionSegments[i]);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
|
||||
*BaseAddress = (PVOID)ImageBase;
|
||||
*ViewSize = ImageSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user