#ifndef _NTTMAPI_H
/**
* Updates KTM transaction properties. Use TransactionPropertiesInformation to change its
* description/deadline; do not use the Outcome field to commit/abort.
*
* \param TransactionHandle KTM handle with TRANSACTION_SET_INFORMATION (0x2).
* \param TransactionInformationClass Public property infoclass 1. The native implementation additionally
* accepts private/deprecated bind (4) and DTC opaque data (5), not basic (0), enlistments (2) or superior
* (3).
* \param TransactionInformation Readable caller-owned input copied before normal handle access validation.
* Native properties/bind input requires 4-byte alignment; the WoW64 properties helper copies to aligned
* temporary storage and accepts unaligned source input. Prefer natural alignment and do not rely on copyback.
* \param TransactionInformationLength Properties needs at least 32 bytes and enough space for
* DescriptionLength bytes beginning at offset 24. Description may be at most 128 bytes. Bind needs exactly 8
* native bytes (one manager handle); WoW64 accepts at least 4 source bytes and widens the handle. Private DTC
* data accepts 1 through 1024 native bytes; these private operations are not general application interfaces.
* \return STATUS_SUCCESS or failure. Properties shorter than 32 returns STATUS_INFO_LENGTH_MISMATCH. A
* declared description beyond the supplied input returns STATUS_INVALID_PARAMETER natively but
* STATUS_INFO_LENGTH_MISMATCH from the WoW64 precheck; description length above 128 is rejected by native
* code.
* \remarks Properties is not a wholesale replacement of every field. Outcome is ignored by the setter.
* DescriptionLength = 0 clears description, but Timeout = 0 preserves an existing timeout rather than
* disabling it. Nonzero isolation fields overwrite existing fields on the internal path; public callers
* should keep reserved isolation fields 0. The helper can update the description before a later timer
* operation fails, so do not assume universal all-or-nothing mutation on failure. Use the explicit outcome
* APIs.
* \sa https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-zwsetinformationtransaction
*/
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
NtSetInformationTransaction(
_In_ HANDLE TransactionHandle,
_In_ TRANSACTION_INFORMATION_CLASS TransactionInformationClass,
_In_reads_bytes_(TransactionInformationLength) PVOID TransactionInformation,
_In_ ULONG TransactionInformationLength
);
View code on GitHub#ifndef _NTZWAPI_H
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwSetInformationTransaction(
_In_ HANDLE TransactionHandle,
_In_ TRANSACTION_INFORMATION_CLASS TransactionInformationClass,
_In_reads_bytes_(TransactionInformationLength) PVOID TransactionInformation,
_In_ ULONG TransactionInformationLength
);
View code on GitHub// wdm.h
__kernel_entry NTSYSCALLAPI NTSTATUS NtSetInformationTransaction(
[in] HANDLE TransactionHandle,
[in] TRANSACTION_INFORMATION_CLASS TransactionInformationClass,
[in] PVOID TransactionInformation,
[in] ULONG TransactionInformationLength
);
View the official Windows Driver Kit DDI reference// wdm.h
NTSYSCALLAPI NTSTATUS ZwSetInformationTransaction(
[in] HANDLE TransactionHandle,
[in] TRANSACTION_INFORMATION_CLASS TransactionInformationClass,
[in] PVOID TransactionInformation,
[in] ULONG TransactionInformationLength
);
View the official Windows Driver Kit DDI referenceThe ZwSetInformationTransaction routine sets information for a specified transaction.
TransactionHandle [in]A handle to a transaction object that was obtained by a previous call to ZwCreateTransaction or ZwOpenTransaction. The handle must have TRANSACTION_SET_INFORMATION access to the object.
TransactionInformationClass [in]A TRANSACTION_INFORMATION_CLASS-typed value that specifies the type of information to set. The value must be TransactionPropertiesInformation.
TransactionInformation [in]A pointer to a caller-allocated buffer that contains the information to set. The buffer's structure type must be TRANSACTION_PROPERTIES_INFORMATION.
TransactionInformationLength [in]The length, in bytes, of the buffer that the TransactionInformation parameter points to.
ZwSetInformationTransaction returns STATUS_SUCCESS if the operation succeeds. Otherwise, this routine might return one of the following values:
| Return code | Description |
|---|---|
| STATUS_INVALID_INFO_CLASS | The TransactionInformationClass parameter's value is invalid. |
| STATUS_OBJECT_TYPE_MISMATCH | The handle that the TransactionHandle parameter specifies is not a handle to a transaction object. |
| STATUS_INVALID_HANDLE | An object handle is invalid. |
| STATUS_ACCESS_DENIED | The caller does not have appropriate access to the transaction object. |
| STATUS_INFO_LENGTH_MISMATCH | The TransactionInformationLength parameter's value is invalid. |
| STATUS_INVALID_PARAMETER | The contents of the buffer that the TransactionInformation buffer specifies is invalid. |
The routine might return other NTSTATUS values.
For more information about ZwSetInformationTransaction, see Creating a Transactional Client.
NtSetInformationTransaction and ZwSetInformationTransaction 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.
TRANSACTION_PROPERTIES_INFORMATION
Using Nt and Zw Versions of the Native System Services Routines
The ZwSetInformationTransaction routine sets information for a specified transaction.
TransactionHandle [in]A handle to a transaction object that was obtained by a previous call to ZwCreateTransaction or ZwOpenTransaction. The handle must have TRANSACTION_SET_INFORMATION access to the object.
TransactionInformationClass [in]A TRANSACTION_INFORMATION_CLASS-typed value that specifies the type of information to set. The value must be TransactionPropertiesInformation.
TransactionInformation [in]A pointer to a caller-allocated buffer that contains the information to set. The buffer's structure type must be TRANSACTION_PROPERTIES_INFORMATION.
TransactionInformationLength [in]The length, in bytes, of the buffer that the TransactionInformation parameter points to.
ZwSetInformationTransaction returns STATUS_SUCCESS if the operation succeeds. Otherwise, this routine might return one of the following values:
| Return code | Description |
|---|---|
| STATUS_INVALID_INFO_CLASS | The TransactionInformationClass parameter's value is invalid. |
| STATUS_OBJECT_TYPE_MISMATCH | The handle that the TransactionHandle parameter specifies is not a handle to a transaction object. |
| STATUS_INVALID_HANDLE | An object handle is invalid. |
| STATUS_ACCESS_DENIED | The caller does not have appropriate access to the transaction object. |
| STATUS_INFO_LENGTH_MISMATCH | The TransactionInformationLength parameter's value is invalid. |
| STATUS_INVALID_PARAMETER | The contents of the buffer that the TransactionInformation buffer specifies is invalid. |
The routine might return other NTSTATUS values.
For more information about ZwSetInformationTransaction, see Creating a Transactional Client.
NtSetInformationTransaction and ZwSetInformationTransaction 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.
TRANSACTION_PROPERTIES_INFORMATION
Using Nt and Zw Versions of the Native System Services Routines