Crate forward_dll

source ·
Expand description

forward-dll 是一个辅助构造转发 DLL 的库。

Examples

use forward_dll::ForwardModule;

#[derive(ForwardModule)]
#[forward(target = "C:\\Windows\\system32\\version.dll", ordinal)]
pub struct VersionModule;

const VERSION_LIB: VersionModule = VersionModule;

#[no_mangle]
pub extern "system" fn DllMain(_inst: isize, reason: u32, _: *const u8) -> u32 {
    if reason == 1 {
        println!("==> version.dll loaded");
        VERSION_LIB.init().unwrap();
        println!("==> version.dll initialized");
    }
    1
}

Modules

Macros

  • 生成转发的导出函数,以及初始化方法,须在 DllMain 中调用初始化方法,以使生成的函数指向转发的目标函数。

Structs

  • DLL 转发类型的具体实现。该类型不要自己实例化,应调用 forward_dll 宏生成具体的实例。

Enums

Traits

Type Definitions

Derive Macros

  • ForwardModule 派生宏。用于读取 DLL 的导出表,生成用于转发的导出函数。