[NTOS/MM]

- NtQuerySection : Add initial support for ARM3 sections

svn path=/trunk/; revision=72483
This commit is contained in:
Jérôme Gardou 2016-08-28 09:38:54 +00:00
parent 4359ce1117
commit 92a722fd03

View file

@ -4299,7 +4299,7 @@ NtQuerySection(
_In_ SIZE_T SectionInformationLength,
_Out_opt_ PSIZE_T ResultLength)
{
PROS_SECTION_OBJECT Section;
PSECTION Section;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
PAGED_CODE();
@ -4357,6 +4357,10 @@ NtQuerySection(
return Status;
}
if (MiIsRosSectionObject(Section))
{
PROS_SECTION_OBJECT RosSection = (PROS_SECTION_OBJECT)Section;
switch (SectionInformationClass)
{
case SectionBasicInformation:
@ -4365,16 +4369,16 @@ NtQuerySection(
_SEH2_TRY
{
Sbi->Attributes = Section->AllocationAttributes;
if (Section->AllocationAttributes & SEC_IMAGE)
Sbi->Attributes = RosSection->AllocationAttributes;
if (RosSection->AllocationAttributes & SEC_IMAGE)
{
Sbi->BaseAddress = 0;
Sbi->Size.QuadPart = 0;
}
else
{
Sbi->BaseAddress = (PVOID)Section->Segment->Image.VirtualAddress;
Sbi->Size.QuadPart = Section->Segment->Length.QuadPart;
Sbi->BaseAddress = (PVOID)RosSection->Segment->Image.VirtualAddress;
Sbi->Size.QuadPart = RosSection->Segment->Length.QuadPart;
}
if (ResultLength != NULL)
@ -4398,10 +4402,10 @@ NtQuerySection(
_SEH2_TRY
{
if (Section->AllocationAttributes & SEC_IMAGE)
if (RosSection->AllocationAttributes & SEC_IMAGE)
{
PMM_IMAGE_SECTION_OBJECT ImageSectionObject;
ImageSectionObject = Section->ImageSection;
ImageSectionObject = RosSection->ImageSection;
*Sii = ImageSectionObject->ImageInformation;
}
@ -4421,6 +4425,60 @@ NtQuerySection(
break;
}
}
}
else
{
switch(SectionInformationClass)
{
case SectionBasicInformation:
{
SECTION_BASIC_INFORMATION Sbi;
Sbi.Size = Section->SizeOfSection;
Sbi.BaseAddress = (PVOID)Section->Address.StartingVpn;
Sbi.Attributes = 0;
if (Section->u.Flags.Image)
Sbi.Attributes |= SEC_IMAGE;
if (Section->u.Flags.Commit)
Sbi.Attributes |= SEC_COMMIT;
if (Section->u.Flags.Reserve)
Sbi.Attributes |= SEC_RESERVE;
if (Section->u.Flags.File)
Sbi.Attributes |= SEC_FILE;
if (Section->u.Flags.Image)
Sbi.Attributes |= SEC_IMAGE;
/* FIXME : Complete/test the list of flags passed back from NtCreateSection */
_SEH2_TRY
{
*((SECTION_BASIC_INFORMATION*)SectionInformation) = Sbi;
if (ResultLength)
*ResultLength = sizeof(Sbi);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
break;
}
case SectionImageInformation:
{
if (!Section->u.Flags.Image)
{
Status = STATUS_SECTION_NOT_IMAGE;
}
else
{
/* Currently not supported */
ASSERT(FALSE);
}
break;
}
}
}
ObDereferenceObject(Section);