Skip to content

DetourUpdateThread

Brian Gianforcaro edited this page Aug 28, 2020 · 8 revisions

DetourUpdateThread

Enlist a thread for update in the current transaction.

Definition

LONG DetourUpdateThread(
    _In_ HANDLE hThread
);

Parameters

hThread : The handle of the thread to be updated with the pending transaction. If hThread is equal to the current threads pseudo handle (as returned by GetCurrentThread()) no action is performed and NO_ERROR is returned.

Return value

Returns NO_ERROR if successful; otherwise, returns an error code.

Error codes

ERROR_NOT_ENOUGH_MEMORY : Not enough memory to record identity of thread.

Remarks

DetourUpdateThread enlists the specified thread for update when the current transaction, opened by the DetourTransactionBegin API, commits.

When a detour transaction commits, Detours insures that all threads enlisted in the transaction via the DetourUpdateThread API are updated if their instruction pointer lies within the rewritten code in either the target function or the trampoline function.

Threads not enlisted in the transaction are not updated when the transaction commits. As a result, they may attempt to execute an illegal combination of old and new code.

Calling DetourUpdateThread with a non-pseudo handle to the current thread is currently unsupported and will result in application hangs.

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.

Clone this wiki locally