OpenTransaction function (ktmw32.h)

Opens an existing transaction.


HANDLE OpenTransaction(
  [in] DWORD  dwDesiredAccess,
  [in] LPGUID TransactionId


[in] dwDesiredAccess

The access to the transaction object. You must have read and write access to work with a transaction. See Transaction Access Masks for a list of valid values.

[in] TransactionId

The GUID that identifies the transaction to be opened. This is commonly referred to as a unit of work for the transaction.

Return value

If the function succeeds, the return value is a handle to the transaction.

If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call the GetLastError function.

The following list identifies the possible error codes:


Clients close the transaction handle by using the CloseHandle function. If the last transaction handle is closed without anyone calling the CommitTransaction function on the transaction, then the KTM implicitly rolls back the transaction.


Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header ktmw32.h
Library Ktmw32.lib
DLL Ktmw32.dll

See also



Kernel Transaction Manager Functions


Transaction Access Masks