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
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <dlfcn.h>
#include "wrappedlibs.h"
#include "debug.h"
#include "wrapper.h"
#include "bridge.h"
#include "librarian/library_private.h"
#include "x64emu.h"
#include "emu/x64emu_private.h"
#include "callback.h"
#include "librarian.h"
#include "box64context.h"
#include "emu/x64emu_private.h"
#include "myalign.h"
const char* expatName = "libexpat.so.1";
#define LIBNAME expat
#define ALTNAME "libexpat.so"
#include "generated/wrappedexpattypes.h"
#include "wrappercallback.h"
#define SUPER() \
GO(0) \
GO(1) \
GO(2) \
GO(3) \
GO(4)
// Start ...
#define GO(A) \
static uintptr_t my_Start_fct_##A = 0; \
static void* my_Start_##A(void* data, void* name, void* attr) \
{ \
return (void*)RunFunctionFmt(my_Start_fct_##A, "ppp", data, name, attr); \
}
SUPER()
#undef GO
static void* find_Start_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_Start_fct_##A == (uintptr_t)fct) return my_Start_##A;
SUPER()
#undef GO
#define GO(A) if(my_Start_fct_##A == 0) {my_Start_fct_##A = (uintptr_t)fct; return my_Start_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat Start callback\n");
return NULL;
}
// End ...
#define GO(A) \
static uintptr_t my_End_fct_##A = 0; \
static void my_End_##A(void* data, void* name) \
{ \
RunFunctionFmt(my_End_fct_##A, "pp", data, name); \
}
SUPER()
#undef GO
static void* find_End_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_End_fct_##A == (uintptr_t)fct) return my_End_##A;
SUPER()
#undef GO
#define GO(A) if(my_End_fct_##A == 0) {my_End_fct_##A = (uintptr_t)fct; return my_End_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat End callback\n");
return NULL;
}
// CharData ...
#define GO(A) \
static uintptr_t my_CharData_fct_##A = 0; \
static void my_CharData_##A(void* data, void* s, int l) \
{ \
RunFunctionFmt(my_CharData_fct_##A, "ppi", data, s, l); \
}
SUPER()
#undef GO
static void* find_CharData_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_CharData_fct_##A == (uintptr_t)fct) return my_CharData_##A;
SUPER()
#undef GO
#define GO(A) if(my_CharData_fct_##A == 0) {my_CharData_fct_##A = (uintptr_t)fct; return my_CharData_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat CharData callback\n");
return NULL;
}
// StartNamespaceDecl ...
#define GO(A) \
static uintptr_t my_StartNamespaceDecl_fct_##A = 0; \
static void my_StartNamespaceDecl_##A(void* data, void* name, void* attr) \
{ \
RunFunctionFmt(my_StartNamespaceDecl_fct_##A, "ppp", data, name, attr); \
}
SUPER()
#undef GO
static void* find_StartNamespaceDecl_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_StartNamespaceDecl_fct_##A == (uintptr_t)fct) return my_StartNamespaceDecl_##A;
SUPER()
#undef GO
#define GO(A) if(my_StartNamespaceDecl_fct_##A == 0) {my_StartNamespaceDecl_fct_##A = (uintptr_t)fct; return my_StartNamespaceDecl_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat StartNamespaceDecl callback\n");
return NULL;
}
// EndNamespaceDecl ...
#define GO(A) \
static uintptr_t my_EndNamespaceDecl_fct_##A = 0; \
static void my_EndNamespaceDecl_##A(void* data, void* name) \
{ \
RunFunctionFmt(my_EndNamespaceDecl_fct_##A, "pp", data, name); \
}
SUPER()
#undef GO
static void* find_EndNamespaceDecl_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_EndNamespaceDecl_fct_##A == (uintptr_t)fct) return my_EndNamespaceDecl_##A;
SUPER()
#undef GO
#define GO(A) if(my_EndNamespaceDecl_fct_##A == 0) {my_EndNamespaceDecl_fct_##A = (uintptr_t)fct; return my_EndNamespaceDecl_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat EndNamespaceDecl callback\n");
return NULL;
}
// StartElement ...
#define GO(A) \
static uintptr_t my_StartElement_fct_##A = 0; \
static void my_StartElement_##A(void* data, void* name, void* attr) \
{ \
RunFunctionFmt(my_StartElement_fct_##A, "ppp", data, name, attr); \
}
SUPER()
#undef GO
static void* find_StartElement_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_StartElement_fct_##A == (uintptr_t)fct) return my_StartElement_##A;
SUPER()
#undef GO
#define GO(A) if(my_StartElement_fct_##A == 0) {my_StartElement_fct_##A = (uintptr_t)fct; return my_StartElement_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat StartElement callback\n");
return NULL;
}
// EndElement ...
#define GO(A) \
static uintptr_t my_EndElement_fct_##A = 0; \
static void my_EndElement_##A(void* data, void* name) \
{ \
RunFunctionFmt(my_EndElement_fct_##A, "pp", data, name); \
}
SUPER()
#undef GO
static void* find_EndElement_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_EndElement_fct_##A == (uintptr_t)fct) return my_EndElement_##A;
SUPER()
#undef GO
#define GO(A) if(my_EndElement_fct_##A == 0) {my_EndElement_fct_##A = (uintptr_t)fct; return my_EndElement_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat EndElement callback\n");
return NULL;
}
// ProcessingInstruction ...
#define GO(A) \
static uintptr_t my_ProcessingInstruction_fct_##A = 0; \
static void my_ProcessingInstruction_##A(void* a, void* b, void* c) \
{ \
RunFunctionFmt(my_ProcessingInstruction_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* find_ProcessingInstruction_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_ProcessingInstruction_fct_##A == (uintptr_t)fct) return my_ProcessingInstruction_##A;
SUPER()
#undef GO
#define GO(A) if(my_ProcessingInstruction_fct_##A == 0) {my_ProcessingInstruction_fct_##A = (uintptr_t)fct; return my_ProcessingInstruction_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat ProcessingInstruction callback\n");
return NULL;
}
// Comment ...
#define GO(A) \
static uintptr_t my_Comment_fct_##A = 0; \
static void my_Comment_##A(void* a, void* b) \
{ \
RunFunctionFmt(my_Comment_fct_##A, "pp", a, b); \
}
SUPER()
#undef GO
static void* find_Comment_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_Comment_fct_##A == (uintptr_t)fct) return my_Comment_##A;
SUPER()
#undef GO
#define GO(A) if(my_Comment_fct_##A == 0) {my_Comment_fct_##A = (uintptr_t)fct; return my_Comment_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat Comment callback\n");
return NULL;
}
// StartCdataSection ...
#define GO(A) \
static uintptr_t my_StartCdataSection_fct_##A = 0; \
static void my_StartCdataSection_##A(void* data) \
{ \
RunFunctionFmt(my_StartCdataSection_fct_##A, "p", data); \
}
SUPER()
#undef GO
static void* find_StartCdataSection_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_StartCdataSection_fct_##A == (uintptr_t)fct) return my_StartCdataSection_##A;
SUPER()
#undef GO
#define GO(A) if(my_StartCdataSection_fct_##A == 0) {my_StartCdataSection_fct_##A = (uintptr_t)fct; return my_StartCdataSection_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat StartCdataSection callback\n");
return NULL;
}
// EndCdataSection ...
#define GO(A) \
static uintptr_t my_EndCdataSection_fct_##A = 0; \
static void my_EndCdataSection_##A(void* data) \
{ \
RunFunctionFmt(my_EndCdataSection_fct_##A, "p", data); \
}
SUPER()
#undef GO
static void* find_EndCdataSection_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_EndCdataSection_fct_##A == (uintptr_t)fct) return my_EndCdataSection_##A;
SUPER()
#undef GO
#define GO(A) if(my_EndCdataSection_fct_##A == 0) {my_EndCdataSection_fct_##A = (uintptr_t)fct; return my_EndCdataSection_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat EndCdataSection callback\n");
return NULL;
}
// Default ...
#define GO(A) \
static uintptr_t my_Default_fct_##A = 0; \
static void my_Default_##A(void* data, void* name, int len) \
{ \
RunFunctionFmt(my_Default_fct_##A, "ppi", data, name, len); \
}
SUPER()
#undef GO
static void* find_Default_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_Default_fct_##A == (uintptr_t)fct) return my_Default_##A;
SUPER()
#undef GO
#define GO(A) if(my_Default_fct_##A == 0) {my_Default_fct_##A = (uintptr_t)fct; return my_Default_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat Default callback\n");
return NULL;
}
// StartDoctypeDecl ...
#define GO(A) \
static uintptr_t my_StartDoctypeDecl_fct_##A = 0; \
static void my_StartDoctypeDecl_##A(void* a, void* b, void* c, void* d, int e) \
{ \
RunFunctionFmt(my_StartDoctypeDecl_fct_##A, "ppppi", a, b, c, d, e); \
}
SUPER()
#undef GO
static void* find_StartDoctypeDecl_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_StartDoctypeDecl_fct_##A == (uintptr_t)fct) return my_StartDoctypeDecl_##A;
SUPER()
#undef GO
#define GO(A) if(my_StartDoctypeDecl_fct_##A == 0) {my_StartDoctypeDecl_fct_##A = (uintptr_t)fct; return my_StartDoctypeDecl_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat StartDoctypeDecl callback\n");
return NULL;
}
// EndDoctypeDecl ...
#define GO(A) \
static uintptr_t my_EndDoctypeDecl_fct_##A = 0; \
static void my_EndDoctypeDecl_##A(void* data) \
{ \
RunFunctionFmt(my_EndDoctypeDecl_fct_##A, "p", data); \
}
SUPER()
#undef GO
static void* find_EndDoctypeDecl_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_EndDoctypeDecl_fct_##A == (uintptr_t)fct) return my_EndDoctypeDecl_##A;
SUPER()
#undef GO
#define GO(A) if(my_EndDoctypeDecl_fct_##A == 0) {my_EndDoctypeDecl_fct_##A = (uintptr_t)fct; return my_EndDoctypeDecl_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat EndDoctypeDecl callback\n");
return NULL;
}
// EntityDecl ...
#define GO(A) \
static uintptr_t my_EntityDecl_fct_##A = 0; \
static void my_EntityDecl_##A(void* a, void* b, int c, void* d, int e, void* f, void* g, void* h, void* i) \
{ \
RunFunctionFmt(my_EntityDecl_fct_##A, "ppipipppp", a, b, c, d, e, f, g, h, i); \
}
SUPER()
#undef GO
static void* find_EntityDecl_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_EntityDecl_fct_##A == (uintptr_t)fct) return my_EntityDecl_##A;
SUPER()
#undef GO
#define GO(A) if(my_EntityDecl_fct_##A == 0) {my_EntityDecl_fct_##A = (uintptr_t)fct; return my_EntityDecl_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat EntityDecl callback\n");
return NULL;
}
// ElementDecl ...
#define GO(A) \
static uintptr_t my_ElementDecl_fct_##A = 0; \
static void my_ElementDecl_##A(void* a, void* b, void* c) \
{ \
RunFunctionFmt(my_ElementDecl_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* find_ElementDecl_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_ElementDecl_fct_##A == (uintptr_t)fct) return my_ElementDecl_##A;
SUPER()
#undef GO
#define GO(A) if(my_ElementDecl_fct_##A == 0) {my_ElementDecl_fct_##A = (uintptr_t)fct; return my_ElementDecl_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat ElementDecl callback\n");
return NULL;
}
// UnknownEncoding ...
#define GO(A) \
static uintptr_t my_UnknownEncoding_fct_##A = 0; \
static int my_UnknownEncoding_##A(void* a, void* b, void* c) \
{ \
return (int)RunFunctionFmt(my_UnknownEncoding_fct_##A, "ppp", a, b, c); \
}
SUPER()
#undef GO
static void* find_UnknownEncoding_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_UnknownEncoding_fct_##A == (uintptr_t)fct) return my_UnknownEncoding_##A;
SUPER()
#undef GO
#define GO(A) if(my_UnknownEncoding_fct_##A == 0) {my_UnknownEncoding_fct_##A = (uintptr_t)fct; return my_UnknownEncoding_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat UnknownEncoding callback\n");
return NULL;
}
// UnparsedEntityDecl ...
#define GO(A) \
static uintptr_t my_UnparsedEntityDecl_fct_##A = 0; \
static void my_UnparsedEntityDecl_##A(void* a, void* b, void* c, void* d, void* e, void* f) \
{ \
RunFunctionFmt(my_UnparsedEntityDecl_fct_##A, "pppppp", a, b, c, d, e, f); \
}
SUPER()
#undef GO
static void* find_UnparsedEntityDecl_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_UnparsedEntityDecl_fct_##A == (uintptr_t)fct) return my_UnparsedEntityDecl_##A;
SUPER()
#undef GO
#define GO(A) if(my_UnparsedEntityDecl_fct_##A == 0) {my_UnparsedEntityDecl_fct_##A = (uintptr_t)fct; return my_UnparsedEntityDecl_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat UnparsedEntityDecl callback\n");
return NULL;
}
// NotationDecl ...
#define GO(A) \
static uintptr_t my_NotationDecl_fct_##A = 0; \
static void my_NotationDecl_##A(void* a, void* b, void* c, void* d, void* e) \
{ \
RunFunctionFmt(my_NotationDecl_fct_##A, "ppppp", a, b, c, d, e); \
}
SUPER()
#undef GO
static void* find_NotationDecl_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_NotationDecl_fct_##A == (uintptr_t)fct) return my_NotationDecl_##A;
SUPER()
#undef GO
#define GO(A) if(my_NotationDecl_fct_##A == 0) {my_NotationDecl_fct_##A = (uintptr_t)fct; return my_NotationDecl_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat NotationDecl callback\n");
return NULL;
}
// NotStandalone ...
#define GO(A) \
static uintptr_t my_NotStandalone_fct_##A = 0; \
static int my_NotStandalone_##A(void* data) \
{ \
return (int)RunFunctionFmt(my_NotStandalone_fct_##A, "p", data); \
}
SUPER()
#undef GO
static void* find_NotStandalone_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_NotStandalone_fct_##A == (uintptr_t)fct) return my_NotStandalone_##A;
SUPER()
#undef GO
#define GO(A) if(my_NotStandalone_fct_##A == 0) {my_NotStandalone_fct_##A = (uintptr_t)fct; return my_NotStandalone_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat NotStandalone callback\n");
return NULL;
}
// ExternalEntityRef ...
#define GO(A) \
static uintptr_t my_ExternalEntityRef_fct_##A = 0; \
static int my_ExternalEntityRef_##A(void* a, void* b, void* c, void* d, void* e) \
{ \
return (int)RunFunctionFmt(my_ExternalEntityRef_fct_##A, "ppppp", a, b, c, d, e); \
}
SUPER()
#undef GO
static void* find_ExternalEntityRef_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_ExternalEntityRef_fct_##A == (uintptr_t)fct) return my_ExternalEntityRef_##A;
SUPER()
#undef GO
#define GO(A) if(my_ExternalEntityRef_fct_##A == 0) {my_ExternalEntityRef_fct_##A = (uintptr_t)fct; return my_ExternalEntityRef_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat ExternalEntityRef callback\n");
return NULL;
}
// XmlDecl ...
#define GO(A) \
static uintptr_t my_XmlDecl_fct_##A = 0; \
static void my_XmlDecl_##A(void* a, void* b, void* c, int d) \
{ \
RunFunctionFmt(my_XmlDecl_fct_##A, "pppi", a, b, c, d); \
}
SUPER()
#undef GO
static void* find_XmlDecl_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_XmlDecl_fct_##A == (uintptr_t)fct) return my_XmlDecl_##A;
SUPER()
#undef GO
#define GO(A) if(my_XmlDecl_fct_##A == 0) {my_XmlDecl_fct_##A = (uintptr_t)fct; return my_XmlDecl_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat XmlDecl callback\n");
return NULL;
}
// AttlistDecl ...
#define GO(A) \
static uintptr_t my_AttlistDecl_fct_##A = 0; \
static void my_AttlistDecl_##A(void* a, void* b, void* c, void* d, void* e, int f) \
{ \
RunFunctionFmt(my_AttlistDecl_fct_##A, "pppppi", a, b, c, d, e, f); \
}
SUPER()
#undef GO
static void* find_AttlistDecl_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_AttlistDecl_fct_##A == (uintptr_t)fct) return my_AttlistDecl_##A;
SUPER()
#undef GO
#define GO(A) if(my_AttlistDecl_fct_##A == 0) {my_AttlistDecl_fct_##A = (uintptr_t)fct; return my_AttlistDecl_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat AttlistDecl callback\n");
return NULL;
}
// SkippedEntity ...
#define GO(A) \
static uintptr_t my_SkippedEntity_fct_##A = 0; \
static void my_SkippedEntity_##A(void* a, void* b, int c) \
{ \
RunFunctionFmt(my_SkippedEntity_fct_##A, "ppi", a, b, c); \
}
SUPER()
#undef GO
static void* find_SkippedEntity_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_SkippedEntity_fct_##A == (uintptr_t)fct) return my_SkippedEntity_##A;
SUPER()
#undef GO
#define GO(A) if(my_SkippedEntity_fct_##A == 0) {my_SkippedEntity_fct_##A = (uintptr_t)fct; return my_SkippedEntity_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for expat SkippedEntity callback\n");
return NULL;
}
#undef SUPER
EXPORT void my_XML_SetElementHandler(x64emu_t* emu, void* p, void* start, void* end)
{
my->XML_SetElementHandler(p, find_Start_Fct(start), find_End_Fct(end));
}
EXPORT void my_XML_SetCharacterDataHandler(x64emu_t* emu, void* p, void* h)
{
my->XML_SetCharacterDataHandler(p, find_CharData_Fct(h));
}
EXPORT void my_XML_SetNamespaceDeclHandler(x64emu_t* emu, void* p, void* start, void* end)
{
my->XML_SetNamespaceDeclHandler(p, find_StartNamespaceDecl_Fct(start), find_EndNamespaceDecl_Fct(end));
}
EXPORT void my_XML_SetEntityDeclHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetEntityDeclHandler(p, find_EntityDecl_Fct(f));
}
EXPORT void my_XML_SetStartDoctypeDeclHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetStartDoctypeDeclHandler(p, find_StartDoctypeDecl_Fct(f));
}
EXPORT void my_XML_SetEndDoctypeDeclHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetEndDoctypeDeclHandler(p, find_EndDoctypeDecl_Fct(f));
}
EXPORT void my_XML_SetElementDeclHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetElementDeclHandler(p, find_ElementDecl_Fct(f));
}
EXPORT void my_XML_SetDefaultHandlerExpand(x64emu_t* emu, void* p, void* f)
{
my->XML_SetDefaultHandlerExpand(p, find_Default_Fct(f));
}
EXPORT void my_XML_SetCommentHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetCommentHandler(p, find_Comment_Fct(f));
}
EXPORT void my_XML_SetProcessingInstructionHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetProcessingInstructionHandler(p, find_ProcessingInstruction_Fct(f));
}
EXPORT void my_XML_SetStartElementHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetStartElementHandler(p, find_StartElement_Fct(f));
}
EXPORT void my_XML_SetEndElementHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetEndElementHandler(p, find_EndElement_Fct(f));
}
EXPORT void my_XML_SetUnknownEncodingHandler(x64emu_t* emu, void* p, void* f, void* d)
{
my->XML_SetUnknownEncodingHandler(p, find_UnknownEncoding_Fct(f), d);
}
EXPORT void my_XML_SetUnparsedEntityDeclHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetUnparsedEntityDeclHandler(p, find_UnparsedEntityDecl_Fct(f));
}
EXPORT void my_XML_SetNotationDeclHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetNotationDeclHandler(p, find_NotationDecl_Fct(f));
}
EXPORT void my_XML_SetStartNamespaceDeclHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetStartNamespaceDeclHandler(p, find_StartNamespaceDecl_Fct(f));
}
EXPORT void my_XML_SetEndNamespaceDeclHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetEndNamespaceDeclHandler(p, find_EndNamespaceDecl_Fct(f));
}
EXPORT void my_XML_SetStartCdataSectionHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetStartCdataSectionHandler(p, find_StartCdataSection_Fct(f));
}
EXPORT void my_XML_SetEndCdataSectionHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetEndCdataSectionHandler(p, find_EndCdataSection_Fct(f));
}
EXPORT void my_XML_SetDefaultHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetDefaultHandler(p, find_Default_Fct(f));
}
EXPORT void my_XML_SetNotStandaloneHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetNotStandaloneHandler(p, find_NotStandalone_Fct(f));
}
EXPORT void my_XML_SetExternalEntityRefHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetExternalEntityRefHandler(p, find_ExternalEntityRef_Fct(f));
}
EXPORT void my_XML_SetXmlDeclHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetXmlDeclHandler(p, find_XmlDecl_Fct(f));
}
EXPORT void my_XML_SetAttlistDeclHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetAttlistDeclHandler(p, find_AttlistDecl_Fct(f));
}
EXPORT void my_XML_SetSkippedEntityHandler(x64emu_t* emu, void* p, void* f)
{
my->XML_SetSkippedEntityHandler(p, find_SkippedEntity_Fct(f));
}
EXPORT void my_XML_SetCdataSectionHandler(x64emu_t* emu, void* p, void* s, void* e)
{
my->XML_SetCdataSectionHandler(p, find_StartCdataSection_Fct(s), find_EndCdataSection_Fct(e));
}
EXPORT void my_XML_SetDoctypeDeclHandler(x64emu_t* emu, void* p, void* s, void* e)
{
my->XML_SetDoctypeDeclHandler(p, find_StartDoctypeDecl_Fct(s), find_EndDoctypeDecl_Fct(e));
}
#include "wrappedlib_init.h"
|