-
Notifications
You must be signed in to change notification settings - Fork 0
/
MIDIOUT.DLL.c
10996 lines (9196 loc) · 262 KB
/
MIDIOUT.DLL.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 pointer32 ImageBaseOffset32;
typedef unsigned char bool;
typedef unsigned char byte;
typedef unsigned int dword;
typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned char undefined1;
typedef unsigned short undefined2;
typedef unsigned int undefined4;
typedef unsigned long long undefined5;
typedef unsigned long long undefined8;
typedef unsigned short ushort;
typedef short wchar_t;
typedef unsigned short word;
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 unsigned short wchar16;
typedef struct _cpinfo _cpinfo, *P_cpinfo;
typedef uint UINT;
typedef uchar BYTE;
struct _cpinfo {
UINT MaxCharSize;
BYTE DefaultChar[2];
BYTE LeadByte[12];
};
typedef struct _cpinfo *LPCPINFO;
typedef struct _STARTUPINFOA _STARTUPINFOA, *P_STARTUPINFOA;
typedef ulong DWORD;
typedef char CHAR;
typedef CHAR *LPSTR;
typedef ushort WORD;
typedef BYTE *LPBYTE;
typedef void *HANDLE;
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 _STARTUPINFOA *LPSTARTUPINFOA;
typedef struct _PROCESS_HEAP_ENTRY _PROCESS_HEAP_ENTRY, *P_PROCESS_HEAP_ENTRY;
typedef void *PVOID;
typedef union _union_548 _union_548, *P_union_548;
typedef struct _struct_549 _struct_549, *P_struct_549;
typedef struct _struct_550 _struct_550, *P_struct_550;
typedef void *LPVOID;
struct _struct_550 {
DWORD dwCommittedSize;
DWORD dwUnCommittedSize;
LPVOID lpFirstBlock;
LPVOID lpLastBlock;
};
struct _struct_549 {
HANDLE hMem;
DWORD dwReserved[3];
};
union _union_548 {
struct _struct_549 Block;
struct _struct_550 Region;
};
struct _PROCESS_HEAP_ENTRY {
PVOID lpData;
DWORD cbData;
BYTE cbOverhead;
BYTE iRegionIndex;
WORD wFlags;
union _union_548 u;
};
typedef struct _OVERLAPPED _OVERLAPPED, *P_OVERLAPPED;
typedef ulong ULONG_PTR;
typedef union _union_518 _union_518, *P_union_518;
typedef struct _struct_519 _struct_519, *P_struct_519;
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 _PROCESS_HEAP_ENTRY *LPPROCESS_HEAP_ENTRY;
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 _OVERLAPPED *LPOVERLAPPED;
typedef struct _EXCEPTION_POINTERS _EXCEPTION_POINTERS, *P_EXCEPTION_POINTERS;
typedef LONG (*PTOP_LEVEL_EXCEPTION_FILTER)(struct _EXCEPTION_POINTERS *);
typedef struct _EXCEPTION_RECORD _EXCEPTION_RECORD, *P_EXCEPTION_RECORD;
typedef struct _EXCEPTION_RECORD EXCEPTION_RECORD;
typedef EXCEPTION_RECORD *PEXCEPTION_RECORD;
typedef struct _CONTEXT _CONTEXT, *P_CONTEXT;
typedef struct _CONTEXT CONTEXT;
typedef CONTEXT *PCONTEXT;
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];
};
struct _EXCEPTION_RECORD {
DWORD ExceptionCode;
DWORD ExceptionFlags;
struct _EXCEPTION_RECORD *ExceptionRecord;
PVOID ExceptionAddress;
DWORD NumberParameters;
ULONG_PTR ExceptionInformation[15];
};
struct _EXCEPTION_POINTERS {
PEXCEPTION_RECORD ExceptionRecord;
PCONTEXT ContextRecord;
};
typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
typedef wchar_t WCHAR;
typedef CHAR *LPCSTR;
typedef LONG *PLONG;
typedef CHAR *LPCH;
typedef WCHAR *LPWSTR;
typedef WCHAR *LPWCH;
typedef WCHAR *LPCWSTR;
typedef DWORD LCID;
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 DWORD_PTR;
typedef ULONG_PTR SIZE_T;
typedef uint UINT_PTR;
typedef long LONG_PTR;
typedef int (*FARPROC)(void);
typedef UINT_PTR WPARAM;
typedef WORD *LPWORD;
typedef DWORD *LPDWORD;
typedef struct HINSTANCE__ HINSTANCE__, *PHINSTANCE__;
struct HINSTANCE__ {
int unused;
};
typedef HANDLE HGLOBAL;
typedef LONG_PTR LPARAM;
typedef int BOOL;
typedef BOOL *LPBOOL;
typedef struct HINSTANCE__ *HINSTANCE;
typedef void *LPCVOID;
typedef struct HRSRC__ HRSRC__, *PHRSRC__;
typedef struct HRSRC__ *HRSRC;
struct HRSRC__ {
int unused;
};
typedef struct HWND__ HWND__, *PHWND__;
typedef struct HWND__ *HWND;
struct HWND__ {
int unused;
};
typedef HINSTANCE HMODULE;
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 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_DEBUG_DIRECTORY IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
struct IMAGE_DEBUG_DIRECTORY {
dword Characteristics;
dword TimeDateStamp;
word MajorVersion;
word MinorVersion;
dword Type;
dword SizeOfData;
dword AddressOfRawData;
dword PointerToRawData;
};
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 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 IMAGE_SECTION_HEADER IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
typedef union Misc Misc, *PMisc;
typedef enum SectionFlags {
IMAGE_SCN_TYPE_NO_PAD=8,
IMAGE_SCN_RESERVED_0001=16,
IMAGE_SCN_CNT_CODE=32,
IMAGE_SCN_CNT_INITIALIZED_DATA=64,
IMAGE_SCN_CNT_UNINITIALIZED_DATA=128,
IMAGE_SCN_LNK_OTHER=256,
IMAGE_SCN_LNK_INFO=512,
IMAGE_SCN_RESERVED_0040=1024,
IMAGE_SCN_LNK_REMOVE=2048,
IMAGE_SCN_LNK_COMDAT=4096,
IMAGE_SCN_GPREL=32768,
IMAGE_SCN_MEM_16BIT=131072,
IMAGE_SCN_MEM_PURGEABLE=131072,
IMAGE_SCN_MEM_LOCKED=262144,
IMAGE_SCN_MEM_PRELOAD=524288,
IMAGE_SCN_ALIGN_1BYTES=1048576,
IMAGE_SCN_ALIGN_2BYTES=2097152,
IMAGE_SCN_ALIGN_4BYTES=3145728,
IMAGE_SCN_ALIGN_8BYTES=4194304,
IMAGE_SCN_ALIGN_16BYTES=5242880,
IMAGE_SCN_ALIGN_32BYTES=6291456,
IMAGE_SCN_ALIGN_64BYTES=7340032,
IMAGE_SCN_ALIGN_128BYTES=8388608,
IMAGE_SCN_ALIGN_256BYTES=9437184,
IMAGE_SCN_ALIGN_512BYTES=10485760,
IMAGE_SCN_ALIGN_1024BYTES=11534336,
IMAGE_SCN_ALIGN_2048BYTES=12582912,
IMAGE_SCN_ALIGN_4096BYTES=13631488,
IMAGE_SCN_ALIGN_8192BYTES=14680064,
IMAGE_SCN_LNK_NRELOC_OVFL=16777216,
IMAGE_SCN_MEM_DISCARDABLE=33554432,
IMAGE_SCN_MEM_NOT_CACHED=67108864,
IMAGE_SCN_MEM_NOT_PAGED=134217728,
IMAGE_SCN_MEM_SHARED=268435456,
IMAGE_SCN_MEM_EXECUTE=536870912,
IMAGE_SCN_MEM_READ=1073741824,
IMAGE_SCN_MEM_WRITE=2147483648
} 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 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 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 IMAGE_DIRECTORY_ENTRY_EXPORT IMAGE_DIRECTORY_ENTRY_EXPORT, *PIMAGE_DIRECTORY_ENTRY_EXPORT;
struct IMAGE_DIRECTORY_ENTRY_EXPORT {
dword Characteristics;
dword TimeDateStamp;
word MajorVersion;
word MinorVersion;
dword Name;
dword Base;
dword NumberOfFunctions;
dword NumberOfNames;
dword AddressOfFunctions;
dword AddressOfNames;
dword AddressOfNameOrdinals;
};
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 BOOL (*PHANDLER_ROUTINE)(DWORD);
typedef char *va_list;
typedef uint uintptr_t;
typedef void (TIMECALLBACK)(UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR);
typedef TIMECALLBACK *LPTIMECALLBACK;
typedef struct tagMIDIOUTCAPSA tagMIDIOUTCAPSA, *PtagMIDIOUTCAPSA;
typedef UINT MMVERSION;
struct tagMIDIOUTCAPSA {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
CHAR szPname[32];
WORD wTechnology;
WORD wVoices;
WORD wNotes;
WORD wChannelMask;
DWORD dwSupport;
};
typedef struct HMIDIOUT__ HMIDIOUT__, *PHMIDIOUT__;
typedef struct HMIDIOUT__ *HMIDIOUT;
struct HMIDIOUT__ {
int unused;
};
typedef UINT MMRESULT;
typedef struct midihdr_tag midihdr_tag, *Pmidihdr_tag;
struct midihdr_tag {
LPSTR lpData;
DWORD dwBufferLength;
DWORD dwBytesRecorded;
DWORD_PTR dwUser;
DWORD dwFlags;
struct midihdr_tag *lpNext;
DWORD_PTR reserved;
DWORD dwOffset;
DWORD_PTR dwReserved[8];
};
typedef struct timecaps_tag timecaps_tag, *Ptimecaps_tag;
struct timecaps_tag {
UINT wPeriodMin;
UINT wPeriodMax;
};
typedef struct midihdr_tag *LPMIDIHDR;
typedef struct timecaps_tag *LPTIMECAPS;
typedef struct tagMIDIOUTCAPSA *LPMIDIOUTCAPSA;
typedef HMIDIOUT *LPHMIDIOUT;
typedef struct _tiddata _tiddata, *P_tiddata;
typedef struct _tiddata *_ptiddata;
typedef struct threadmbcinfostruct threadmbcinfostruct, *Pthreadmbcinfostruct;
typedef struct threadmbcinfostruct *pthreadmbcinfo;
typedef struct threadlocaleinfostruct threadlocaleinfostruct, *Pthreadlocaleinfostruct;
typedef struct threadlocaleinfostruct *pthreadlocinfo;
typedef struct setloc_struct setloc_struct, *Psetloc_struct;
typedef struct setloc_struct _setloc_struct;
typedef struct localerefcount localerefcount, *Plocalerefcount;
typedef struct localerefcount locrefcount;
typedef struct lconv lconv, *Plconv;
typedef struct __lc_time_data __lc_time_data, *P__lc_time_data;
typedef struct _is_ctype_compatible _is_ctype_compatible, *P_is_ctype_compatible;
struct lconv {
char *decimal_point;
char *thousands_sep;
char *grouping;
char *int_curr_symbol;
char *currency_symbol;
char *mon_decimal_point;
char *mon_thousands_sep;
char *mon_grouping;
char *positive_sign;
char *negative_sign;
char int_frac_digits;
char frac_digits;
char p_cs_precedes;
char p_sep_by_space;
char n_cs_precedes;
char n_sep_by_space;
char p_sign_posn;
char n_sign_posn;
wchar_t *_W_decimal_point;
wchar_t *_W_thousands_sep;
wchar_t *_W_int_curr_symbol;
wchar_t *_W_currency_symbol;
wchar_t *_W_mon_decimal_point;
wchar_t *_W_mon_thousands_sep;
wchar_t *_W_positive_sign;
wchar_t *_W_negative_sign;
};
struct _is_ctype_compatible {
ulong id;
int is_clike;
};
struct setloc_struct {
wchar_t *pchLanguage;
wchar_t *pchCountry;
int iLocState;
int iPrimaryLen;
BOOL bAbbrevLanguage;
BOOL bAbbrevCountry;
UINT _cachecp;
wchar_t _cachein[131];
wchar_t _cacheout[131];
struct _is_ctype_compatible _Loc_c[5];
wchar_t _cacheLocaleName[85];
};
struct threadmbcinfostruct {
int refcount;
int mbcodepage;
int ismbcodepage;
ushort mbulinfo[6];
uchar mbctype[257];
uchar mbcasemap[256];
wchar_t *mblocalename;
};
struct localerefcount {
char *locale;
wchar_t *wlocale;
int *refcount;
int *wrefcount;
};
struct threadlocaleinfostruct {
int refcount;
uint lc_codepage;
uint lc_collate_cp;
uint lc_time_cp;
locrefcount lc_category[6];
int lc_clike;
int mb_cur_max;
int *lconv_intl_refcount;
int *lconv_num_refcount;
int *lconv_mon_refcount;
struct lconv *lconv;
int *ctype1_refcount;
ushort *ctype1;
ushort *pctype;
uchar *pclmap;
uchar *pcumap;
struct __lc_time_data *lc_time_curr;
wchar_t *locale_name[6];
};
struct _tiddata {
ulong _tid;
uintptr_t _thandle;
int _terrno;
ulong _tdoserrno;
uint _fpds;
ulong _holdrand;
char *_token;
wchar_t *_wtoken;
uchar *_mtoken;
char *_errmsg;
wchar_t *_werrmsg;
char *_namebuf0;
wchar_t *_wnamebuf0;
char *_namebuf1;
wchar_t *_wnamebuf1;
char *_asctimebuf;
wchar_t *_wasctimebuf;
void *_gmtimebuf;
char *_cvtbuf;
uchar _con_ch_buf[5];
ushort _ch_buf_used;
void *_initaddr;
void *_initarg;
void *_pxcptacttab;
void *_tpxcptinfoptrs;
int _tfpecode;
pthreadmbcinfo ptmbcinfo;
pthreadlocinfo ptlocinfo;
int _ownlocale;
ulong _NLG_dwCode;
void *_terminate;
void *_unexpected;
void *_translator;
void *_purecall;
void *_curexception;
void *_curcontext;
int _ProcessingThrow;
void *_curexcspec;
void *_pFrameInfoChain;
_setloc_struct _setloc_data;
void *_reserved1;
void *_reserved2;
void *_reserved3;
void *_reserved4;
void *_reserved5;
int _cxxReThrow;
ulong __initDomain;
int _initapartment;
};
struct __lc_time_data {
char *wday_abbr[7];
char *wday[7];
char *month_abbr[12];
char *month[12];
char *ampm[2];
char *ww_sdatefmt;
char *ww_ldatefmt;
char *ww_timefmt;
int ww_caltype;
int refcount;
wchar_t *_W_wday_abbr[7];
wchar_t *_W_wday[7];
wchar_t *_W_month_abbr[12];
wchar_t *_W_month[12];
wchar_t *_W_ampm[2];
wchar_t *_W_ww_sdatefmt;
wchar_t *_W_ww_ldatefmt;
wchar_t *_W_ww_timefmt;
wchar_t *_W_ww_locale_name;
};
typedef struct EHRegistrationNode EHRegistrationNode, *PEHRegistrationNode;
struct EHRegistrationNode { // PlaceHolder Structure
};
typedef struct _s_CatchableType _s_CatchableType, *P_s_CatchableType;
struct _s_CatchableType { // PlaceHolder Structure
};
typedef struct type_info type_info, *Ptype_info;
struct type_info { // PlaceHolder Structure
};
typedef enum _EXCEPTION_DISPOSITION {
} _EXCEPTION_DISPOSITION;
typedef struct PMD PMD, *PPMD;
struct PMD { // PlaceHolder Structure
};
typedef struct _s_FuncInfo _s_FuncInfo, *P_s_FuncInfo;
struct _s_FuncInfo { // PlaceHolder Structure
};
typedef struct EHExceptionRecord EHExceptionRecord, *PEHExceptionRecord;
struct EHExceptionRecord { // PlaceHolder Structure
};
typedef struct ios ios, *Pios;
struct ios { // PlaceHolder Structure
};
typedef struct _s_HandlerType _s_HandlerType, *P_s_HandlerType;
struct _s_HandlerType { // PlaceHolder Structure
};
typedef struct TranslatorGuardRN TranslatorGuardRN, *PTranslatorGuardRN;
struct TranslatorGuardRN { // PlaceHolder Structure
};
typedef struct MidiInterfaceClass MidiInterfaceClass, *PMidiInterfaceClass;
struct MidiInterfaceClass { // PlaceHolder Structure
};
typedef int (*_onexit_t)(void);
typedef uint size_t;
typedef struct localeinfo_struct localeinfo_struct, *Plocaleinfo_struct;
struct localeinfo_struct {
pthreadlocinfo locinfo;
pthreadmbcinfo mbcinfo;
};
typedef int intptr_t;
typedef struct localeinfo_struct *_locale_t;
// public: __thiscall MidiInterfaceClass::MidiInterfaceClass(void)
MidiInterfaceClass * __thiscall MidiInterfaceClass::MidiInterfaceClass(MidiInterfaceClass *this)
{
// 0x1000 2 ??0MidiInterfaceClass@@QAE@XZ
*(undefined ***)this = &_vftable_;
return this;
}
undefined4 __fastcall thunk_FUN_100021ce(int param_1)
{
MMRESULT MVar1;
undefined4 uVar2;
timecaps_tag tStack_c;
MVar1 = timeGetDevCaps(&tStack_c,8);
if (MVar1 == 0) {
*(UINT *)(param_1 + 0x14) = tStack_c.wPeriodMin;
if (*(uint *)(param_1 + 0x14) < 10) {
*(undefined4 *)(param_1 + 0x14) = 10;
}
uVar2 = 1;
}
else {
uVar2 = 0;
}
return uVar2;
}
undefined4 thunk_FUN_10001b25(undefined4 param_1,int param_2)
{
if (param_2 == 0) {
DAT_10014c44 = 0;
}
else if (param_2 == 1) {
DAT_10014c44 = param_1;
}
return 1;
}
undefined4 __fastcall thunk_FUN_1000239c(int param_1)
{
MMRESULT MVar1;
byte bStack_c;
DWORD DStack_8;
DStack_8 = 0x79b0;
bStack_c = 0;
while( true ) {
if (0xf < bStack_c) {
return 1;
}
MVar1 = midiOutShortMsg(*(HMIDIOUT *)(param_1 + 8),DStack_8);
if (MVar1 != 0) break;
DStack_8 = DStack_8 + 1;
bStack_c = bStack_c + 1;
}
return 0;
}
int * __thiscall thunk_FUN_10001698(void *this,byte param_1)
{
undefined4 *puVar1;
*(undefined4 *)this = 1;
puVar1 = (undefined4 *)thunk_FUN_1000123a(&DAT_100180a8,param_1);
if (puVar1 != (undefined4 *)0x0) {
*(undefined4 *)((int)this + 8) = *puVar1;
*(undefined4 *)((int)this + 0xc) = puVar1[1];
*(undefined4 *)((int)this + 0x10) = puVar1[2];
*(undefined4 *)((int)this + 0x14) = puVar1[3];
if (*(int *)((int)this + 0xc) != 0) {
*(undefined4 **)((int)this + 0x18) = puVar1 + 4;
*(int *)((int)this + 0x1c) = *(int *)((int)this + 0xc) * 8 + *(int *)((int)this + 0x18) + -8;
}
*(undefined4 *)((int)this + 0x24) = 0x50000;
*(undefined4 *)((int)this + 0x28) = 100;
*(uint *)((int)this + 0x2c) =
(uint)(*(int *)((int)this + 0x24) * *(int *)((int)this + 0x28)) / 100;
thunk_FUN_1000179e((int *)this);
*(undefined4 *)this = 0;
}
return (int *)this;
}