Skip to content

Commit f68520b

Browse files
committed
updating version
1 parent c61fc9a commit f68520b

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

crates/libmwemu/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "libmwemu"
3-
version = "0.22.1"
3+
version = "0.22.2"
44
edition = "2018"
55
authors = ["sha0coder"]
66
license = "MIT"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
use crate::emu;
2+
use crate::constants;
3+
4+
pub fn api_DeviceIoControl(emu: &mut emu::Emu) {
5+
let hDevice = emu.regs().rcx;
6+
let dwIoControlCode = emu.regs().rdx;
7+
let lpInBuffer = emu.regs().r8;
8+
let lpOutBuffer = emu.regs().r9;
9+
let rsp = emu.regs().rsp;
10+
let nOutBufferSize = emu.maps.read_qword(rsp + 0x20).expect("DeviceIoControl arg6 stack error.");
11+
let lpBytesReturned = emu.maps.read_qword(rsp + 0x28).expect("DeviceIoControl arg7 stack error.");
12+
13+
log_red!(emu, "kernel32!DeviceIoControl hDev: 0x{:x} code: 0x{:x} buff: 0x{:x}", hDevice, dwIoControlCode, lpInBuffer);
14+
15+
emu.regs_mut().rax = constants::TRUE;
16+
}

crates/libmwemu/src/winapi/winapi64/kernel32/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ pub mod win_exec;
178178
pub mod write_console_w;
179179
pub mod write_file;
180180
pub mod write_process_memory;
181+
pub mod device_io_control;
181182
mod local_free;
182183

183184
// Re-export all functions
@@ -354,6 +355,7 @@ pub use write_console_w::WriteConsoleW;
354355
pub use write_file::WriteFile;
355356
pub use write_process_memory::WriteProcessMemory;
356357
pub use local_free::LocalFree;
358+
pub use device_io_control::api_DeviceIoControl;
357359

358360
// a in RCX, b in RDX, c in R8, d in R9, then e pushed on stack
359361

@@ -539,6 +541,7 @@ pub fn gateway(addr: u64, emu: &mut emu::Emu) -> String {
539541
"WriteConsoleW" => WriteConsoleW(emu),
540542
"WriteFile" => WriteFile(emu),
541543
"WriteProcessMemory" => WriteProcessMemory(emu),
544+
"DeviceIoControl" => api_DeviceIoControl(emu),
542545
_ => {
543546
if emu.cfg.skip_unimplemented == false {
544547
if emu.cfg.dump_on_exit && emu.cfg.dump_filename.is_some() {

crates/mwemu/src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ fn main() {
135135
.arg(clap_arg!("call", "", "call", "enable call tracer"))
136136
.arg(clap_arg!("cmd", "", "cmd", "launch a console command", "COMMAND"))
137137
.arg(clap_arg!("entropy", "", "entropy", "display changes in the entropy"))
138+
.arg(clap_arg!("multithread", "", "multithread", "enable multithread emulation"))
138139
.get_matches();
139140

140141
if !matches.is_present("filename") {
@@ -340,6 +341,10 @@ fn main() {
340341
emu.fpu_mut().mxcsr = value as u32;
341342
}
342343

344+
if matches.is_present("multithread") {
345+
emu.cfg.enable_threading = true;
346+
}
347+
343348
// endpoint
344349
if matches.is_present("endpoint") {
345350
//TODO: emu::endpoint::warning();

0 commit comments

Comments
 (0)