#ifndef _NTTMAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
NtRecoverEnlistment(
_In_ HANDLE EnlistmentHandle,
_In_opt_ PVOID EnlistmentKey
);
View code on GitHub#ifndef _NTZWAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwRecoverEnlistment(
_In_ HANDLE EnlistmentHandle,
_In_opt_ PVOID EnlistmentKey
);
View code on GitHub// wdm.h
__kernel_entry NTSYSCALLAPI NTSTATUS NtRecoverEnlistment(
[in] HANDLE EnlistmentHandle,
[in, optional] PVOID EnlistmentKey
);
View the official Windows Driver Kit DDI reference// wdm.h
NTSYSCALLAPI NTSTATUS ZwRecoverEnlistment(
[in] HANDLE EnlistmentHandle,
[in, optional] PVOID EnlistmentKey
);
View the official Windows Driver Kit DDI referenceThe ZwRecoverEnlistment routine initiates a recovery operation for the transaction that is associated with a specified enlistment.
EnlistmentHandle [in]A handle to an enlistment object that was obtained by a previous call to ZwCreateEnlistment or ZwOpenEnlistment. The handle must have ENLISTMENT_RECOVER access to the object.
EnlistmentKey [in, optional]A pointer to the enlistment key value that the resource manager previously specified as the EnlistmentKey parameter to ZwCreateEnlistment. This parameter is optional and can be NULL if the resource manager did not provide an enlistment key when it called ZwCreateEnlistment.
ZwRecoverEnlistment returns STATUS_SUCCESS if the operation succeeds. Otherwise, this routine might return one of the following values:
| Return code | Description |
|---|---|
| STATUS_OBJECT_TYPE_MISMATCH | The specified handle is not a handle to an enlistment object. |
| STATUS_INVALID_HANDLE | The object handle is invalid. |
| STATUS_TRANSACTION_REQUEST_NOT_VALID | The transaction or its enlistment is not in the correct state. |
| STATUS_PENDING | KTM has added a commit, rollback, or in-doubt notification to the resource manager's notification queue, and the resource manager is not using a ResourceManagerNotification callback routine. |
| STATUS_ACCESS_DENIED | The caller does not have appropriate access to the enlistment object. |
The routine might return other NTSTATUS values.
After a resource manager calls ZwRecoverEnlistment, KTM delivers either a TRANSACTION_NOTIFY_COMMIT, TRANSACTION_NOTIFY_ROLLBACK, or TRANSACTION_NOTIFY_INDOUBT notification for the enlistment. Therefore, unless the resource manager is using a ResourceManagerNotification callback routine, it must immediately call ZwGetNotificationResourceManager if ZwRecoverEnlistment returns STATUS_SUCCESS or STATUS_PENDING.
For more information about ZwRecoverEnlistment, see Handling Recovery Operations.
NtRecoverEnlistment and ZwRecoverEnlistment are two versions of the same Windows Native System Services routine.
For calls from kernel-mode drivers, the Nt*Xxx* and Zw*Xxx* 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 Nt*Xxx* and Zw*Xxx* versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.
Using Nt and Zw Versions of the Native System Services Routines
ZwGetNotificationResourceManager
The ZwRecoverEnlistment routine initiates a recovery operation for the transaction that is associated with a specified enlistment.
EnlistmentHandle [in]A handle to an enlistment object that was obtained by a previous call to ZwCreateEnlistment or ZwOpenEnlistment. The handle must have ENLISTMENT_RECOVER access to the object.
EnlistmentKey [in, optional]A pointer to the enlistment key value that the resource manager previously specified as the EnlistmentKey parameter to ZwCreateEnlistment. This parameter is optional and can be NULL if the resource manager did not provide an enlistment key when it called ZwCreateEnlistment.
ZwRecoverEnlistment returns STATUS_SUCCESS if the operation succeeds. Otherwise, this routine might return one of the following values:
| Return code | Description |
|---|---|
| STATUS_OBJECT_TYPE_MISMATCH | The specified handle is not a handle to an enlistment object. |
| STATUS_INVALID_HANDLE | The object handle is invalid. |
| STATUS_TRANSACTION_REQUEST_NOT_VALID | The transaction or its enlistment is not in the correct state. |
| STATUS_PENDING | KTM has added a commit, rollback, or in-doubt notification to the resource manager's notification queue, and the resource manager is not using a ResourceManagerNotification callback routine. |
| STATUS_ACCESS_DENIED | The caller does not have appropriate access to the enlistment object. |
The routine might return other NTSTATUS values.
After a resource manager calls ZwRecoverEnlistment, KTM delivers either a TRANSACTION_NOTIFY_COMMIT, TRANSACTION_NOTIFY_ROLLBACK, or TRANSACTION_NOTIFY_INDOUBT notification for the enlistment. Therefore, unless the resource manager is using a ResourceManagerNotification callback routine, it must immediately call ZwGetNotificationResourceManager if ZwRecoverEnlistment returns STATUS_SUCCESS or STATUS_PENDING.
For more information about ZwRecoverEnlistment, see Handling Recovery Operations.
NtRecoverEnlistment and ZwRecoverEnlistment are two versions of the same Windows Native System Services routine.
For calls from kernel-mode drivers, the Nt*Xxx* and Zw*Xxx* 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 Nt*Xxx* and Zw*Xxx* versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.
Using Nt and Zw Versions of the Native System Services Routines
ZwGetNotificationResourceManager