#ifndef _NTMMAPI_H
// Sections
#if (PHNT_MODE != PHNT_MODE_KERNEL)
NTSYSCALLAPI
NTSTATUS
NTAPI
NtCreateSection(
_Out_ PHANDLE SectionHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
_In_opt_ PLARGE_INTEGER MaximumSize,
_In_ ULONG SectionPageProtection,
_In_ ULONG AllocationAttributes,
_In_opt_ HANDLE FileHandle
);
View code on GitHub#ifndef _NTZWAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwCreateSection(
_Out_ PHANDLE SectionHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
_In_opt_ PLARGE_INTEGER MaximumSize,
_In_ ULONG SectionPageProtection,
_In_ ULONG AllocationAttributes,
_In_opt_ HANDLE FileHandle
);
View code on GitHubThis function is documented in Windows Driver Kit here and here.
Function NtCreateSection creates Section Object (virtual memory block with associated file).
Result of call - HANDLE to Section Object.
Access mask. Can be combination of:
SECTION_QUERYSECTION_MAP_WRITESECTION_MAP_READSECTION_MAP_EXECUTESECTION_EXTEND_SIZESECTION_ALL_ACCESSPointer to OBJECT_ATTRIBUTES structure contains section name, in Object Namespace format.
Optionally define maximum size of section. Must be defined when caller create section based on system PageFile.
Can be one or combination of:
PAGE_NOACCESSPAGE_READONLYPAGE_READWRITEPAGE_WRITECOPYPAGE_EXECUTEPAGE_EXECUTE_READPAGE_EXECUTE_READWRITEPAGE_EXECUTE_WRITECOPYPAGE_GUARDPAGE_NOCACHEPAGE_WRITECOMBINECan be one or combination of:
Optionally HANDLE to File Object opened with proper access.