Skip to content

Commit c235c00

Browse files
committed
getacp
1 parent d6cbf88 commit c235c00

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

libmwemu/src/emu/winapi32/kernel32.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ use crate::emu::winapi32::helper;
99
use lazy_static::lazy_static;
1010
use std::sync::Mutex;
1111

12+
macro_rules! log_red {
13+
($emu:expr, $($arg:tt)*) => {
14+
log::info!(
15+
"{}{}{}",
16+
$emu.colors.light_red,
17+
format!($($arg)*),
18+
$emu.colors.nc
19+
);
20+
};
21+
}
22+
1223
pub fn gateway(addr: u32, emu: &mut emu::Emu) -> String {
1324
let api = guess_api_name(emu, addr);
1425
match api.as_str() {
@@ -2366,13 +2377,10 @@ fn TlsGetValue(emu: &mut emu::Emu) {
23662377
emu.regs.set_eax(emu.tls32[idx as usize] as u64);
23672378
}
23682379

2369-
log::info!(
2370-
"{}** {} kernel32!TlsGetValue idx: {} =0x{:x} {}",
2371-
emu.colors.light_red,
2380+
log_red!(emu, "** {} kernel32!TlsGetValue idx: {} =0x{:x}",
23722381
emu.pos,
23732382
idx,
2374-
emu.regs.get_eax() as u32,
2375-
emu.colors.nc
2383+
emu.regs.get_eax() as u32
23762384
);
23772385
}
23782386

libmwemu/src/emu/winapi64/kernel32.rs

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ use crate::emu::context64;
1010
use lazy_static::lazy_static;
1111
use std::sync::Mutex;
1212

13+
macro_rules! log_red {
14+
($emu:expr, $($arg:tt)*) => {
15+
log::info!(
16+
"{}{}{}",
17+
$emu.colors.light_red,
18+
format!($($arg)*),
19+
$emu.colors.nc
20+
);
21+
};
22+
}
23+
1324
// a in RCX, b in RDX, c in R8, d in R9, then e pushed on stack
1425

1526
pub fn gateway(addr: u64, emu: &mut emu::Emu) -> String {
@@ -141,6 +152,7 @@ pub fn gateway(addr: u64, emu: &mut emu::Emu) -> String {
141152
"TlsSetValue" => TlsSetValue(emu),
142153
"TlsGetValue" => TlsGetValue(emu),
143154
"TlsFree" => TlsFree(emu),
155+
"GetACP" => GetACP(emu),
144156

145157
_ => {
146158
unimplemented!(
@@ -2923,12 +2935,23 @@ fn TlsGetValue(emu: &mut emu::Emu) {
29232935

29242936
emu.regs.rax = val;
29252937

2938+
log_red!(emu, "** {} kernel32!TlsGetValue idx: {} =0x{:x}",
2939+
emu.pos,
2940+
idx,
2941+
val
2942+
);
2943+
}
2944+
2945+
/*
2946+
UINT GetACP();
2947+
*/
2948+
// TODO: there is GetAcp and GetACP?
2949+
fn GetACP(emu: &mut emu::Emu) {
29262950
log::info!(
2927-
"{}** {} kernel32!TlsGetValue idx: {} =0x{:x} {}",
2951+
"{}** {} kernel32!GetACP {}",
29282952
emu.colors.light_red,
29292953
emu.pos,
2930-
idx,
2931-
val,
29322954
emu.colors.nc
29332955
);
2934-
}
2956+
emu.regs.rax = 0x00000409;
2957+
}

0 commit comments

Comments
 (0)