-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_is_direct_path.idc
More file actions
76 lines (64 loc) · 2.21 KB
/
debug_is_direct_path.idc
File metadata and controls
76 lines (64 loc) · 2.21 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include <idc.idc>
#include "lib/lib.idc"
static handle_is_direct_path() {
Message("\n\n\n");
auto dst_ptr = GetRegValue("eax");
auto src_ptr = GetRegValue("ecx");
Message("(%d, %d) -> (%d, %d)\n",
Word(src_ptr + 0x00),
Word(src_ptr + 0x02),
Word(dst_ptr + 0x00),
Word(dst_ptr + 0x02)
);
}
static handle_is_direct_path_cell_check_loop() {
auto esp = GetRegValue("esp");
auto dx_increment = TO_LONG(Dword(esp + 0x14 + 0x10));
auto dy_increment = TO_LONG(GetRegValue("ebx"));
auto check_type = "";
auto ebp = GetRegValue("ebp");
auto eax = GetRegValue("eax");
if (ebp >= eax) {
check_type = "east-west";
} else {
check_type = "north-south";
}
//Message("dx_increment = %d, dy_increment=%d, check_type=%s\n", dx_increment, dy_increment, check_type);
return 0;
}
static handle_assert_water_cell_1() {
auto esp = GetRegValue("esp");
auto base = Dword(esp + 0x14 + 0x04);
auto width = Dword(Dword(esp + 0x14 + 0x08));
auto ecx = GetRegValue("ecx");
auto bytes_offset = ecx - base;
auto x = bytes_offset % width;
auto y = bytes_offset / width;
Message("Checking cell (east-west 1) (%d, %d)\n", x, y);
}
static handle_assert_water_cell_2() {
auto ecx = GetRegValue("ecx");
Message("Checking cell (north-south) %x\n", ecx);
}
static handle_assert_water_cell_3() {
auto esp = GetRegValue("esp");
auto base = Dword(esp + 0x14 + 0x04);
auto width = Dword(Dword(esp + 0x14 + 0x08));
auto ecx = GetRegValue("ecx");
auto bytes_offset = ecx - base;
auto x = bytes_offset % width;
auto y = bytes_offset / width;
Message("Checking cell (east-west 2) (%d, %d)\n", x, y);
}
static main() {
AddBpt(0x004445A9);
SetBptCnd(0x004445A9, "handle_is_direct_path()");
AddBpt(0x00444767);
SetBptCnd(0x00444767, "handle_is_direct_path_cell_check_loop()");
AddBpt(0x00444793);
SetBptCnd(0x00444793, "handle_assert_water_cell_1()");
AddBpt(0x004447D7);
SetBptCnd(0x004447D7, "handle_assert_water_cell_2()");
AddBpt(0x00444788);
SetBptCnd(0x00444788, "handle_assert_water_cell_3()");
}