Bewerken

Delen via


ZwOpenResourceManager function (wdm.h)

The ZwOpenResourceManager routine returns a handle to an existing resource manager object.

Syntax

NTSYSCALLAPI NTSTATUS ZwOpenResourceManager(
  [out]          PHANDLE            ResourceManagerHandle,
  [in]           ACCESS_MASK        DesiredAccess,
  [in]           HANDLE             TmHandle,
  [in]           LPGUID             ResourceManagerGuid,
  [in, optional] POBJECT_ATTRIBUTES ObjectAttributes
);

Parameters

[out] ResourceManagerHandle

A pointer to a caller-allocated variable that receives the resource manager handle if the call to ZwOpenResourceManager succeeds.

[in] DesiredAccess

An ACCESS_MASK value that specifies the caller's requested access to the resource manager object. For more information about how to specify this parameter, see the DesiredAccess parameter of ZwCreateResourceManager. This parameter cannot be zero.

[in] TmHandle

A handle to a transaction manager object that was obtained by a previous call to ZwCreateTransactionManager or ZwOpenTransactionManager.

[in] ResourceManagerGuid

A pointer to the GUID that identifies the resource manager to open.

[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

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

Return code Description
STATUS_OBJECT_TYPE_MISMATCH
The handle that TmHandle specifies is not a handle to a transaction object.
STATUS_INVALID_HANDLE
The handle that TmHandle specifies is invalid.
STATUS_ACCESS_DENIED
The caller does not have appropriate access to the specified transaction manager object.
STATUS_INVALID_PARAMETER
The DesiredAccess parameter is zero or the ResourceManagerGuid parameter is invalid.
STATUS_RESOURCEMANAGER_NOT_FOUND
The specified resource manager could not be found.
STATUS_TRANSACTIONMANAGER_NOT_ONLINE
The specified transaction manager is not online.
 

The routine might return other NTSTATUS values.

Remarks

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

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

For more information about ZwOpenResourceManager, see KTM Objects.

NtOpenResourceManager and ZwOpenResourceManager 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(storport), PowerIrpDDis(wdm)

See also

InitializeObjectAttributes

OBJECT_ATTRIBUTES

Using Nt and Zw Versions of the Native System Services Routines

ZwClose

ZwCreateResourceManager

ZwCreateTransactionManager

ZwOpenTransactionManager