-
Notifications
You must be signed in to change notification settings - Fork 1k
DetourAttachEx
Attach a detour to a target function and retrieve additional detail about the ultimate target.
LONG DetourAttachEx(
_Inout_ PVOID * ppPointer,
_In_ PVOID pDetour,
_Out_opt_ PDETOUR_TRAMPOLINE * ppRealTrampoline
_Out_opt_ PVOID * ppRealTarget
_Out_opt_ PVOID * ppRealDetour
);
ppPointer : Pointer to the target pointer to which the detour will be attached. See the remarks section below for additional considerations.
pDetour : Pointer to the detour function.
ppRealTrampoline : Variable to optionally receive the address of the trampoline.
ppRealTarget : Variable to optionally receive the final address of the target function.
ppRealDetour : Variable to optionally receive the final address of the detour function.
Returns NO_ERROR if successful; otherwise, returns an error code.
ERROR_INVALID_BLOCK : The function referenced is too small to be detoured.
ERROR_INVALID_HANDLE
: The ppPointer
parameter is NULL or points to a
NULL` pointer.
ERROR_INVALID_OPERATION : No pending transaction exists.
ERROR_NOT_ENOUGH_MEMORY : Not enough memory exists to complete the operation.
Warning: The variable pointed to by the ppPointer
argument must remain alive for the duration of the transaction, that is until DetourTransactionCommit
, DetourTransactionCommitEx
or DetourTransactionAbort
is called.
DetourAttachEx
attaches a detour to a target function and retrieves
additional detail about the ultimate target as part of the current
transaction opened by the DetourTransactionBegin
API.
For more information on using Detours to intercept function calls, see Interception of Binary Functions or Using Detours in the Detours Overview.