-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path005F0000.cpp
More file actions
108 lines (94 loc) · 2.7 KB
/
Copy path005F0000.cpp
File metadata and controls
108 lines (94 loc) · 2.7 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include <windows.h>
#include "Globals.h"
#include "Prototypes.h"
// --- Object Constructor ---
// Observation: ECX = this. Initializes first dword to 0.
void __declspec(naked) sub_5f8930() {
__asm {
push ebp
mov ebp, esp
sub esp, 0x44
push ebx
push esi
push edi
mov[ebp - 0x04], ecx
mov eax, [ebp - 0x04]
mov dword ptr[eax], 0
mov eax, [ebp - 0x04]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
}
}
// --- Object: Real Destructor ---
// Observation: Called from scalar deleting destructor. ECX = this.
void __declspec(naked) sub_5f8960() {
__asm {
push ebp
mov ebp, esp
sub esp, 0x44
push ebx
push esi
push edi
// Store this-pointer
mov[ebp - 0x04], ecx
// Pass this-pointer to next cleanup stage
mov ecx, [ebp - 0x04]
call sub_5f8990
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
}
}
// --- Object: Internal List Cleanup ---
// Observation: Iterates through a linked list starting at [this]
// and deletes each node. Next pointer is at offset 0x08.
void __declspec(naked) sub_5f8990() {
__asm {
push ebp
mov ebp, esp
sub esp, 0x50
push ebx
push esi
push edi
mov[ebp - 0x04], ecx // Store 'this'
mov eax, [ebp - 0x04]
mov ecx, [eax] // Load head node
mov[ebp - 0x08], ecx // var 'i' (current node)
mov dword ptr[ebp - 0x0c], 0 // Initial dummy store
loc_loop_check:
cmp dword ptr[ebp - 0x08], 0
je loc_finish
// Get current node and store in temporary
mov edx, [ebp - 0x08]
mov[ebp - 0x0c], edx
// Get next node from [current + 0x08] and update loop variable
mov eax, [ebp - 0x08]
mov ecx, [eax + 0x08]
mov[ebp - 0x08], ecx
// Push current node and delete it
mov edx, [ebp - 0x0c]
mov[ebp - 0x10], edx
mov eax, [ebp - 0x10]
push eax
call vc6_delete
add esp, 0x04
jmp loc_loop_check
loc_finish :
// Set head to NULL
mov ecx, [ebp - 0x04]
mov dword ptr[ecx], 0
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
}
}