https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b7d988ae5b4948b0ab4be…
commit b7d988ae5b4948b0ab4be8a094c3b5536fdd187c
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Mon Oct 26 10:31:46 2020 +0100
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Wed Feb 3 09:41:21 2021 +0100
[NTOSKRNL] Get rid of MM_ROS_SECTION_OBJECT
---
ntoskrnl/cache/newcc.h | 2 +-
ntoskrnl/cache/section/newmm.h | 4 +--
ntoskrnl/include/internal/mm.h | 7 +---
ntoskrnl/mm/ARM3/section.c | 10 ++----
ntoskrnl/mm/section.c | 74 ++++++++++++++++++++----------------------
5 files changed, 43 insertions(+), 54 deletions(-)
diff --git a/ntoskrnl/cache/newcc.h b/ntoskrnl/cache/newcc.h
index adbf1c5d926..8768d7aebd2 100644
--- a/ntoskrnl/cache/newcc.h
+++ b/ntoskrnl/cache/newcc.h
@@ -6,7 +6,7 @@ typedef struct _NOCC_BCB
PUBLIC_BCB Bcb;
struct _NOCC_CACHE_MAP *Map;
- PROS_SECTION_OBJECT SectionObject;
+ PSECTION SectionObject;
LARGE_INTEGER FileOffset;
ULONG Length;
PVOID BaseAddress;
diff --git a/ntoskrnl/cache/section/newmm.h b/ntoskrnl/cache/section/newmm.h
index d5f9998993c..edff99f3d85 100644
--- a/ntoskrnl/cache/section/newmm.h
+++ b/ntoskrnl/cache/section/newmm.h
@@ -96,7 +96,7 @@ typedef struct _MM_REQUIRED_RESOURCES
NTSTATUS
NTAPI
-MmCreateCacheSection(PROS_SECTION_OBJECT *SectionObject,
+MmCreateCacheSection(PSECTION *SectionObject,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes,
PLARGE_INTEGER UMaximumSize,
@@ -386,7 +386,7 @@ MiSwapInSectionPage(PMMSUPPORT AddressSpace,
NTSTATUS
NTAPI
-MmExtendCacheSection(PROS_SECTION_OBJECT Section,
+MmExtendCacheSection(PSECTION Section,
PLARGE_INTEGER NewSize,
BOOLEAN ExtendFile);
diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h
index 74cfcf7f11e..a8536c3d786 100644
--- a/ntoskrnl/include/internal/mm.h
+++ b/ntoskrnl/include/internal/mm.h
@@ -199,11 +199,6 @@ typedef struct _MM_IMAGE_SECTION_OBJECT
PMM_SECTION_SEGMENT Segments;
} MM_IMAGE_SECTION_OBJECT, *PMM_IMAGE_SECTION_OBJECT;
-typedef struct _ROS_SECTION_OBJECT
-{
- SECTION;
-} ROS_SECTION_OBJECT, *PROS_SECTION_OBJECT;
-
#define MA_GetStartingAddress(_MemoryArea) ((_MemoryArea)->VadNode.StartingVpn
<< PAGE_SHIFT)
#define MA_GetEndingAddress(_MemoryArea) (((_MemoryArea)->VadNode.EndingVpn + 1)
<< PAGE_SHIFT)
@@ -219,7 +214,7 @@ typedef struct _MEMORY_AREA
struct
{
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
LARGE_INTEGER ViewOffset;
PMM_SECTION_SEGMENT Segment;
LIST_ENTRY RegionListHead;
diff --git a/ntoskrnl/mm/ARM3/section.c b/ntoskrnl/mm/ARM3/section.c
index a91cfe2ed4a..73c0e3050aa 100644
--- a/ntoskrnl/mm/ARM3/section.c
+++ b/ntoskrnl/mm/ARM3/section.c
@@ -1655,14 +1655,12 @@ MiGetFileObjectForSectionAddress(
if (Vad->u.VadFlags.Spare != 0)
{
PMEMORY_AREA MemoryArea = (PMEMORY_AREA)Vad;
- PROS_SECTION_OBJECT Section;
/* Check if it's a section view (RosMm section) */
if (MemoryArea->Type == MEMORY_AREA_SECTION_VIEW)
{
/* Get the section pointer to the SECTION_OBJECT */
- Section = MemoryArea->SectionData.Section;
- *FileObject = ((PMM_SECTION_SEGMENT)Section->Segment)->FileObject;
+ *FileObject = MemoryArea->SectionData.Segment->FileObject;
}
else
{
@@ -1732,14 +1730,12 @@ MiGetFileObjectForVad(
if (Vad->u.VadFlags.Spare != 0)
{
PMEMORY_AREA MemoryArea = (PMEMORY_AREA)Vad;
- PROS_SECTION_OBJECT Section;
/* Check if it's a section view (RosMm section) */
if (MemoryArea->Type == MEMORY_AREA_SECTION_VIEW)
{
/* Get the section pointer to the SECTION_OBJECT */
- Section = MemoryArea->SectionData.Section;
- FileObject = ((PMM_SECTION_SEGMENT)Section->Segment)->FileObject;
+ FileObject = MemoryArea->SectionData.Segment->FileObject;
}
else
{
@@ -3840,7 +3836,7 @@ NtExtendSection(IN HANDLE SectionHandle,
IN OUT PLARGE_INTEGER NewMaximumSize)
{
LARGE_INTEGER SafeNewMaximumSize;
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
NTSTATUS Status;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c
index b975433e271..f43811e9f50 100644
--- a/ntoskrnl/mm/section.c
+++ b/ntoskrnl/mm/section.c
@@ -138,7 +138,7 @@ C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32,
IMAGE_OPTIONAL_HEADER64, Si
typedef struct
{
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
PMM_SECTION_SEGMENT Segment;
LARGE_INTEGER Offset;
BOOLEAN WasDirty;
@@ -899,7 +899,7 @@ MmSharePageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
BOOLEAN
NTAPI
-MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section,
+MmUnsharePageEntrySectionSegment(PSECTION Section,
PMM_SECTION_SEGMENT Segment,
PLARGE_INTEGER Offset,
BOOLEAN Dirty,
@@ -1389,7 +1389,7 @@ MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
LARGE_INTEGER Offset;
PFN_NUMBER Page;
NTSTATUS Status;
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
PMM_SECTION_SEGMENT Segment;
ULONG_PTR Entry;
ULONG_PTR Entry1;
@@ -1812,7 +1812,7 @@ MmAccessFaultSectionView(PMMSUPPORT AddressSpace,
PVOID Address)
{
PMM_SECTION_SEGMENT Segment;
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
PFN_NUMBER OldPage;
PFN_NUMBER NewPage;
NTSTATUS Status;
@@ -1955,7 +1955,7 @@ MmPageOutDeleteMapping(PVOID Context, PEPROCESS Process, PVOID
Address)
if (!PageOutContext->Private)
{
MmLockSectionSegment(PageOutContext->Segment);
-
MmUnsharePageEntrySectionSegment((PROS_SECTION_OBJECT)PageOutContext->Section,
+ MmUnsharePageEntrySectionSegment(PageOutContext->Section,
PageOutContext->Segment,
&PageOutContext->Offset,
PageOutContext->WasDirty,
@@ -2367,7 +2367,7 @@ MmWritePageSectionView(PMMSUPPORT AddressSpace,
ULONG PageEntry)
{
LARGE_INTEGER Offset;
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
PMM_SECTION_SEGMENT Segment;
PFN_NUMBER Page;
SWAPENTRY SwapEntry;
@@ -2557,7 +2557,7 @@ MmQuerySectionView(PMEMORY_AREA MemoryArea,
{
PMM_REGION Region;
PVOID RegionBaseAddress;
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
PMM_SECTION_SEGMENT Segment;
Region = MmFindRegion((PVOID)MA_GetStartingAddress(MemoryArea),
@@ -2635,7 +2635,7 @@ MmpFreePageFileSegment(PMM_SECTION_SEGMENT Segment)
VOID NTAPI
MmpDeleteSection(PVOID ObjectBody)
{
- PROS_SECTION_OBJECT Section = ObjectBody;
+ PSECTION Section = ObjectBody;
/* Check if it's an ARM3, or ReactOS section */
if (!MiIsRosSectionObject(Section))
@@ -2739,7 +2739,7 @@ NTSTATUS
NTAPI
MmCreatePhysicalMemorySection(VOID)
{
- PROS_SECTION_OBJECT PhysSection;
+ PSECTION PhysSection;
NTSTATUS Status;
OBJECT_ATTRIBUTES Obj;
UNICODE_STRING Name = RTL_CONSTANT_STRING(L"\\Device\\PhysicalMemory");
@@ -2764,7 +2764,7 @@ MmCreatePhysicalMemorySection(VOID)
&Obj,
ExGetPreviousMode(),
NULL,
- sizeof(ROS_SECTION_OBJECT),
+ sizeof(*PhysSection),
0,
0,
(PVOID*)&PhysSection);
@@ -2777,7 +2777,7 @@ MmCreatePhysicalMemorySection(VOID)
/*
* Initialize it
*/
- RtlZeroMemory(PhysSection, sizeof(ROS_SECTION_OBJECT));
+ RtlZeroMemory(PhysSection, sizeof(*PhysSection));
/* Mark this as a "ROS Section" */
PhysSection->u.Flags.filler = 1;
@@ -2838,7 +2838,7 @@ MmInitSectionImplementation(VOID)
RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
RtlInitUnicodeString(&Name, L"Section");
ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
- ObjectTypeInitializer.DefaultPagedPoolCharge = sizeof(ROS_SECTION_OBJECT);
+ ObjectTypeInitializer.DefaultPagedPoolCharge = sizeof(SECTION);
ObjectTypeInitializer.PoolType = PagedPool;
ObjectTypeInitializer.UseDefaultObject = TRUE;
ObjectTypeInitializer.GenericMapping = MmpSectionMapping;
@@ -2855,7 +2855,7 @@ MmInitSectionImplementation(VOID)
NTSTATUS
NTAPI
-MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject,
+MmCreateDataFileSection(PSECTION *SectionObject,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes,
PLARGE_INTEGER UMaximumSize,
@@ -2866,7 +2866,7 @@ MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject,
* Create a section backed by a data file
*/
{
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
NTSTATUS Status;
LARGE_INTEGER MaximumSize;
PMM_SECTION_SEGMENT Segment;
@@ -2881,7 +2881,7 @@ MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
- sizeof(ROS_SECTION_OBJECT),
+ sizeof(*Section),
0,
0,
(PVOID*)&Section);
@@ -2893,7 +2893,7 @@ MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject,
/*
* Initialize it
*/
- RtlZeroMemory(Section, sizeof(ROS_SECTION_OBJECT));
+ RtlZeroMemory(Section, sizeof(*Section));
/* Mark this as a "ROS" section */
Section->u.Flags.filler = 1;
@@ -3682,7 +3682,7 @@ ExeFmtpCreateImageSection(PFILE_OBJECT FileObject,
}
NTSTATUS
-MmCreateImageSection(PROS_SECTION_OBJECT *SectionObject,
+MmCreateImageSection(PSECTION *SectionObject,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes,
PLARGE_INTEGER UMaximumSize,
@@ -3690,7 +3690,7 @@ MmCreateImageSection(PROS_SECTION_OBJECT *SectionObject,
ULONG AllocationAttributes,
PFILE_OBJECT FileObject)
{
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
NTSTATUS Status;
PMM_SECTION_SEGMENT SectionSegments;
PMM_IMAGE_SECTION_OBJECT ImageSectionObject;
@@ -3715,7 +3715,7 @@ MmCreateImageSection(PROS_SECTION_OBJECT *SectionObject,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
- sizeof(ROS_SECTION_OBJECT),
+ sizeof(*Section),
0,
0,
(PVOID*)(PVOID)&Section);
@@ -3728,7 +3728,7 @@ MmCreateImageSection(PROS_SECTION_OBJECT *SectionObject,
/*
* Initialize it
*/
- RtlZeroMemory(Section, sizeof(ROS_SECTION_OBJECT));
+ RtlZeroMemory(Section, sizeof(*Section));
/* Mark this as a "ROS" Section */
Section->u.Flags.filler = 1;
@@ -3858,7 +3858,7 @@ MmCreateImageSection(PROS_SECTION_OBJECT *SectionObject,
static NTSTATUS
MmMapViewOfSegment(PMMSUPPORT AddressSpace,
- PROS_SECTION_OBJECT Section,
+ PSECTION Section,
PMM_SECTION_SEGMENT Segment,
PVOID* BaseAddress,
SIZE_T ViewSize,
@@ -3944,7 +3944,7 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID
Address,
#endif
LARGE_INTEGER Offset;
SWAPENTRY SavedSwapEntry;
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
PMM_SECTION_SEGMENT Segment;
PMMSUPPORT AddressSpace;
PEPROCESS Process;
@@ -4028,7 +4028,7 @@ MmUnmapViewOfSegment(PMMSUPPORT AddressSpace,
{
NTSTATUS Status;
PMEMORY_AREA MemoryArea;
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
PMM_SECTION_SEGMENT Segment;
PLIST_ENTRY CurrentEntry;
PMM_REGION CurrentRegion;
@@ -4095,7 +4095,7 @@ MiRosUnmapViewOfSection(IN PEPROCESS Process,
NTSTATUS Status;
PMEMORY_AREA MemoryArea;
PMMSUPPORT AddressSpace;
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
PVOID ImageBaseAddress = 0;
DPRINT("Opening memory area Process %p BaseAddress %p\n",
@@ -4281,8 +4281,6 @@ NtQuerySection(
if (MiIsRosSectionObject(Section))
{
- PROS_SECTION_OBJECT RosSection = (PROS_SECTION_OBJECT)Section;
-
switch (SectionInformationClass)
{
case SectionBasicInformation:
@@ -4292,22 +4290,22 @@ NtQuerySection(
_SEH2_TRY
{
Sbi->Attributes = 0;
- if (RosSection->u.Flags.Image)
+ if (Section->u.Flags.Image)
Sbi->Attributes |= SEC_IMAGE;
- if (RosSection->u.Flags.File)
+ if (Section->u.Flags.File)
Sbi->Attributes |= SEC_FILE;
- if (RosSection->u.Flags.NoChange)
+ if (Section->u.Flags.NoChange)
Sbi->Attributes |= SEC_NO_CHANGE;
- if (RosSection->u.Flags.Image)
+ if (Section->u.Flags.Image)
{
Sbi->BaseAddress = 0;
Sbi->Size.QuadPart = 0;
}
else
{
- Sbi->BaseAddress =
(PVOID)((PMM_SECTION_SEGMENT)RosSection->Segment)->Image.VirtualAddress;
- Sbi->Size.QuadPart =
((PMM_SECTION_SEGMENT)RosSection->Segment)->Length.QuadPart;
+ Sbi->BaseAddress =
(PVOID)((PMM_SECTION_SEGMENT)Section->Segment)->Image.VirtualAddress;
+ Sbi->Size.QuadPart =
((PMM_SECTION_SEGMENT)Section->Segment)->Length.QuadPart;
}
if (ResultLength != NULL)
@@ -4331,7 +4329,7 @@ NtQuerySection(
_SEH2_TRY
{
- if (RosSection->u.Flags.Image)
+ if (Section->u.Flags.Image)
{
PMM_IMAGE_SECTION_OBJECT ImageSectionObject =
((PMM_IMAGE_SECTION_OBJECT)Section->Segment);
@@ -4474,7 +4472,7 @@ MmMapViewOfSection(IN PVOID SectionObject,
IN ULONG AllocationType,
IN ULONG Protect)
{
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
PMMSUPPORT AddressSpace;
ULONG ViewOffset;
NTSTATUS Status = STATUS_SUCCESS;
@@ -4505,7 +4503,7 @@ MmMapViewOfSection(IN PVOID SectionObject,
/* FIXME: We should keep this, but it would break code checking equality */
Protect &= ~PAGE_NOCACHE;
- Section = (PROS_SECTION_OBJECT)SectionObject;
+ Section = SectionObject;
AddressSpace = &Process->Vm;
if (Section->u.Flags.NoChange)
@@ -4815,7 +4813,7 @@ MmMapViewInSystemSpace (IN PVOID SectionObject,
OUT PVOID * MappedBase,
IN OUT PSIZE_T ViewSize)
{
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
PMM_SECTION_SEGMENT Segment;
PMMSUPPORT AddressSpace;
NTSTATUS Status;
@@ -4831,7 +4829,7 @@ MmMapViewInSystemSpace (IN PVOID SectionObject,
DPRINT("MmMapViewInSystemSpace() called\n");
- Section = (PROS_SECTION_OBJECT)SectionObject;
+ Section = SectionObject;
Segment = (PMM_SECTION_SEGMENT)Section->Segment;
AddressSpace = MmGetKernelAddressSpace();
@@ -4953,7 +4951,7 @@ MmCreateSection (OUT PVOID * Section,
{
NTSTATUS Status;
ULONG Protection;
- PROS_SECTION_OBJECT *SectionObject = (PROS_SECTION_OBJECT *)Section;
+ PSECTION *SectionObject = (PSECTION *)Section;
/* Check if an ARM3 section is being created instead */
if (!(AllocationAttributes & (SEC_IMAGE | SEC_PHYSICALMEMORY)))