-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWinMain.cpp
More file actions
85 lines (69 loc) · 2.07 KB
/
Copy pathWinMain.cpp
File metadata and controls
85 lines (69 loc) · 2.07 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
#include <windows.h>
#include "Prototypes.h"
#include "Globals.h"
int __declspec(naked) WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
__asm {
// --- Traditional prologue without SEH ---
push ebp
mov ebp, esp
sub esp, 0x870
push ebx
push esi
push edi
// --- Entry sequence ---
call sub_63b7d0
push offset sub_63ba80
call atexit
add esp, 4
// 0064abde - Log entry point
push offset data_7d96ac // "reached winmain!\n"
call sub_63bcc0
add esp, 0x4
// 0064abeb - Reset control variable
mov dword ptr[data_141c0a8], 0
// 0064abf5 - Zero out buffer (256 bytes)
push 0x100
push 0
push offset data_1419a50
call vc6_memset
add esp, 0xc
call sub_64a880
// 0064ac01 - Start Memory Manager
call sub_5b9a10
// 0064ac13 - Register Memory Manager shutdown
push offset sub_5b9a60
call atexit
add esp, 4
// 0064ac20 - Allocate object (4 bytes)
push 4
call vc6_new
add esp, 4
mov[ebp - 0x758], eax
// Check if new succeeded
cmp dword ptr[ebp - 0x758], 0
je loc_failed_alloc
// Call constructor: sub_5f8930(this)
mov ecx, [ebp - 0x758]
call sub_5f8930
mov[ebp - 0x7f0], eax
jmp loc_store_ptr
loc_failed_alloc :
mov dword ptr[ebp - 0x7f0], 0
loc_store_ptr :
mov eax, [ebp - 0x7f0]
mov[ebp - 0x754], eax
mov ecx, [ebp - 0x754]
mov dword ptr[data_18a4b8c], ecx
// Register cleanup
push offset sub_64a7d0
call atexit
add esp, 4
// --- Epilogue ---
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 16
}
}