core/win32/callback.c
/* This function provides an interface to hook any instruction in a loaded
 * module.  For now, the consumer is hotp_only.
 */
This function provides an interface to hook any instruction in a loaded
module.  For now, the consumer is hotp_only.
This function provides an interface to hook any instruction in a loaded module . For now the consumer is hotp_only .
byte *
hook_text(byte *hook_code_buf, const app_pc image_addr, 
          intercept_function_t hook_func, const void *callee_arg, 
          const after_intercept_action_t action_after,
          const bool abort_if_hooked, const bool ignore_cti,
          byte **app_code_copy_p, byte **alt_exit_cti_p)
{
    byte *res;
    ASSERT(DYNAMO_OPTION(hotp_only));
    ASSERT(hook_code_buf != NULL && image_addr != NULL && hook_func != NULL);
    ASSERT_CURIOSITY(is_in_code_section(get_module_base(image_addr), image_addr,
                                        NULL, NULL));
    res = intercept_call(hook_code_buf, image_addr, hook_func, (void *) callee_arg,
                          false, action_after,
                          abort_if_hooked, ignore_cti,
                          app_code_copy_p, alt_exit_cti_p);
    ASSERT(res != NULL);
    ASSERT(app_code_copy_p == NULL || *app_code_copy_p != NULL);
    ASSERT(action_after != AFTER_INTERCEPT_DYNAMIC_DECISION ||
           alt_exit_cti_p == NULL || *app_code_copy_p != NULL);
    return res;
}
byte * hook_text ( byte * hook_code_buf , const app_pc image_addr , intercept_function_t hook_func , const void * callee_arg , const after_intercept_action_t action_after , const bool abort_if_hooked , const bool ignore_cti , byte * * app_code_copy_p , byte * * alt_exit_cti_p ) { byte * res ; ASSERT ( DYNAMO_OPTION ( hotp_only ) ) ; ASSERT ( hook_code_buf != NULL && image_addr != NULL && hook_func != NULL ) ; ASSERT_CURIOSITY ( is_in_code_section ( get_module_base ( image_addr ) , image_addr , NULL , NULL ) ) ; res = intercept_call ( hook_code_buf , image_addr , hook_func , ( void * ) callee_arg , false , action_after , abort_if_hooked , ignore_cti , app_code_copy_p , alt_exit_cti_p ) ; ASSERT ( res != NULL ) ; ASSERT ( app_code_copy_p == NULL || * app_code_copy_p != NULL ) ; ASSERT ( action_after != AFTER_INTERCEPT_DYNAMIC_DECISION || alt_exit_cti_p == NULL || * app_code_copy_p != NULL ) ; return res ; }
This function provides an interface to hook any instruction in a loaded
 module.
This function provides an interface to hook any instruction in a loaded module .
/* Currently hotp_only is the only user for this.  However if any other 
     * module wants to use this, we better find out if they are trying to hook 
     * something other than the .text section; note, it will still hook if it 
     * isn't the text section. 
     */ /* use dr stack now, later on hotp stack - FIXME */ /* Hooking can only fail if there was a cti at the patch region.  There 
     * better not be any there!
     */ /* If app_code_copy_p isn't null, then *app_code_copy_p can't be null;
     * same for alt_exit_cti_p if after_action is dynamic decision.
     */