[NTOSKRNL] Use PSECTION struct where possible

This commit is contained in:
Jérôme Gardou 2020-10-23 16:39:15 +02:00
parent 462d9a0974
commit defbf63416
4 changed files with 9 additions and 20 deletions

View file

@ -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;

View file

@ -1071,7 +1071,7 @@ FORCEINLINE
BOOLEAN
MiIsRosSectionObject(IN PVOID Section)
{
PROS_SECTION_OBJECT RosSection = Section;
PSECTION RosSection = Section;
return RosSection->u.Flags.filler;
}

View file

@ -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 */

View file

@ -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;