Skip to content

DetourAttachEx

Brian Gianforcaro edited this page Aug 22, 2020 · 6 revisions

DetourAttachEx

Attach a detour to a target function and retrieve additional detail about the ultimate target.

Definition

LONG DetourAttachEx(
    _Inout_   PVOID * ppPointer,
    _In_      PVOID pDetour,
    _Out_opt_ PDETOUR_TRAMPOLINE * ppRealTrampoline
    _Out_opt_ PVOID * ppRealTarget
    _Out_opt_ PVOID * ppRealDetour
);

Parameters

ppPointer : Pointer to the target pointer to which the detour will be attached.

pDetour : Pointer to the detour function.

ppRealTrampoline : Variable to receive the address of the trampoline.

ppRealTarget : Variable to receive the final address of the target function.

ppRealDetour : Variable to receive the final address of the detour function.

Return value

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

Error codes

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.

Remarks

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.

Related Samples

dynamic_alloc, Tracebld.

Clone this wiki locally