A64HookFunction

Function A64HookFunction 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn A64HookFunction( symbol: *mut c_void, replace: *mut c_void, result: *mut *mut c_void, )
Expand description

ARM64-specific hook function (alias for MSHookFunction).

This function is provided for compatibility with And64InlineHook API. On ARM64 platforms, it behaves identically to MSHookFunction.

ยงSafety

Same safety requirements as MSHookFunction. See MSHookFunction for details.

Examples found in repository?
examples/multi_arch.rs (lines 33-37)
10fn main() {
11    println!("=== Multi-Architecture Hook Example ===\n");
12
13    #[cfg(target_arch = "x86_64")]
14    println!("Architecture: x86-64 (64-bit Intel/AMD)");
15
16    #[cfg(target_arch = "x86")]
17    println!("Architecture: x86 (32-bit Intel/AMD)");
18
19    #[cfg(target_arch = "arm")]
20    println!("Architecture: ARMv7 (32-bit ARM with Thumb)");
21
22    #[cfg(target_arch = "aarch64")]
23    println!("Architecture: ARM64/AArch64 (64-bit ARM)");
24
25    println!("\nThis example shows architecture-specific behavior.\n");
26
27    unsafe {
28        let target: *mut c_void = std::ptr::null_mut();
29
30        #[cfg(target_arch = "aarch64")]
31        {
32            println!("Using A64HookFunction for ARM64...");
33            substrate::A64HookFunction(
34                target,
35                my_hook as *mut c_void,
36                &mut ORIGINAL
37            );
38        }
39
40        #[cfg(not(target_arch = "aarch64"))]
41        {
42            println!("Using MSHookFunction...");
43            substrate::MSHookFunction(
44                target,
45                my_hook as *mut c_void,
46                &mut ORIGINAL
47            );
48        }
49
50        println!("Hook API called successfully!");
51        println!("\nNote: This example uses null pointers for demonstration.");
52        println!("In real usage, provide valid function addresses.");
53    }
54}