NtOpenEnlistment function (wdm.h)
The ZwOpenEnlistment routine obtains a handle to an existing enlistment object.
Syntax
__kernel_entry NTSYSCALLAPI NTSTATUS NtOpenEnlistment(
[out] PHANDLE EnlistmentHandle,
[in] ACCESS_MASK DesiredAccess,
[in] HANDLE ResourceManagerHandle,
[in] LPGUID EnlistmentGuid,
[in, optional] POBJECT_ATTRIBUTES ObjectAttributes
);
Parameters
[out] EnlistmentHandle
A pointer to a caller-allocated variable that receives a handle to an enlistment object if the call to ZwOpenEnlistment succeeds.
[in] 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.
[in] ResourceManagerHandle
A handle to a resource manager object that was obtained by a previous call to ZwCreateResourceManager or ZwOpenResourceManager.
[in] EnlistmentGuid
A pointer to a GUID that identifies the enlistment. For more information, see the following Remarks section.
[in, optional] 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 |
---|---|
|
The object handle is invalid. |
|
The caller does not have appropriate access to the enlistment object. |
|
The DesiredAccess parameter's value is zero, or the EnlistmentGuid parameter's value is NULL. |
|
The enlistment that the EnlistmentGuid parameter specifies does not exist for the resource manager that the RmHandle parameter specifies. |
|
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
Requirement | Value |
---|---|
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 | HwStorPortProhibitedDDIs, PowerIrpDDis |
See also
Using Nt and Zw Versions of the Native System Services Routines