mirror of
https://github.com/reactos/reactos.git
synced 2024-07-27 14:49:22 +00:00
[NTOS/MM]
- NtQuerySection : Add initial support for ARM3 sections svn path=/trunk/; revision=72483
This commit is contained in:
parent
4359ce1117
commit
92a722fd03
|
@ -4299,7 +4299,7 @@ NtQuerySection(
|
||||||
_In_ SIZE_T SectionInformationLength,
|
_In_ SIZE_T SectionInformationLength,
|
||||||
_Out_opt_ PSIZE_T ResultLength)
|
_Out_opt_ PSIZE_T ResultLength)
|
||||||
{
|
{
|
||||||
PROS_SECTION_OBJECT Section;
|
PSECTION Section;
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
@ -4357,68 +4357,126 @@ NtQuerySection(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (SectionInformationClass)
|
if (MiIsRosSectionObject(Section))
|
||||||
{
|
{
|
||||||
case SectionBasicInformation:
|
PROS_SECTION_OBJECT RosSection = (PROS_SECTION_OBJECT)Section;
|
||||||
{
|
|
||||||
PSECTION_BASIC_INFORMATION Sbi = (PSECTION_BASIC_INFORMATION)SectionInformation;
|
|
||||||
|
|
||||||
_SEH2_TRY
|
switch (SectionInformationClass)
|
||||||
|
{
|
||||||
|
case SectionBasicInformation:
|
||||||
{
|
{
|
||||||
Sbi->Attributes = Section->AllocationAttributes;
|
PSECTION_BASIC_INFORMATION Sbi = (PSECTION_BASIC_INFORMATION)SectionInformation;
|
||||||
if (Section->AllocationAttributes & SEC_IMAGE)
|
|
||||||
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
Sbi->BaseAddress = 0;
|
Sbi->Attributes = RosSection->AllocationAttributes;
|
||||||
Sbi->Size.QuadPart = 0;
|
if (RosSection->AllocationAttributes & SEC_IMAGE)
|
||||||
|
{
|
||||||
|
Sbi->BaseAddress = 0;
|
||||||
|
Sbi->Size.QuadPart = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Sbi->BaseAddress = (PVOID)RosSection->Segment->Image.VirtualAddress;
|
||||||
|
Sbi->Size.QuadPart = RosSection->Segment->Length.QuadPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ResultLength != NULL)
|
||||||
|
{
|
||||||
|
*ResultLength = sizeof(SECTION_BASIC_INFORMATION);
|
||||||
|
}
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Status = _SEH2_GetExceptionCode();
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SectionImageInformation:
|
||||||
|
{
|
||||||
|
PSECTION_IMAGE_INFORMATION Sii = (PSECTION_IMAGE_INFORMATION)SectionInformation;
|
||||||
|
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
if (RosSection->AllocationAttributes & SEC_IMAGE)
|
||||||
|
{
|
||||||
|
PMM_IMAGE_SECTION_OBJECT ImageSectionObject;
|
||||||
|
ImageSectionObject = RosSection->ImageSection;
|
||||||
|
|
||||||
|
*Sii = ImageSectionObject->ImageInformation;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ResultLength != NULL)
|
||||||
|
{
|
||||||
|
*ResultLength = sizeof(SECTION_IMAGE_INFORMATION);
|
||||||
|
}
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Status = _SEH2_GetExceptionCode();
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
|
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
|
else
|
||||||
{
|
{
|
||||||
Sbi->BaseAddress = (PVOID)Section->Segment->Image.VirtualAddress;
|
/* Currently not supported */
|
||||||
Sbi->Size.QuadPart = Section->Segment->Length.QuadPart;
|
ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
if (ResultLength != NULL)
|
|
||||||
{
|
|
||||||
*ResultLength = sizeof(SECTION_BASIC_INFORMATION);
|
|
||||||
}
|
|
||||||
Status = STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
||||||
{
|
|
||||||
Status = _SEH2_GetExceptionCode();
|
|
||||||
}
|
|
||||||
_SEH2_END;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SectionImageInformation:
|
|
||||||
{
|
|
||||||
PSECTION_IMAGE_INFORMATION Sii = (PSECTION_IMAGE_INFORMATION)SectionInformation;
|
|
||||||
|
|
||||||
_SEH2_TRY
|
|
||||||
{
|
|
||||||
if (Section->AllocationAttributes & SEC_IMAGE)
|
|
||||||
{
|
|
||||||
PMM_IMAGE_SECTION_OBJECT ImageSectionObject;
|
|
||||||
ImageSectionObject = Section->ImageSection;
|
|
||||||
|
|
||||||
*Sii = ImageSectionObject->ImageInformation;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ResultLength != NULL)
|
|
||||||
{
|
|
||||||
*ResultLength = sizeof(SECTION_IMAGE_INFORMATION);
|
|
||||||
}
|
|
||||||
Status = STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
||||||
{
|
|
||||||
Status = _SEH2_GetExceptionCode();
|
|
||||||
}
|
|
||||||
_SEH2_END;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue