NtOpenTransaction function

The ZwOpenTransaction routine obtains a handle to an existing transaction object.

Syntax

__kernel_entry NTSYSCALLAPI NTSTATUS NtOpenTransaction(
  PHANDLE            TransactionHandle,
  ACCESS_MASK        DesiredAccess,
  POBJECT_ATTRIBUTES ObjectAttributes,
  LPGUID             Uow,
  HANDLE             TmHandle
);

Parameters

TransactionHandle

A pointer to a caller-allocated variable that receives a handle to the transaction object if ZwOpenTransaction returns STATUS_SUCCESS.

DesiredAccess

An ACCESS_MASK value that specifies the caller's requested access to the transaction object. For information about how to specify this parameter, see the DesiredAccess parameter of ZwCreateTransaction.

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. The ObjectAttributes parameter is optional and can be NULL.

Uow

A pointer to a GUID that is a transaction object's unit of work (UOW) identifier. This GUID identifies the transaction object to open.

TmHandle

A handle to a transaction manager object. If this parameter is not NULL, KTM searches only for transaction objects that belong to the specified transaction manager object. If this parameter is NULL, KTM searches all transaction objects.

Return Value

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

Return code Description
STATUS_INVALID_PARAMETER
The DesiredAccess or Uow parameter was zero.
STATUS_OBJECT_TYPE_MISMATCH
The specified handle is not a handle to a transaction object.
STATUS_INVALID_HANDLE
An object handle is invalid.
STATUS_TRANSACTION_NOT_FOUND
KTM could not find the transaction object.
STATUS_ACCESS_DENIED
The value of the DesiredAccess parameter is invalid.

The routine might return other NTSTATUS values.

Remarks

Typically, a resource manager calls ZwOpenTransaction after it receives a transaction UOW from a transactional client that had previously called ZwCreateTransaction.

For more information about ZwOpenTransaction, see Creating a Resource Manager.

NtOpenTransaction and ZwOpenTransaction 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

   
Windows version 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

ZwCommitTransaction

ZwCreateTransaction

ZwQueryInformationTransaction

ZwRollbackTransaction