Skip to main content

intercept_assembly

Function intercept_assembly 

Source
pub fn intercept_assembly(
    basename: &str,
    patch: impl Fn(&[u8]) -> Result<Vec<u8>> + Send + Sync + 'static,
)
Expand description

Serves a rewritten copy of basename (matched by file name) whenever the runtime opens it. patch receives the original bytes and returns the replacement (see patch_call). Call it from a mod’s entry point, before the runtime loads the assembly.

The file-open hooks are NOT installed immediately — they are armed by arm (called automatically from coreclr_init_detour after coreclr_initialize returns). This avoids the open/openat hooks interfering with dlopen during early game startup.