ZwOpenSection routine

The ZwOpenSection routine opens a handle for an existing section object.

Syntax


NTSTATUS ZwOpenSection(
  _Out_  PHANDLE SectionHandle,
  _In_   ACCESS_MASK DesiredAccess,
  _In_   POBJECT_ATTRIBUTES ObjectAttributes
);

Parameters

SectionHandle [out]

Pointer to a HANDLE variable that receives a handle to the section object.

DesiredAccess [in]

Specifies an ACCESS_MASK value that determines the requested access to the object. For more information, see the DesiredAccess parameter of ZwCreateSection.

ObjectAttributes [in]

Pointer to an OBJECT_ATTRIBUTES structure that specifies the object name and other attributes. Use InitializeObjectAttributes to initialize this structure. If the caller is not running in a system thread context, it must set the OBJ_KERNEL_HANDLE attribute when it calls InitializeObjectAttributes.

Return value

ZwOpenSection returns STATUS_SUCCESS on success, or the appropriate error code on failure. Possible return values include:

STATUS_SUCCESS
STATUS_ACCESS_DENIED
STATUS_INVALID_HANDLE

Remarks

If the section does not exist or the system did not grant the requested access, the operation fails.

Once the handle pointed to by SectionHandle is no longer in use, the driver must call ZwClose to close it.

If the caller is not running in a system thread context, it must ensure that any handles it creates are private handles. Otherwise, the handle can be accessed by the process in whose context the driver is running. For more information, see Object Handles.

Note  If the call to this function occurs in user mode, you should use the name "NtOpenSection" instead of "ZwOpenSection".

Requirements

Version

Available starting with Windows 2000.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

Ntoskrnl.lib

IRQL

PASSIVE_LEVEL

DDI compliance rules

PowerIrpDDis, HwStorPortProhibitedDDIs

See also

ACCESS_MASK
InitializeObjectAttributes
ZwCreateSection
ZwMapViewOfSection
ZwUnmapViewOfSection

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft