DetourTransactionBegin

Microsoft Research Detours

DetourTransactionBegin

Begin a new transaction for attaching or detaching detours.

Definition

LONG DetourTransactionBegin(VOID);

Return value

Returns NO_ERROR if successful; otherwise returns ERROR_INVALID_OPERATION.

Error codes

ERROR_INVALID_OPERATION
A pending transaction alrady exists.

Remarks

DetourTransactionBegin begins a new transaction for attaching or detaching detours.

After beginning a transaction, a program calls the DetourAttach or DetourAttachEx API to attach a detour to a target function, calls the DetourDetach API to detach a detour from a target function, or calls the DetourUpdateThread API to include include a thread in the transaction update.

The attach, detach, and thread operations do not take effect until the program commits the transaction using the DetourTransactionCommit or DetourTransactionCommitEx API. Alternatively, the program can abort the transaction using the DetourTransactionAbort API.

For more information on using Detours to intercept function calls, see Interception of Binary Functions or Using Detours in the Detours Overview.

Related Samples

Commem, Cping, Dtest, Excep, FindFunc, Member, Simple, Slept, Traceapi, Tracebld, Tracelnk, Tracemem, Tracereg, Traceser, Tracetcp, Tryman.