/*
* Initialize it
*/
+ RtlZeroMemory(Section, sizeof(ROS_SECTION_OBJECT));
Section->SectionPageProtection = SectionPageProtection;
Section->AllocationAttributes = AllocationAttributes;
- Section->Segment = NULL;
- Section->FileObject = NULL;
Section->MaximumSize = MaximumSize;
Segment = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_SECTION_SEGMENT),
TAG_MM_SECTION_SEGMENT);
/*
* Initialize it
*/
+ RtlZeroMemory(Section, sizeof(ROS_SECTION_OBJECT));
Section->SectionPageProtection = SectionPageProtection;
Section->AllocationAttributes = AllocationAttributes;
- Section->Segment = NULL;
/*
* Check file access required
/*
* Initialize it
*/
+ RtlZeroMemory(Section, sizeof(ROS_SECTION_OBJECT));
Section->SectionPageProtection = SectionPageProtection;
Section->AllocationAttributes = AllocationAttributes;
PMMSUPPORT AddressSpace;
NTSTATUS Status = STATUS_SUCCESS;
ULONG tmpProtect;
+ ACCESS_MASK DesiredAccess;
/*
* Check the protection
AddressSpace = &Process->Vm;
+ /* Convert NT Protection Attr to Access Mask */
+ if (Protect == PAGE_READONLY)
+ {
+ DesiredAccess = SECTION_MAP_READ;
+ }
+ else if (Protect == PAGE_READWRITE)
+ {
+ DesiredAccess = SECTION_MAP_WRITE;
+ }
+ else if (Protect == PAGE_WRITECOPY)
+ {
+ DesiredAccess = SECTION_QUERY;
+ }
+ /* FIXME: Handle other Protection Attributes. For now keep previous behavior */
+ else
+ {
+ DesiredAccess = SECTION_MAP_READ;
+ }
+
Status = ObReferenceObjectByHandle(SectionHandle,
- SECTION_MAP_READ,
+ DesiredAccess,
MmSectionObjectType,
PreviousMode,
(PVOID*)(PVOID)&Section,
if (!(Section->AllocationAttributes & SEC_FILE))
{
- ObfDereferenceObject(Section);
+ ObDereferenceObject(Section);
return STATUS_INVALID_PARAMETER;
}