https://git.reactos.org/?p=reactos.git;a=commitdiff;h=defbf63416fc622bdfbbb…
commit defbf63416fc622bdfbbbe8cb0283d559cbf84a9
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Fri Oct 23 16:39:15 2020 +0200
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Wed Feb 3 09:41:21 2021 +0100
[NTOSKRNL] Use PSECTION struct where possible
---
ntoskrnl/include/internal/mm.h | 2 +-
ntoskrnl/mm/ARM3/miarm.h | 2 +-
ntoskrnl/mm/ARM3/procsup.c | 10 ++++------
ntoskrnl/mm/ARM3/section.c | 15 +++------------
4 files changed, 9 insertions(+), 20 deletions(-)
diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h
index 1fbe513524f..4ca7e6717aa 100644
--- a/ntoskrnl/include/internal/mm.h
+++ b/ntoskrnl/include/internal/mm.h
@@ -221,7 +221,7 @@ typedef struct _MEMORY_AREA
{
struct
{
- ROS_SECTION_OBJECT* Section;
+ PROS_SECTION_OBJECT Section;
LARGE_INTEGER ViewOffset;
PMM_SECTION_SEGMENT Segment;
LIST_ENTRY RegionListHead;
diff --git a/ntoskrnl/mm/ARM3/miarm.h b/ntoskrnl/mm/ARM3/miarm.h
index ade2696cf1d..025cd6f6561 100644
--- a/ntoskrnl/mm/ARM3/miarm.h
+++ b/ntoskrnl/mm/ARM3/miarm.h
@@ -1071,7 +1071,7 @@ FORCEINLINE
BOOLEAN
MiIsRosSectionObject(IN PVOID Section)
{
- PROS_SECTION_OBJECT RosSection = Section;
+ PSECTION RosSection = Section;
return RosSection->u.Flags.filler;
}
diff --git a/ntoskrnl/mm/ARM3/procsup.c b/ntoskrnl/mm/ARM3/procsup.c
index a183f8a099f..eb8e68180d4 100644
--- a/ntoskrnl/mm/ARM3/procsup.c
+++ b/ntoskrnl/mm/ARM3/procsup.c
@@ -941,7 +941,6 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process,
NTSTATUS Status = STATUS_SUCCESS;
SIZE_T ViewSize = 0;
PVOID ImageBase = 0;
- PROS_SECTION_OBJECT SectionObject = Section;
PMMPTE PointerPte;
KIRQL OldIrql;
PMMPDE PointerPde;
@@ -1048,10 +1047,11 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process,
#endif
/* Check if there's a Section Object */
- if (SectionObject)
+ if (Section)
{
/* Determine the image file name and save it to EPROCESS */
- FileName = SectionObject->FileObject->FileName;
+ PFILE_OBJECT FileObject = MmGetFileObjectForSection(Section);
+ FileName = FileObject->FileName;
Source = (PWCHAR)((PCHAR)FileName.Buffer + FileName.Length);
if (FileName.Buffer)
{
@@ -1083,9 +1083,7 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process,
if (AuditName)
{
/* Setup the audit name */
- Status = SeInitializeProcessAuditName(SectionObject->FileObject,
- FALSE,
- AuditName);
+ Status = SeInitializeProcessAuditName(FileObject, FALSE, AuditName);
if (!NT_SUCCESS(Status))
{
/* Fail */
diff --git a/ntoskrnl/mm/ARM3/section.c b/ntoskrnl/mm/ARM3/section.c
index bff71dfe81c..1090a8dfada 100644
--- a/ntoskrnl/mm/ARM3/section.c
+++ b/ntoskrnl/mm/ARM3/section.c
@@ -1831,19 +1831,10 @@ MmGetFileNameForSection(IN PVOID Section,
OUT POBJECT_NAME_INFORMATION *ModuleName)
{
PFILE_OBJECT FileObject;
+ PSECTION SectionObject = Section;
/* Make sure it's an image section */
- if (MiIsRosSectionObject(Section) == FALSE)
- {
- /* Check ARM3 Section flag */
- if (((PSECTION)Section)->u.Flags.Image == 0)
- {
- /* It's not, fail */
- DPRINT1("Not an image section\n");
- return STATUS_SECTION_NOT_IMAGE;
- }
- }
- else if (!(((PROS_SECTION_OBJECT)Section)->u.Flags.Image))
+ if (SectionObject->u.Flags.Image == 0)
{
/* It's not, fail */
DPRINT1("Not an image section\n");
@@ -3594,7 +3585,7 @@ NtMapViewOfSection(IN HANDLE SectionHandle,
PVOID SafeBaseAddress;
LARGE_INTEGER SafeSectionOffset;
SIZE_T SafeViewSize;
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
PEPROCESS Process;
NTSTATUS Status;
ACCESS_MASK DesiredAccess;