NtOpenResourceManager - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTTMAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
NtOpenResourceManager(
    _Out_ PHANDLE ResourceManagerHandle,
    _In_ ACCESS_MASK DesiredAccess,
    _In_ HANDLE TmHandle,
    _In_opt_ LPGUID ResourceManagerGuid,
    _In_opt_ POBJECT_ATTRIBUTES ObjectAttributes
    );

#endif

View code on GitHub
#ifndef _NTZWAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
ZwOpenResourceManager(
    _Out_ PHANDLE ResourceManagerHandle,
    _In_ ACCESS_MASK DesiredAccess,
    _In_ HANDLE TmHandle,
    _In_opt_ LPGUID ResourceManagerGuid,
    _In_opt_ POBJECT_ATTRIBUTES ObjectAttributes
    );

#endif

View code on GitHub
// wdm.h

__kernel_entry NTSYSCALLAPI NTSTATUS NtOpenResourceManager(
  [out]          PHANDLE            ResourceManagerHandle,
  [in]           ACCESS_MASK        DesiredAccess,
  [in]           HANDLE             TmHandle,
  [in]           LPGUID             ResourceManagerGuid,
  [in, optional] POBJECT_ATTRIBUTES ObjectAttributes
);
View the official Windows Driver Kit DDI reference
// wdm.h

NTSYSCALLAPI NTSTATUS ZwOpenResourceManager(
  [out]          PHANDLE            ResourceManagerHandle,
  [in]           ACCESS_MASK        DesiredAccess,
  [in]           HANDLE             TmHandle,
  [in]           LPGUID             ResourceManagerGuid,
  [in, optional] POBJECT_ATTRIBUTES ObjectAttributes
);
View the official Windows Driver Kit DDI reference

NtDoc

This function is documented in Windows Driver Kit here and here.

Windows Driver Kit DDI reference (nf-wdm-ntopenresourcemanager)

NtOpenResourceManager function

Description

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

Parameters

ResourceManagerHandle [out]

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

DesiredAccess [in]

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.

TmHandle [in]

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

ResourceManagerGuid [in]

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

ObjectAttributes [in, optional]

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 Nt*Xxx* and Zw*Xxx* 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 Nt*Xxx* and Zw*Xxx* versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.

See also

InitializeObjectAttributes

OBJECT_ATTRIBUTES

Using Nt and Zw Versions of the Native System Services Routines

ZwClose

ZwCreateResourceManager

ZwCreateTransactionManager

ZwOpenTransactionManager


Windows Driver Kit DDI reference (nf-wdm-zwopenresourcemanager)

ZwOpenResourceManager function

Description

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

Parameters

ResourceManagerHandle [out]

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

DesiredAccess [in]

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.

TmHandle [in]

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

ResourceManagerGuid [in]

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

ObjectAttributes [in, optional]

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 Nt*Xxx* and Zw*Xxx* 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 Nt*Xxx* and Zw*Xxx* versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.

See also

InitializeObjectAttributes

OBJECT_ATTRIBUTES

Using Nt and Zw Versions of the Native System Services Routines

ZwClose

ZwCreateResourceManager

ZwCreateTransactionManager

ZwOpenTransactionManager