Re: NtCreateSection()

From
Alex Fedotov ()
To
Alexey Nevolin
Date
2001-04-29T08:00:58Z
Area
SU.WINDOWS.NT.PROG
From: "Alex Fedotov" <alexf@3cube.com>

Alexey Nevolin wrote:

> Понимаю редкость, но может есть у кого интерфейс NtCreateSection()?

ZwCreateSection creates a section object.

NTSYSAPI
NTSTATUS
NTAPI
ZwCreateSection
        OUT PHANDLE SectionHandle,
        IN ACCESS_MASK DesiredAccess,
        IN POBJECT_ATTRIBUTES ObjectAttributes,
        IN PLARGE_INTEGER SectionSize OPTIONAL,
        IN ULONG Protect,
        IN ULONG Attributes,
        IN HANDLE FileHandle
        );

SectionHandle
    Points to a variable that will receive the section object handle
if the call is successful.

DesiredAccess
    Specifies the type of access that the caller requires to the
section object. This parameter can be zero of any combination of the
following flags:
            SECTION_QUERY          Query access
            SECTION_MAP_WRITE      Can be written when mapped
            SECTION_MAP_READ       Can be read when mapped
            SECTION_MAP_EXECUTE    Can be executed when mapped
            SECTION_EXTEND_SIZE    Extend access
            SECTION_ALL_ACCESS     All of the preceding +
                                   STANDARD_RIGHTS_REQUIRED

ObjectAttributes
    Points to a structure that specifies the object's attributes.
OBJ_OPENLINK is not a valid attribute for a section object.

SectionSize
    Optionally points to a variable that specifies the size, in
bytes, of the section. If FileHandle is zero, the size must be
specified; otherwise, it can be defaulted from the size of the file
referred to by FileHandle.

Protect
    The protection desired for the pages of the section when the
section is mapped. This parameter can take one of the following
values:
            PAGE_READONLY
            PAGE_READWRITE
            PAGE_WRITECOPY
            PAGE_EXECUTE
            PAGE_EXECUTE_READ
            PAGE_EXECUTE_READWRITE
            PAGE_EXECUTE_WRITECOPY

Attributes
    The attributes for the section. This parameter can be a
combination of the following values:
            SEC_BASED     0x00200000  Map section at same address in
each process
            SEC_NO_CHANGE 0x00400000  Disable changes to protection
of pages
            SEC_IMAGE     0x01000000  Map section as an image
            SEC_VLM       0x02000000  Map section in VLM region
            SEC_RESERVE   0x04000000  Reserve without allocating
pagefile storage
            SEC_COMMIT    0x08000000  Commit pages; the default
behavior
            SEC_NOCACHE   0x10000000  Mark pages as non-cacheable

FileHandle
    Identifies the file from which to create the section object. The
file must be opened with an access mode compatible with the
protection flags specified by the Protect parameter. If FileHandle is
zero, the function creates a section object of the specified size
backed by the paging file rather than by a named file in the file
system.

Related Win32 Functions
    CreateFileMapping

--
Alex Fedotov


--- ifmail v.2.15dev5
 * Origin: 3Cube, Inc. (www.3cube.com) (2:5020/400)