This repository was archived by the owner on Dec 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwinapi64.rs
47 lines (42 loc) · 1.48 KB
/
winapi64.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
mod advapi32;
mod comctl64;
mod dnsapi;
pub mod kernel32;
mod ntdll;
mod shell32;
mod user32;
mod winhttp;
mod wininet;
mod ws2_32;
mod shlwapi;
mod kernelbase;
use crate::emu;
pub fn gateway(addr: u64, name: String, emu: &mut emu::Emu) {
log::info!("winapi64::gateway called with addr: 0x{:x}, name: {}", addr, name);
let unimplemented_api = match name.as_str() {
"kernel32.text" => kernel32::gateway(addr, emu),
"kernel32.rdata" => kernel32::gateway(addr, emu),
"ntdll.text" => ntdll::gateway(addr, emu),
"user32.text" => user32::gateway(addr, emu),
"ws2_32.text" => ws2_32::gateway(addr, emu),
"wininet.text" => wininet::gateway(addr, emu),
"advapi32.text" => advapi32::gateway(addr, emu),
"winhttp.text" => winhttp::gateway(addr, emu),
"dnsapi.text" => dnsapi::gateway(addr, emu),
"comctl32.text" => comctl64::gateway(addr, emu),
"shell32.text" => shell32::gateway(addr, emu),
"shlwapi.text" => shlwapi::gateway(addr, emu),
"kernelbase.text" => kernelbase::gateway(addr, emu),
"not_loaded" => {
emu.pe64.as_ref().unwrap().import_addr_to_name(addr)
}
_ => panic!("/!\\ trying to execute on {} at 0x{:x}", name, addr),
};
if unimplemented_api.len() > 0 {
log::info!(
"{}({}, {}, {}, {}) (unimplemented)",
unimplemented_api, emu.regs.rcx, emu.regs.rdx, emu.regs.r8, emu.regs.r9
);
emu.regs.rax = 1;
}
}