NtOpenEnlistment function

The ZwOpenEnlistment routine obtains a handle to an existing enlistment object.

Syntax

__kernel_entry NTSYSCALLAPI NTSTATUS NtOpenEnlistment(
  PHANDLE            EnlistmentHandle,
  ACCESS_MASK        DesiredAccess,
  HANDLE             ResourceManagerHandle,
  LPGUID             EnlistmentGuid,
  POBJECT_ATTRIBUTES ObjectAttributes
);

Parameters

EnlistmentHandle

A pointer to a caller-allocated variable that receives a handle to an enlistment object if the call to ZwOpenEnlistment succeeds.

DesiredAccess

An ACCESS_MASK-typed value that specifies the requested access to the enlistment object. For more information about how to specify this parameter, see the DesiredAccess parameter of ZwCreateEnlistment. This parameter cannot be zero.

ResourceManagerHandle

A handle to a resource manager object that was obtained by a previous call to ZwCreateResourceManager or ZwOpenResourceManager.

EnlistmentGuid

A pointer to a GUID that identifies the enlistment. For more information, see the following Remarks section.

ObjectAttributes

A pointer to an OBJECT_ATTRIBUTES structure that specifies the object's attributes. Use the InitializeObjectAttributes routine to initialize this structure, but specify only that routine's InitializedAttributes and Attributes parameters. If the caller is not running in a system thread context, it must set the OBJ_KERNEL_HANDLE flag in the Attributes parameter. This parameter is optional and can be NULL.

Return Value

ZwOpenEnlistment returns STATUS_SUCCESS if the operation succeeds. Otherwise, this routine might return one of the following values:

Return code Description
STATUS_INVALID_HANDLE
The object handle is invalid.
STATUS_ACCESS_DENIED
The caller does not have appropriate access to the enlistment object.
STATUS_INVALID_PARAMETER
The DesiredAccess parameter's value is zero, or the EnlistmentGuid parameter's value is NULL.
STATUS_ENLISTMENT_NOT_FOUND
The enlistment that the EnlistmentGuid parameter specifies does not exist for the resource manager that the RmHandle parameter specifies.
STATUS_ACCESS_DENIED
The value of the DesiredAccess parameter is invalid.
 

The routine might return other NTSTATUS values.

Remarks

Typically, a TPS component calls ZwOpenEnlistment after it receives an enlistment GUID from another TPS component that had previously called ZwCreateEnlistment. Most TPS designs do not require calling ZwOpenEnlistment.

A resource manager that calls ZwOpenEnlistment must eventually call ZwClose to close the object handle.

For more information about ZwOpenEnlistment, see Enlistment Objects.

NtOpenEnlistment and ZwOpenEnlistment are two versions of the same Windows Native System Services routine.

For calls from kernel-mode drivers, the NtXxx and ZwXxx versions of a Windows Native System Services routine can behave differently in the way that they handle and interpret input parameters. For more information about the relationship between the NtXxx and ZwXxx versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.

Requirements

   
Minimum supported client Available in Windows Vista and later operating system versions.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL PASSIVE_LEVEL
DDI compliance rules PowerIrpDDis, HwStorPortProhibitedDDIs

See Also

ACCESS_MASK

InitializeObjectAttributes

OBJECT_ATTRIBUTES

Using Nt and Zw Versions of the Native System Services Routines

ZwClose

ZwCreateEnlistment

ZwCreateResourceManager

ZwOpenResourceManager

ZwQueryInformationEnlistment

ZwSetInformationEnlistment