Windows API Reference

Microsoft Transacted File System (TXF) Documentation

CreateTransaction Function

Creates a new transaction object. A transaction object is a handle that represents a transaction.

Syntax


HANDLE CreateTransaction(
  LPTRANSACTION_BASIC_INFORMATION TransactionBasicInformation,
  TRANSACTION_NOTIFICATION_CLASS NotificationClass,
  PTRANSACTION_VETO_PARTICIPATION_CALLBACK VetoTransaction,
  PTRANSACTION_SAVEPOINT_NOTIFICATION TransactionSavePoint,
  ULONG Timeout,
  LPWSTR TransactionName
);
                

Parameters

Parameter Description
TransactionBasicInformation A pointer to a TRANSACTION_BASIC_INFORMATION structure that contains basic transaction information. This parameter can be NULL.
NotificationClass The type of notifications the caller is interested in. This parameter can be one of the following values:
  • TRANSACTION_NOTIFY_VETO_PARTICIPATION
  • TRANSACTION_NOTIFY_SAVEPOINT_RETURN
  • TRANSACTION_NOTIFY_PREPARE
  • TRANSACTION_NOTIFY_COMMIT_REQUEST
  • TRANSACTION_NOTIFY_ROLLBACK
  • TRANSACTION_NOTIFY_COMMIT_PERFORMED
VetoTransaction A pointer to a callback function that is called when the transaction is vetoed. This parameter can be NULL.
TransactionSavePoint A pointer to a callback function that is called when a save point is created or rolled back. This parameter can be NULL.
Timeout The timeout value for the transaction in milliseconds. If this parameter is 0, the transaction has no timeout.
TransactionName A pointer to a null-terminated string that specifies the name of the transaction. This parameter can be NULL.

Return Value

If the function succeeds, it returns a handle to the transaction object. If the function fails, it returns NULL. To get extended error information, call GetLastError.

Remarks

The CreateTransaction function creates a new transaction object. A transaction object is a handle that represents a transaction. Transactions are used to ensure atomicity, consistency, isolation, and durability (ACID properties) for a set of operations. When you are finished with the transaction handle, you must close it by calling the CloseHandle function.

Requirements

Attribute Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Header ktm.h (include windows.h)
Library Ktm.lib
DLL Ktmw32.dll

See Also