CreateTransaction function

Creates a new transaction object.

Syntax

HANDLE CreateTransaction(
  IN LPSECURITY_ATTRIBUTES lpTransactionAttributes OPTIONAL,
  IN LPGUID UOW                                    OPTIONAL,
  IN DWORD CreateOptions                           OPTIONAL,
  IN DWORD IsolationLevel                          OPTIONAL,
  IN DWORD IsolationFlags                          OPTIONAL,
  IN DWORD Timeout                                 OPTIONAL,
  LPWSTR                                           Description
);

Parameters

OPTIONAL

OPTIONAL

OPTIONAL

OPTIONAL

OPTIONAL

OPTIONAL

Description

A user-readable description of 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:

Remarks

Use the CloseHandle function to close the transaction handle. If the last transaction handle is closed before a client calls the CommitTransaction function with the transaction handle, then KTM rolls back the transaction.

If the transaction might need to be promotable to a distributed transaction, then you must grant the Distributed Transaction Coordinator (DTC) access rights to enlist in the transaction. To do this, the lpTransactionAttributes parameter needs to contain an access control entry with the DTC’s SID (S-1-5-80-2818357584-3387065753-4000393942-342927828-138088443) and the TRANSACTION_ENLIST right. For more information, see Distributed Transaction Coordinator and Access Control Components.

Requirements

   
Windows version Windows Vista Windows Server 2008
Target Platform Windows
Header ktmw32.h
Library KtmW32.lib
DLL KtmW32.dll

See Also

CommitTransaction

Distributed Transaction Coordinator

Kernel Transaction Manager Functions

RollbackTransaction

SECURITY_ATTRIBUTES

SetTransactionInformation