NTSTATUS MmCreateSection( OUT PVOID *SectionObject, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER InputMaximumSize, IN ULONG SectionPageProtection, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL, IN PFILE_OBJECT FileObject OPTIONAL ); Routine Description: This function creates a section object and opens a handle to the object with the specified desired access. Arguments: Section - A pointer to a variable that will receive the section object address. DesiredAccess - The desired types of access for the section. DesiredAccess Flags EXECUTE - Execute access to the section is desired. READ - Read access to the section is desired. WRITE - Write access to the section is desired. ObjectAttributes - Supplies a pointer to an object attributes structure. InputMaximumSize - Supplies the maximum size of the section in bytes. This value is rounded up to the host page size and specifies the size of the section (page file backed section) or the maximum size to which a file can be extended or mapped (file backed section). SectionPageProtection - Supplies the protection to place on each page in the section. One of PAGE_READ, PAGE_READWRITE, PAGE_EXECUTE, or PAGE_WRITECOPY and, optionally, PAGE_NOCACHE may be specified. AllocationAttributes - Supplies a set of flags that describe the allocation attributes of the section. AllocationAttributes Flags SEC_BASED - The section is a based section and will be allocated at the same virtual address in each process address space that receives the section. This does not imply that addresses are reserved for based sections. Rather if the section cannot be mapped at the based address an error is returned. SEC_RESERVE - All pages of the section are set to the reserved state. SEC_COMMIT - All pages of the section are set to the commit state. SEC_IMAGE - The file specified by the file handle is an executable image file. SEC_FILE - The file specified by the file handle is a mapped file. If a file handle is supplied and neither SEC_IMAGE or SEC_FILE is supplied, SEC_FILE is assumed. FileHandle - Supplies an optional handle of an open file object. If the value of this handle is null, then the section will be backed by a paging file. Otherwise the section is backed by the specified data file. FileObject - Supplies an optional pointer to the file object. If this value is NULL and the FileHandle is NULL, then there is no file to map (image or mapped file). If this value is specified, then the File is to be mapped as a MAPPED FILE and NO file size checking will be performed. ONLY THE SYSTEM CACHE SHOULD PROVIDE A FILE OBJECT WITH THE CALL!! as this is optimized to not check the size, only do data mapping, no protection check, etc. Note - Only one of FileHandle or File should be specified! Return Value: Returns the relevant NTSTATUS code.