mirror of
https://github.com/reactos/reactos.git
synced 2024-11-28 14:03:37 +08:00
[NTOSKRNL] Store the MM_IMAGE_SECTION_OBJECT pointer in SECTION::Segment
This commit is contained in:
parent
c6a87f28bf
commit
e980efebd4
@ -200,8 +200,6 @@ typedef struct _ROS_SECTION_OBJECT
|
||||
{
|
||||
SECTION;
|
||||
PFILE_OBJECT FileObject;
|
||||
|
||||
PMM_IMAGE_SECTION_OBJECT ImageSection;
|
||||
} ROS_SECTION_OBJECT, *PROS_SECTION_OBJECT;
|
||||
|
||||
#define MA_GetStartingAddress(_MemoryArea) ((_MemoryArea)->VadNode.StartingVpn << PAGE_SHIFT)
|
||||
|
@ -1789,8 +1789,14 @@ MmGetImageInformation (OUT PSECTION_IMAGE_INFORMATION ImageInformation)
|
||||
ASSERT(SectionObject != NULL);
|
||||
ASSERT(MiIsRosSectionObject(SectionObject) == TRUE);
|
||||
|
||||
if (SectionObject->u.Flags.Image == 0)
|
||||
{
|
||||
RtlZeroMemory(ImageInformation, sizeof(*ImageInformation));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Return the image information */
|
||||
*ImageInformation = ((PROS_SECTION_OBJECT)SectionObject)->ImageSection->ImageInformation;
|
||||
*ImageInformation = ((PMM_IMAGE_SECTION_OBJECT)SectionObject->Segment)->ImageInformation;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
|
@ -81,13 +81,13 @@ MiCacheImageSymbols(IN PVOID BaseAddress)
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
MiLoadImageSection(IN OUT PVOID *SectionPtr,
|
||||
OUT PVOID *ImageBase,
|
||||
IN PUNICODE_STRING FileName,
|
||||
IN BOOLEAN SessionLoad,
|
||||
IN PLDR_DATA_TABLE_ENTRY LdrEntry)
|
||||
MiLoadImageSection(_Inout_ PSECTION *SectionPtr,
|
||||
_Out_ PVOID *ImageBase,
|
||||
_In_ PUNICODE_STRING FileName,
|
||||
_In_ BOOLEAN SessionLoad,
|
||||
_In_ PLDR_DATA_TABLE_ENTRY LdrEntry)
|
||||
{
|
||||
PROS_SECTION_OBJECT Section = *SectionPtr;
|
||||
PSECTION Section = *SectionPtr;
|
||||
NTSTATUS Status;
|
||||
PEPROCESS Process;
|
||||
PVOID Base = NULL;
|
||||
@ -158,7 +158,7 @@ MiLoadImageSection(IN OUT PVOID *SectionPtr,
|
||||
}
|
||||
|
||||
/* Reserve system PTEs needed */
|
||||
PteCount = ROUND_TO_PAGES(Section->ImageSection->ImageInformation.ImageFileSize) >> PAGE_SHIFT;
|
||||
PteCount = ROUND_TO_PAGES(((PMM_IMAGE_SECTION_OBJECT)Section->Segment)->ImageInformation.ImageFileSize) >> PAGE_SHIFT;
|
||||
PointerPte = MiReserveSystemPtes(PteCount, SystemPteSpace);
|
||||
if (!PointerPte)
|
||||
{
|
||||
@ -2837,7 +2837,7 @@ MmLoadSystemImage(IN PUNICODE_STRING FileName,
|
||||
PWCHAR MissingDriverName;
|
||||
HANDLE SectionHandle;
|
||||
ACCESS_MASK DesiredAccess;
|
||||
PVOID Section = NULL;
|
||||
PSECTION Section = NULL;
|
||||
BOOLEAN LockOwned = FALSE;
|
||||
PLIST_ENTRY NextEntry;
|
||||
IMAGE_INFO ImageInfo;
|
||||
@ -3054,7 +3054,7 @@ LoaderScan:
|
||||
SECTION_MAP_EXECUTE,
|
||||
MmSectionObjectType,
|
||||
KernelMode,
|
||||
&Section,
|
||||
(PVOID*)&Section,
|
||||
NULL);
|
||||
ZwClose(SectionHandle);
|
||||
if (!NT_SUCCESS(Status)) goto Quickie;
|
||||
@ -3085,7 +3085,7 @@ LoaderScan:
|
||||
ASSERT(Status != STATUS_ALREADY_COMMITTED);
|
||||
|
||||
/* Get the size of the driver */
|
||||
DriverSize = ((PROS_SECTION_OBJECT)Section)->ImageSection->ImageInformation.ImageFileSize;
|
||||
DriverSize = ((PMM_IMAGE_SECTION_OBJECT)Section->Segment)->ImageInformation.ImageFileSize;
|
||||
|
||||
/* Make sure we're not being loaded into session space */
|
||||
if (!Flags)
|
||||
|
@ -2633,7 +2633,7 @@ MmpFreePageFileSegment(PMM_SECTION_SEGMENT Segment)
|
||||
VOID NTAPI
|
||||
MmpDeleteSection(PVOID ObjectBody)
|
||||
{
|
||||
PROS_SECTION_OBJECT Section = (PROS_SECTION_OBJECT)ObjectBody;
|
||||
PROS_SECTION_OBJECT Section = ObjectBody;
|
||||
|
||||
/* Check if it's an ARM3, or ReactOS section */
|
||||
if (!MiIsRosSectionObject(Section))
|
||||
@ -2656,11 +2656,11 @@ MmpDeleteSection(PVOID ObjectBody)
|
||||
* until the image section is properly initialized we shouldn't
|
||||
* process further here.
|
||||
*/
|
||||
if (Section->ImageSection == NULL)
|
||||
if (Section->Segment == NULL)
|
||||
return;
|
||||
|
||||
SectionSegments = Section->ImageSection->Segments;
|
||||
NrSegments = Section->ImageSection->NrSegments;
|
||||
SectionSegments = ((PMM_IMAGE_SECTION_OBJECT)Section->Segment)->Segments;
|
||||
NrSegments = ((PMM_IMAGE_SECTION_OBJECT)Section->Segment)->NrSegments;
|
||||
|
||||
for (i = 0; i < NrSegments; i++)
|
||||
{
|
||||
@ -3763,7 +3763,7 @@ MmCreateImageSection(PROS_SECTION_OBJECT *SectionObject,
|
||||
return(Status);
|
||||
}
|
||||
|
||||
Section->ImageSection = ImageSectionObject;
|
||||
Section->Segment = (PSEGMENT)ImageSectionObject;
|
||||
ASSERT(ImageSectionObject->Segments);
|
||||
|
||||
/*
|
||||
@ -3788,7 +3788,7 @@ MmCreateImageSection(PROS_SECTION_OBJECT *SectionObject,
|
||||
ExFreePool(ImageSectionObject->Segments);
|
||||
ExFreePool(ImageSectionObject);
|
||||
ImageSectionObject = FileObject->SectionObjectPointer->ImageSectionObject;
|
||||
Section->ImageSection = ImageSectionObject;
|
||||
Section->Segment = (PSEGMENT)ImageSectionObject;
|
||||
SectionSegments = ImageSectionObject->Segments;
|
||||
|
||||
for (i = 0; i < ImageSectionObject->NrSegments; i++)
|
||||
@ -3813,7 +3813,7 @@ MmCreateImageSection(PROS_SECTION_OBJECT *SectionObject,
|
||||
}
|
||||
|
||||
ImageSectionObject = FileObject->SectionObjectPointer->ImageSectionObject;
|
||||
Section->ImageSection = ImageSectionObject;
|
||||
Section->Segment = (PSEGMENT)ImageSectionObject;
|
||||
SectionSegments = ImageSectionObject->Segments;
|
||||
|
||||
/*
|
||||
@ -4114,7 +4114,7 @@ MiRosUnmapViewOfSection(IN PEPROCESS Process,
|
||||
PMM_SECTION_SEGMENT Segment;
|
||||
|
||||
Segment = MemoryArea->SectionData.Segment;
|
||||
ImageSectionObject = Section->ImageSection;
|
||||
ImageSectionObject = ((PMM_IMAGE_SECTION_OBJECT)Section->Segment);
|
||||
SectionSegments = ImageSectionObject->Segments;
|
||||
NrSegments = ImageSectionObject->NrSegments;
|
||||
|
||||
@ -4314,8 +4314,7 @@ NtQuerySection(
|
||||
{
|
||||
if (RosSection->u.Flags.Image)
|
||||
{
|
||||
PMM_IMAGE_SECTION_OBJECT ImageSectionObject;
|
||||
ImageSectionObject = RosSection->ImageSection;
|
||||
PMM_IMAGE_SECTION_OBJECT ImageSectionObject = ((PMM_IMAGE_SECTION_OBJECT)Section->Segment);
|
||||
|
||||
*Sii = ImageSectionObject->ImageInformation;
|
||||
}
|
||||
@ -4504,7 +4503,7 @@ MmMapViewOfSection(IN PVOID SectionObject,
|
||||
PMM_IMAGE_SECTION_OBJECT ImageSectionObject;
|
||||
PMM_SECTION_SEGMENT SectionSegments;
|
||||
|
||||
ImageSectionObject = Section->ImageSection;
|
||||
ImageSectionObject = ((PMM_IMAGE_SECTION_OBJECT)Section->Segment);
|
||||
SectionSegments = ImageSectionObject->Segments;
|
||||
NrSegments = ImageSectionObject->NrSegments;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user