-
Notifications
You must be signed in to change notification settings - Fork 1
/
keygen.asm
230 lines (183 loc) · 8.24 KB
/
keygen.asm
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
; -----------------------------------------------------------------------
.486
.model flat, stdcall
option casemap :none ; case sensitive
; -----------------------------------------------------------------------
include project.inc
include core.asm
include effects.asm
; -----------------------------------------------------------------------
.code
; -----------------------------------------------------------------------
DlgAbout proc hWnd, uMsg, wParam, lParam
local sRect:RECT, sPaint:PAINTSTRUCT
switch uMsg
case WM_INITDIALOG
invoke LoadPng, hInstance, hWnd, 3002
mov hImg2, eax
;invoke LoadBitmap, hInstance, 3002
invoke CreatePatternBrush, eax
mov hBackgroundAbout, eax
invoke GetWindowRect, hParent, addr sRect
invoke SetWindowPos, hWnd,HWND_TOPMOST, sRect.left, sRect.top, 0, 0,SWP_NOSIZE
invoke ImageButton, hInstance, hWnd, addr sbutton_close
mov hButton_Close2, eax
invoke ImageButton, hInstance, hWnd, addr sbutton_help2
mov hButton_About2, eax
invoke GetWindowLong, hWnd, GWL_EXSTYLE
or eax, WS_EX_LAYERED
invoke SetWindowLong, hWnd, GWL_EXSTYLE, eax
invoke CreateThread, 0, 0, addr FadeInDlg, hWnd, 0, 0
mov hFadeIn, eax
.if lParam == TRUE
invoke SendDlgItemMessage, hWnd, 1011, WM_SETTEXT, 0, SADD("Congratz!!:", 13, 13, 9, "Send your tut+src", 13, 9, 9, "to be part of MAL", 13, 13, "[email protected]")
;invoke SetDlgItemText, hWnd, 1011, SADD("Greetz! Send your tut+src", 9, 13, "to be part of MAL\n\n\[email protected]")
.endif
case WM_PAINT
invoke BeginPaint, hWnd, addr sPaint
mov ebx, eax
invoke GetClientRect, hWnd, addr sRect
invoke FrameRect, ebx, addr sRect, hBlackBrush
invoke EndPaint, hWnd, addr sPaint
case WM_CTLCOLORSTATIC
invoke SetTextColor, wParam, 00FFFFFFh
invoke SetBkMode, wParam, TRANSPARENT
invoke GetDlgCtrlID, lParam
invoke Calculate_offset, hWnd, eax
invoke SetBrushOrgEx, wParam, eax, ebx, 0
mov eax, hBackgroundAbout
ret
case WM_CTLCOLORDLG
mov eax, hBackgroundAbout
ret
case WM_COMMAND
mov eax, wParam
and eax, 0000FFFFh
switch eax
case IDB_CLOSE
invoke SendMessage, hWnd, WM_CLOSE, 0, 0
endsw
case WM_LBUTTONDOWN
;invoke SendMessage, hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0
case WM_LBUTTONDBLCLK || uMsg == WM_RBUTTONUP
invoke SendMessage, hWnd, WM_CLOSE, 0, 0
case WM_CLOSE
invoke ImageDestroy, hButton_Close2
invoke ImageDestroy, hButton_About2
invoke CreateThread, 0, 0, addr FadeOutDlg, hWnd, 0, 0
push eax
invoke WaitForSingleObject, eax, -1
pop eax
invoke CloseHandle, eax
invoke DeleteObject, hImg2
invoke DeleteObject, hBackgroundAbout
invoke EndDialog, hWnd, 0
endsw
xor eax, eax
ret
DlgAbout endp
; -----------------------------------------------------------------------
DlgProc proc hWnd, uMsg, wParam, lParam
local sRect:RECT, sPaint:PAINTSTRUCT
switch uMsg
case WM_INITDIALOG
m2m hParent, hWnd
invoke LoadPng, hInstance, hWnd, IDR_BACKGROUND
mov hImg, eax
;invoke LoadBitmap, hInstance, IDR_BACKGROUND
invoke CreatePatternBrush, eax
mov hBackground, eax
invoke uFMOD_PlaySong, 5000, 0, XM_RESOURCE
invoke CreateFontIndirect, addr sFont
mov hFont, eax
invoke SendDlgItemMessage, hWnd, IDE_NAME, WM_SETFONT, hFont, 0
invoke Initialize, hWnd, IDE_NAME
invoke ImageButton, hInstance, hWnd, addr sbutton_close
mov hButton_Close1, eax
invoke ImageButton, hInstance, hWnd, addr sbutton_help
mov hButton_About1, eax
invoke SendDlgItemMessage, hWnd, IDE_NAME, EM_SETLIMITTEXT, NAME_MAX_LENGHT, 0
;invoke SendDlgItemMessage, hWnd, IDE_SERIAL, EM_SETLIMITTEXT, SERIAL_MAX_LENGHT, 0
invoke CreateSolidBrush, 0
mov hBlackBrush, eax
invoke GetWindowLong, hWnd, GWL_EXSTYLE
or eax, WS_EX_LAYERED
invoke SetWindowLong, hWnd, GWL_EXSTYLE, eax
invoke CreateThread, 0, 0, addr FadeInDlg, hWnd, 0, 0
mov hFadeIn, eax
invoke LoadIcon, hInstance, 6000
mov hIcon, eax
invoke SendMessage, hWnd, WM_SETICON, ICON_BIG, eax
case WM_PAINT
invoke BeginPaint, hWnd, addr sPaint
mov ebx, eax
invoke GetClientRect, hWnd, addr sRect
invoke FrameRect, ebx, addr sRect, hBlackBrush
invoke EndPaint, hWnd, addr sPaint
case WM_CTLCOLOREDIT
invoke SetTextColor, wParam, 00FFFFFFh
invoke SetBkMode, wParam, TRANSPARENT
invoke GetDlgCtrlID, lParam
invoke Calculate_offset, hWnd, eax
invoke SetBrushOrgEx, wParam, eax, ebx, 0
mov eax, hBackground
ret
case WM_CTLCOLORDLG
mov eax, hBackground
ret
case WM_COMMAND
mov eax, wParam
and eax, 0000FFFFh
switch eax
case IDB_CLOSE
invoke SendMessage, hWnd, WM_CLOSE, 0, 0
case IDB_HELP
invoke DialogBoxParam, hInstance, IDE_ABOUT, hWnd, addr DlgAbout, 0
default
mov eax, wParam
shr eax, 16
.if ax == EN_CHANGE
invoke InvalidateRect, hWnd, 0, 0
invoke GetDlgItemText, hWnd, IDE_NAME, addr szName, sizeof szName
.if eax >= NAME_MIN_LENGHT && eax <= NAME_MAX_LENGHT
mov ebx, eax
invoke GetDlgItemText, hWnd, IDE_SERIAL, addr szSerial, sizeof szSerial
invoke Verify, addr szName, ebx, addr szSerial, eax
.if !eax
;invoke MessageBox, hWnd, SADD("Well done!"), SADD("yap, correct"), MB_ICONINFORMATION
invoke DialogBoxParam, hInstance, IDE_ABOUT, hWnd, addr DlgAbout, TRUE
.endif
.endif
.endif
endsw
case WM_LBUTTONDOWN
invoke SendMessage, hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0
case WM_LBUTTONDBLCLK || uMsg == WM_RBUTTONUP
invoke SendMessage, hWnd, WM_CLOSE, 0, 0
case WM_CLOSE
invoke CreateThread, 0, 0, addr FadeOutDlg, hWnd, 0, 0
push eax
invoke WaitForSingleObject, eax, -1
pop eax
invoke CloseHandle, eax
invoke uFMOD_PlaySong, 0, 0, 0
invoke ImageDestroy, hButton_Close1
invoke ImageDestroy, hButton_About1
invoke DeleteObject, hImg
invoke DeleteObject, hIcon
invoke DeleteObject, hBlackBrush
invoke DeleteObject, hFont
invoke DeleteObject, hBackground
invoke EndDialog, hWnd, 0
endsw
xor eax,eax
ret
DlgProc endp
; -----------------------------------------------------------------------
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke DialogBoxParam, hInstance, 101, 0, addr DlgProc, 0
invoke ExitProcess, eax
end start
; -----------------------------------------------------------------------