Method

GumInterceptorreplace_fast

Declaration [src]

GumReplaceReturn
gum_interceptor_replace_fast (
  GumInterceptor* self,
  gpointer function_address,
  gpointer replacement_function,
  gpointer* original_function,
  const GumInterceptorOptions* options
)

Description [src]

Like gum_interceptor_replace(), but trades flexibility for speed by patching function_address to branch straight to replacement_function with no trampoline in between. A trampoline is only involved if you ask for original_function, which you must use to reach the original — unlike gum_interceptor_replace(), calling function_address again would just re-enter the replacement. A target replaced this way cannot also be attached to; use gum_interceptor_replace() if you need that.

Prefer this when the hook is on a hot path and the extra machinery of the default replacement is not needed.

Parameters

function_address

Type: gpointer

Address of the function to replace.

The data is owned by the caller of the method.
replacement_function

Type: gpointer

Address of the replacement.

The data is owned by the caller of the method.
original_function

Type: gpointer*

Return location for a pointer through which the original function can still be called, or NULL.

The argument will be set by the function.
The argument can be set to NULL by the method.
The argument can be NULL.
options

Type: GumInterceptorOptions

Instrumentation options, or NULL for the defaults.

The argument can be NULL.
The data is owned by the caller of the method.

Return value

Type: GumReplaceReturn

GUM_REPLACE_OK on success, or another GumReplaceReturn describing why the function could not be instrumented.