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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
#![allow(missing_docs)]
use crate::endian::{LittleEndian as LE, U16Bytes, U32Bytes, I32, U16, U32, U64};
use crate::pod::Pod;
pub const IMAGE_DOS_SIGNATURE: u16 = 0x5A4D;
pub const IMAGE_OS2_SIGNATURE: u16 = 0x454E;
pub const IMAGE_OS2_SIGNATURE_LE: u16 = 0x454C;
pub const IMAGE_VXD_SIGNATURE: u16 = 0x454C;
pub const IMAGE_NT_SIGNATURE: u32 = 0x0000_4550;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDosHeader {
pub e_magic: U16<LE>,
pub e_cblp: U16<LE>,
pub e_cp: U16<LE>,
pub e_crlc: U16<LE>,
pub e_cparhdr: U16<LE>,
pub e_minalloc: U16<LE>,
pub e_maxalloc: U16<LE>,
pub e_ss: U16<LE>,
pub e_sp: U16<LE>,
pub e_csum: U16<LE>,
pub e_ip: U16<LE>,
pub e_cs: U16<LE>,
pub e_lfarlc: U16<LE>,
pub e_ovno: U16<LE>,
pub e_res: [U16<LE>; 4],
pub e_oemid: U16<LE>,
pub e_oeminfo: U16<LE>,
pub e_res2: [U16<LE>; 10],
pub e_lfanew: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageOs2Header {
pub ne_magic: U16<LE>,
pub ne_ver: i8,
pub ne_rev: i8,
pub ne_enttab: U16<LE>,
pub ne_cbenttab: U16<LE>,
pub ne_crc: I32<LE>,
pub ne_flags: U16<LE>,
pub ne_autodata: U16<LE>,
pub ne_heap: U16<LE>,
pub ne_stack: U16<LE>,
pub ne_csip: I32<LE>,
pub ne_sssp: I32<LE>,
pub ne_cseg: U16<LE>,
pub ne_cmod: U16<LE>,
pub ne_cbnrestab: U16<LE>,
pub ne_segtab: U16<LE>,
pub ne_rsrctab: U16<LE>,
pub ne_restab: U16<LE>,
pub ne_modtab: U16<LE>,
pub ne_imptab: U16<LE>,
pub ne_nrestab: I32<LE>,
pub ne_cmovent: U16<LE>,
pub ne_align: U16<LE>,
pub ne_cres: U16<LE>,
pub ne_exetyp: u8,
pub ne_flagsothers: u8,
pub ne_pretthunks: U16<LE>,
pub ne_psegrefbytes: U16<LE>,
pub ne_swaparea: U16<LE>,
pub ne_expver: U16<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageVxdHeader {
pub e32_magic: U16<LE>,
pub e32_border: u8,
pub e32_worder: u8,
pub e32_level: U32<LE>,
pub e32_cpu: U16<LE>,
pub e32_os: U16<LE>,
pub e32_ver: U32<LE>,
pub e32_mflags: U32<LE>,
pub e32_mpages: U32<LE>,
pub e32_startobj: U32<LE>,
pub e32_eip: U32<LE>,
pub e32_stackobj: U32<LE>,
pub e32_esp: U32<LE>,
pub e32_pagesize: U32<LE>,
pub e32_lastpagesize: U32<LE>,
pub e32_fixupsize: U32<LE>,
pub e32_fixupsum: U32<LE>,
pub e32_ldrsize: U32<LE>,
pub e32_ldrsum: U32<LE>,
pub e32_objtab: U32<LE>,
pub e32_objcnt: U32<LE>,
pub e32_objmap: U32<LE>,
pub e32_itermap: U32<LE>,
pub e32_rsrctab: U32<LE>,
pub e32_rsrccnt: U32<LE>,
pub e32_restab: U32<LE>,
pub e32_enttab: U32<LE>,
pub e32_dirtab: U32<LE>,
pub e32_dircnt: U32<LE>,
pub e32_fpagetab: U32<LE>,
pub e32_frectab: U32<LE>,
pub e32_impmod: U32<LE>,
pub e32_impmodcnt: U32<LE>,
pub e32_impproc: U32<LE>,
pub e32_pagesum: U32<LE>,
pub e32_datapage: U32<LE>,
pub e32_preload: U32<LE>,
pub e32_nrestab: U32<LE>,
pub e32_cbnrestab: U32<LE>,
pub e32_nressum: U32<LE>,
pub e32_autodata: U32<LE>,
pub e32_debuginfo: U32<LE>,
pub e32_debuglen: U32<LE>,
pub e32_instpreload: U32<LE>,
pub e32_instdemand: U32<LE>,
pub e32_heapsize: U32<LE>,
pub e32_res3: [u8; 12],
pub e32_winresoff: U32<LE>,
pub e32_winreslen: U32<LE>,
pub e32_devid: U16<LE>,
pub e32_ddkver: U16<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageFileHeader {
pub machine: U16<LE>,
pub number_of_sections: U16<LE>,
pub time_date_stamp: U32<LE>,
pub pointer_to_symbol_table: U32<LE>,
pub number_of_symbols: U32<LE>,
pub size_of_optional_header: U16<LE>,
pub characteristics: U16<LE>,
}
pub const IMAGE_SIZEOF_FILE_HEADER: usize = 20;
pub const IMAGE_FILE_RELOCS_STRIPPED: u16 = 0x0001;
pub const IMAGE_FILE_EXECUTABLE_IMAGE: u16 = 0x0002;
pub const IMAGE_FILE_LINE_NUMS_STRIPPED: u16 = 0x0004;
pub const IMAGE_FILE_LOCAL_SYMS_STRIPPED: u16 = 0x0008;
pub const IMAGE_FILE_AGGRESIVE_WS_TRIM: u16 = 0x0010;
pub const IMAGE_FILE_LARGE_ADDRESS_AWARE: u16 = 0x0020;
pub const IMAGE_FILE_BYTES_REVERSED_LO: u16 = 0x0080;
pub const IMAGE_FILE_32BIT_MACHINE: u16 = 0x0100;
pub const IMAGE_FILE_DEBUG_STRIPPED: u16 = 0x0200;
pub const IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP: u16 = 0x0400;
pub const IMAGE_FILE_NET_RUN_FROM_SWAP: u16 = 0x0800;
pub const IMAGE_FILE_SYSTEM: u16 = 0x1000;
pub const IMAGE_FILE_DLL: u16 = 0x2000;
pub const IMAGE_FILE_UP_SYSTEM_ONLY: u16 = 0x4000;
pub const IMAGE_FILE_BYTES_REVERSED_HI: u16 = 0x8000;
pub const IMAGE_FILE_MACHINE_UNKNOWN: u16 = 0;
pub const IMAGE_FILE_MACHINE_TARGET_HOST: u16 = 0x0001;
pub const IMAGE_FILE_MACHINE_I386: u16 = 0x014c;
pub const IMAGE_FILE_MACHINE_R3000: u16 = 0x0162;
pub const IMAGE_FILE_MACHINE_R4000: u16 = 0x0166;
pub const IMAGE_FILE_MACHINE_R10000: u16 = 0x0168;
pub const IMAGE_FILE_MACHINE_WCEMIPSV2: u16 = 0x0169;
pub const IMAGE_FILE_MACHINE_ALPHA: u16 = 0x0184;
pub const IMAGE_FILE_MACHINE_SH3: u16 = 0x01a2;
pub const IMAGE_FILE_MACHINE_SH3DSP: u16 = 0x01a3;
pub const IMAGE_FILE_MACHINE_SH3E: u16 = 0x01a4;
pub const IMAGE_FILE_MACHINE_SH4: u16 = 0x01a6;
pub const IMAGE_FILE_MACHINE_SH5: u16 = 0x01a8;
pub const IMAGE_FILE_MACHINE_ARM: u16 = 0x01c0;
pub const IMAGE_FILE_MACHINE_THUMB: u16 = 0x01c2;
pub const IMAGE_FILE_MACHINE_ARMNT: u16 = 0x01c4;
pub const IMAGE_FILE_MACHINE_AM33: u16 = 0x01d3;
pub const IMAGE_FILE_MACHINE_POWERPC: u16 = 0x01F0;
pub const IMAGE_FILE_MACHINE_POWERPCFP: u16 = 0x01f1;
pub const IMAGE_FILE_MACHINE_IA64: u16 = 0x0200;
pub const IMAGE_FILE_MACHINE_MIPS16: u16 = 0x0266;
pub const IMAGE_FILE_MACHINE_ALPHA64: u16 = 0x0284;
pub const IMAGE_FILE_MACHINE_MIPSFPU: u16 = 0x0366;
pub const IMAGE_FILE_MACHINE_MIPSFPU16: u16 = 0x0466;
pub const IMAGE_FILE_MACHINE_AXP64: u16 = IMAGE_FILE_MACHINE_ALPHA64;
pub const IMAGE_FILE_MACHINE_TRICORE: u16 = 0x0520;
pub const IMAGE_FILE_MACHINE_CEF: u16 = 0x0CEF;
pub const IMAGE_FILE_MACHINE_EBC: u16 = 0x0EBC;
pub const IMAGE_FILE_MACHINE_AMD64: u16 = 0x8664;
pub const IMAGE_FILE_MACHINE_M32R: u16 = 0x9041;
pub const IMAGE_FILE_MACHINE_ARM64: u16 = 0xAA64;
pub const IMAGE_FILE_MACHINE_CEE: u16 = 0xC0EE;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDataDirectory {
pub virtual_address: U32<LE>,
pub size: U32<LE>,
}
pub const IMAGE_NUMBEROF_DIRECTORY_ENTRIES: usize = 16;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageOptionalHeader32 {
pub magic: U16<LE>,
pub major_linker_version: u8,
pub minor_linker_version: u8,
pub size_of_code: U32<LE>,
pub size_of_initialized_data: U32<LE>,
pub size_of_uninitialized_data: U32<LE>,
pub address_of_entry_point: U32<LE>,
pub base_of_code: U32<LE>,
pub base_of_data: U32<LE>,
pub image_base: U32<LE>,
pub section_alignment: U32<LE>,
pub file_alignment: U32<LE>,
pub major_operating_system_version: U16<LE>,
pub minor_operating_system_version: U16<LE>,
pub major_image_version: U16<LE>,
pub minor_image_version: U16<LE>,
pub major_subsystem_version: U16<LE>,
pub minor_subsystem_version: U16<LE>,
pub win32_version_value: U32<LE>,
pub size_of_image: U32<LE>,
pub size_of_headers: U32<LE>,
pub check_sum: U32<LE>,
pub subsystem: U16<LE>,
pub dll_characteristics: U16<LE>,
pub size_of_stack_reserve: U32<LE>,
pub size_of_stack_commit: U32<LE>,
pub size_of_heap_reserve: U32<LE>,
pub size_of_heap_commit: U32<LE>,
pub loader_flags: U32<LE>,
pub number_of_rva_and_sizes: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageRomOptionalHeader {
pub magic: U16<LE>,
pub major_linker_version: u8,
pub minor_linker_version: u8,
pub size_of_code: U32<LE>,
pub size_of_initialized_data: U32<LE>,
pub size_of_uninitialized_data: U32<LE>,
pub address_of_entry_point: U32<LE>,
pub base_of_code: U32<LE>,
pub base_of_data: U32<LE>,
pub base_of_bss: U32<LE>,
pub gpr_mask: U32<LE>,
pub cpr_mask: [U32<LE>; 4],
pub gp_value: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageOptionalHeader64 {
pub magic: U16<LE>,
pub major_linker_version: u8,
pub minor_linker_version: u8,
pub size_of_code: U32<LE>,
pub size_of_initialized_data: U32<LE>,
pub size_of_uninitialized_data: U32<LE>,
pub address_of_entry_point: U32<LE>,
pub base_of_code: U32<LE>,
pub image_base: U64<LE>,
pub section_alignment: U32<LE>,
pub file_alignment: U32<LE>,
pub major_operating_system_version: U16<LE>,
pub minor_operating_system_version: U16<LE>,
pub major_image_version: U16<LE>,
pub minor_image_version: U16<LE>,
pub major_subsystem_version: U16<LE>,
pub minor_subsystem_version: U16<LE>,
pub win32_version_value: U32<LE>,
pub size_of_image: U32<LE>,
pub size_of_headers: U32<LE>,
pub check_sum: U32<LE>,
pub subsystem: U16<LE>,
pub dll_characteristics: U16<LE>,
pub size_of_stack_reserve: U64<LE>,
pub size_of_stack_commit: U64<LE>,
pub size_of_heap_reserve: U64<LE>,
pub size_of_heap_commit: U64<LE>,
pub loader_flags: U32<LE>,
pub number_of_rva_and_sizes: U32<LE>,
}
pub const IMAGE_NT_OPTIONAL_HDR32_MAGIC: u16 = 0x10b;
pub const IMAGE_NT_OPTIONAL_HDR64_MAGIC: u16 = 0x20b;
pub const IMAGE_ROM_OPTIONAL_HDR_MAGIC: u16 = 0x107;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageNtHeaders64 {
pub signature: U32<LE>,
pub file_header: ImageFileHeader,
pub optional_header: ImageOptionalHeader64,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageNtHeaders32 {
pub signature: U32<LE>,
pub file_header: ImageFileHeader,
pub optional_header: ImageOptionalHeader32,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageRomHeaders {
pub file_header: ImageFileHeader,
pub optional_header: ImageRomOptionalHeader,
}
pub const IMAGE_SUBSYSTEM_UNKNOWN: u16 = 0;
pub const IMAGE_SUBSYSTEM_NATIVE: u16 = 1;
pub const IMAGE_SUBSYSTEM_WINDOWS_GUI: u16 = 2;
pub const IMAGE_SUBSYSTEM_WINDOWS_CUI: u16 = 3;
pub const IMAGE_SUBSYSTEM_OS2_CUI: u16 = 5;
pub const IMAGE_SUBSYSTEM_POSIX_CUI: u16 = 7;
pub const IMAGE_SUBSYSTEM_NATIVE_WINDOWS: u16 = 8;
pub const IMAGE_SUBSYSTEM_WINDOWS_CE_GUI: u16 = 9;
pub const IMAGE_SUBSYSTEM_EFI_APPLICATION: u16 = 10;
pub const IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER: u16 = 11;
pub const IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER: u16 = 12;
pub const IMAGE_SUBSYSTEM_EFI_ROM: u16 = 13;
pub const IMAGE_SUBSYSTEM_XBOX: u16 = 14;
pub const IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION: u16 = 16;
pub const IMAGE_SUBSYSTEM_XBOX_CODE_CATALOG: u16 = 17;
pub const IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA: u16 = 0x0020;
pub const IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE: u16 = 0x0040;
pub const IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY: u16 = 0x0080;
pub const IMAGE_DLLCHARACTERISTICS_NX_COMPAT: u16 = 0x0100;
pub const IMAGE_DLLCHARACTERISTICS_NO_ISOLATION: u16 = 0x0200;
pub const IMAGE_DLLCHARACTERISTICS_NO_SEH: u16 = 0x0400;
pub const IMAGE_DLLCHARACTERISTICS_NO_BIND: u16 = 0x0800;
pub const IMAGE_DLLCHARACTERISTICS_APPCONTAINER: u16 = 0x1000;
pub const IMAGE_DLLCHARACTERISTICS_WDM_DRIVER: u16 = 0x2000;
pub const IMAGE_DLLCHARACTERISTICS_GUARD_CF: u16 = 0x4000;
pub const IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE: u16 = 0x8000;
pub const IMAGE_DIRECTORY_ENTRY_EXPORT: usize = 0;
pub const IMAGE_DIRECTORY_ENTRY_IMPORT: usize = 1;
pub const IMAGE_DIRECTORY_ENTRY_RESOURCE: usize = 2;
pub const IMAGE_DIRECTORY_ENTRY_EXCEPTION: usize = 3;
pub const IMAGE_DIRECTORY_ENTRY_SECURITY: usize = 4;
pub const IMAGE_DIRECTORY_ENTRY_BASERELOC: usize = 5;
pub const IMAGE_DIRECTORY_ENTRY_DEBUG: usize = 6;
pub const IMAGE_DIRECTORY_ENTRY_ARCHITECTURE: usize = 7;
pub const IMAGE_DIRECTORY_ENTRY_GLOBALPTR: usize = 8;
pub const IMAGE_DIRECTORY_ENTRY_TLS: usize = 9;
pub const IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG: usize = 10;
pub const IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT: usize = 11;
pub const IMAGE_DIRECTORY_ENTRY_IAT: usize = 12;
pub const IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT: usize = 13;
pub const IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR: usize = 14;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct Guid {
pub data1: U32<LE>,
pub data2: U16<LE>,
pub data3: U16<LE>,
pub data4: [u8; 8],
}
pub type ClsId = Guid;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct AnonObjectHeader {
pub sig1: U16<LE>,
pub sig2: U16<LE>,
pub version: U16<LE>,
pub machine: U16<LE>,
pub time_date_stamp: U32<LE>,
pub class_id: ClsId,
pub size_of_data: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct AnonObjectHeaderV2 {
pub sig1: U16<LE>,
pub sig2: U16<LE>,
pub version: U16<LE>,
pub machine: U16<LE>,
pub time_date_stamp: U32<LE>,
pub class_id: ClsId,
pub size_of_data: U32<LE>,
pub flags: U32<LE>,
pub meta_data_size: U32<LE>,
pub meta_data_offset: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct AnonObjectHeaderBigobj {
pub sig1: U16<LE>,
pub sig2: U16<LE>,
pub version: U16<LE>,
pub machine: U16<LE>,
pub time_date_stamp: U32<LE>,
pub class_id: ClsId,
pub size_of_data: U32<LE>,
pub flags: U32<LE>,
pub meta_data_size: U32<LE>,
pub meta_data_offset: U32<LE>,
pub number_of_sections: U32<LE>,
pub pointer_to_symbol_table: U32<LE>,
pub number_of_symbols: U32<LE>,
}
pub const IMAGE_SIZEOF_SHORT_NAME: usize = 8;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageSectionHeader {
pub name: [u8; IMAGE_SIZEOF_SHORT_NAME],
pub virtual_size: U32<LE>,
pub virtual_address: U32<LE>,
pub size_of_raw_data: U32<LE>,
pub pointer_to_raw_data: U32<LE>,
pub pointer_to_relocations: U32<LE>,
pub pointer_to_linenumbers: U32<LE>,
pub number_of_relocations: U16<LE>,
pub number_of_linenumbers: U16<LE>,
pub characteristics: U32<LE>,
}
pub const IMAGE_SIZEOF_SECTION_HEADER: usize = 40;
pub const IMAGE_SCN_TYPE_NO_PAD: u32 = 0x0000_0008;
pub const IMAGE_SCN_CNT_CODE: u32 = 0x0000_0020;
pub const IMAGE_SCN_CNT_INITIALIZED_DATA: u32 = 0x0000_0040;
pub const IMAGE_SCN_CNT_UNINITIALIZED_DATA: u32 = 0x0000_0080;
pub const IMAGE_SCN_LNK_OTHER: u32 = 0x0000_0100;
pub const IMAGE_SCN_LNK_INFO: u32 = 0x0000_0200;
pub const IMAGE_SCN_LNK_REMOVE: u32 = 0x0000_0800;
pub const IMAGE_SCN_LNK_COMDAT: u32 = 0x0000_1000;
pub const IMAGE_SCN_NO_DEFER_SPEC_EXC: u32 = 0x0000_4000;
pub const IMAGE_SCN_GPREL: u32 = 0x0000_8000;
pub const IMAGE_SCN_MEM_FARDATA: u32 = 0x0000_8000;
pub const IMAGE_SCN_MEM_PURGEABLE: u32 = 0x0002_0000;
pub const IMAGE_SCN_MEM_16BIT: u32 = 0x0002_0000;
pub const IMAGE_SCN_MEM_LOCKED: u32 = 0x0004_0000;
pub const IMAGE_SCN_MEM_PRELOAD: u32 = 0x0008_0000;
pub const IMAGE_SCN_ALIGN_1BYTES: u32 = 0x0010_0000;
pub const IMAGE_SCN_ALIGN_2BYTES: u32 = 0x0020_0000;
pub const IMAGE_SCN_ALIGN_4BYTES: u32 = 0x0030_0000;
pub const IMAGE_SCN_ALIGN_8BYTES: u32 = 0x0040_0000;
pub const IMAGE_SCN_ALIGN_16BYTES: u32 = 0x0050_0000;
pub const IMAGE_SCN_ALIGN_32BYTES: u32 = 0x0060_0000;
pub const IMAGE_SCN_ALIGN_64BYTES: u32 = 0x0070_0000;
pub const IMAGE_SCN_ALIGN_128BYTES: u32 = 0x0080_0000;
pub const IMAGE_SCN_ALIGN_256BYTES: u32 = 0x0090_0000;
pub const IMAGE_SCN_ALIGN_512BYTES: u32 = 0x00A0_0000;
pub const IMAGE_SCN_ALIGN_1024BYTES: u32 = 0x00B0_0000;
pub const IMAGE_SCN_ALIGN_2048BYTES: u32 = 0x00C0_0000;
pub const IMAGE_SCN_ALIGN_4096BYTES: u32 = 0x00D0_0000;
pub const IMAGE_SCN_ALIGN_8192BYTES: u32 = 0x00E0_0000;
pub const IMAGE_SCN_ALIGN_MASK: u32 = 0x00F0_0000;
pub const IMAGE_SCN_LNK_NRELOC_OVFL: u32 = 0x0100_0000;
pub const IMAGE_SCN_MEM_DISCARDABLE: u32 = 0x0200_0000;
pub const IMAGE_SCN_MEM_NOT_CACHED: u32 = 0x0400_0000;
pub const IMAGE_SCN_MEM_NOT_PAGED: u32 = 0x0800_0000;
pub const IMAGE_SCN_MEM_SHARED: u32 = 0x1000_0000;
pub const IMAGE_SCN_MEM_EXECUTE: u32 = 0x2000_0000;
pub const IMAGE_SCN_MEM_READ: u32 = 0x4000_0000;
pub const IMAGE_SCN_MEM_WRITE: u32 = 0x8000_0000;
pub const IMAGE_SCN_SCALE_INDEX: u32 = 0x0000_0001;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageSymbol {
pub name: [u8; 8],
pub value: U32Bytes<LE>,
pub section_number: U16Bytes<LE>,
pub typ: U16Bytes<LE>,
pub storage_class: u8,
pub number_of_aux_symbols: u8,
}
pub const IMAGE_SIZEOF_SYMBOL: usize = 18;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageSymbolBytes(pub [u8; IMAGE_SIZEOF_SYMBOL]);
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageSymbolEx {
pub name: [u8; 8],
pub value: U32Bytes<LE>,
pub section_number: U32Bytes<LE>,
pub typ: U16Bytes<LE>,
pub storage_class: u8,
pub number_of_aux_symbols: u8,
}
pub const IMAGE_SIZEOF_SYMBOL_EX: usize = 20;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageSymbolExBytes(pub [u8; IMAGE_SIZEOF_SYMBOL_EX]);
pub const IMAGE_SYM_UNDEFINED: u16 = 0;
pub const IMAGE_SYM_ABSOLUTE: u16 = 0xffff;
pub const IMAGE_SYM_DEBUG: u16 = 0xfffe;
pub const IMAGE_SYM_SECTION_MAX: u16 = 0xFEFF;
pub const IMAGE_SYM_SECTION_MAX_EX: u32 = 0x7fff_ffff;
pub const IMAGE_SYM_TYPE_NULL: u16 = 0x0000;
pub const IMAGE_SYM_TYPE_VOID: u16 = 0x0001;
pub const IMAGE_SYM_TYPE_CHAR: u16 = 0x0002;
pub const IMAGE_SYM_TYPE_SHORT: u16 = 0x0003;
pub const IMAGE_SYM_TYPE_INT: u16 = 0x0004;
pub const IMAGE_SYM_TYPE_LONG: u16 = 0x0005;
pub const IMAGE_SYM_TYPE_FLOAT: u16 = 0x0006;
pub const IMAGE_SYM_TYPE_DOUBLE: u16 = 0x0007;
pub const IMAGE_SYM_TYPE_STRUCT: u16 = 0x0008;
pub const IMAGE_SYM_TYPE_UNION: u16 = 0x0009;
pub const IMAGE_SYM_TYPE_ENUM: u16 = 0x000A;
pub const IMAGE_SYM_TYPE_MOE: u16 = 0x000B;
pub const IMAGE_SYM_TYPE_BYTE: u16 = 0x000C;
pub const IMAGE_SYM_TYPE_WORD: u16 = 0x000D;
pub const IMAGE_SYM_TYPE_UINT: u16 = 0x000E;
pub const IMAGE_SYM_TYPE_DWORD: u16 = 0x000F;
pub const IMAGE_SYM_TYPE_PCODE: u16 = 0x8000;
pub const IMAGE_SYM_DTYPE_NULL: u16 = 0;
pub const IMAGE_SYM_DTYPE_POINTER: u16 = 1;
pub const IMAGE_SYM_DTYPE_FUNCTION: u16 = 2;
pub const IMAGE_SYM_DTYPE_ARRAY: u16 = 3;
pub const IMAGE_SYM_CLASS_END_OF_FUNCTION: u8 = 0xff;
pub const IMAGE_SYM_CLASS_NULL: u8 = 0x00;
pub const IMAGE_SYM_CLASS_AUTOMATIC: u8 = 0x01;
pub const IMAGE_SYM_CLASS_EXTERNAL: u8 = 0x02;
pub const IMAGE_SYM_CLASS_STATIC: u8 = 0x03;
pub const IMAGE_SYM_CLASS_REGISTER: u8 = 0x04;
pub const IMAGE_SYM_CLASS_EXTERNAL_DEF: u8 = 0x05;
pub const IMAGE_SYM_CLASS_LABEL: u8 = 0x06;
pub const IMAGE_SYM_CLASS_UNDEFINED_LABEL: u8 = 0x07;
pub const IMAGE_SYM_CLASS_MEMBER_OF_STRUCT: u8 = 0x08;
pub const IMAGE_SYM_CLASS_ARGUMENT: u8 = 0x09;
pub const IMAGE_SYM_CLASS_STRUCT_TAG: u8 = 0x0A;
pub const IMAGE_SYM_CLASS_MEMBER_OF_UNION: u8 = 0x0B;
pub const IMAGE_SYM_CLASS_UNION_TAG: u8 = 0x0C;
pub const IMAGE_SYM_CLASS_TYPE_DEFINITION: u8 = 0x0D;
pub const IMAGE_SYM_CLASS_UNDEFINED_STATIC: u8 = 0x0E;
pub const IMAGE_SYM_CLASS_ENUM_TAG: u8 = 0x0F;
pub const IMAGE_SYM_CLASS_MEMBER_OF_ENUM: u8 = 0x10;
pub const IMAGE_SYM_CLASS_REGISTER_PARAM: u8 = 0x11;
pub const IMAGE_SYM_CLASS_BIT_FIELD: u8 = 0x12;
pub const IMAGE_SYM_CLASS_FAR_EXTERNAL: u8 = 0x44;
pub const IMAGE_SYM_CLASS_BLOCK: u8 = 0x64;
pub const IMAGE_SYM_CLASS_FUNCTION: u8 = 0x65;
pub const IMAGE_SYM_CLASS_END_OF_STRUCT: u8 = 0x66;
pub const IMAGE_SYM_CLASS_FILE: u8 = 0x67;
pub const IMAGE_SYM_CLASS_SECTION: u8 = 0x68;
pub const IMAGE_SYM_CLASS_WEAK_EXTERNAL: u8 = 0x69;
pub const IMAGE_SYM_CLASS_CLR_TOKEN: u8 = 0x6B;
pub const N_BTMASK: u16 = 0x000F;
pub const N_TMASK: u16 = 0x0030;
pub const N_TMASK1: u16 = 0x00C0;
pub const N_TMASK2: u16 = 0x00F0;
pub const N_BTSHFT: usize = 4;
pub const N_TSHIFT: usize = 2;
pub const IMAGE_SYM_DTYPE_SHIFT: usize = N_BTSHFT;
impl ImageSymbol {
#[inline]
pub fn base_type(&self) -> u16 {
self.typ.get(LE) & N_BTMASK
}
#[inline]
pub fn derived_type(&self) -> u16 {
(self.typ.get(LE) & N_TMASK) >> N_BTSHFT
}
}
impl ImageSymbolEx {
#[inline]
pub fn base_type(&self) -> u16 {
self.typ.get(LE) & N_BTMASK
}
#[inline]
pub fn derived_type(&self) -> u16 {
(self.typ.get(LE) & N_TMASK) >> N_BTSHFT
}
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAuxSymbolTokenDef {
pub aux_type: u8,
pub reserved1: u8,
pub symbol_table_index: U32Bytes<LE>,
pub reserved2: [u8; 12],
}
pub const IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF: u16 = 1;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAuxSymbolFunction {
pub tag_index: U32Bytes<LE>,
pub total_size: U32Bytes<LE>,
pub pointer_to_linenumber: U32Bytes<LE>,
pub pointer_to_next_function: U32Bytes<LE>,
pub unused: [u8; 2],
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAuxSymbolFunctionBeginEnd {
pub unused1: [u8; 4],
pub linenumber: U16Bytes<LE>,
pub unused2: [u8; 6],
pub pointer_to_next_function: U32Bytes<LE>,
pub unused3: [u8; 2],
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAuxSymbolWeak {
pub weak_default_sym_index: U32Bytes<LE>,
pub weak_search_type: U32Bytes<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAuxSymbolSection {
pub length: U32Bytes<LE>,
pub number_of_relocations: U16Bytes<LE>,
pub number_of_linenumbers: U16Bytes<LE>,
pub check_sum: U32Bytes<LE>,
pub number: U16Bytes<LE>,
pub selection: u8,
pub reserved: u8,
pub high_number: U16Bytes<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAuxSymbolCrc {
pub crc: U32Bytes<LE>,
}
pub const IMAGE_COMDAT_SELECT_NODUPLICATES: u8 = 1;
pub const IMAGE_COMDAT_SELECT_ANY: u8 = 2;
pub const IMAGE_COMDAT_SELECT_SAME_SIZE: u8 = 3;
pub const IMAGE_COMDAT_SELECT_EXACT_MATCH: u8 = 4;
pub const IMAGE_COMDAT_SELECT_ASSOCIATIVE: u8 = 5;
pub const IMAGE_COMDAT_SELECT_LARGEST: u8 = 6;
pub const IMAGE_COMDAT_SELECT_NEWEST: u8 = 7;
pub const IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY: u16 = 1;
pub const IMAGE_WEAK_EXTERN_SEARCH_LIBRARY: u16 = 2;
pub const IMAGE_WEAK_EXTERN_SEARCH_ALIAS: u16 = 3;
pub const IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY: u16 = 4;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageRelocation {
pub virtual_address: U32Bytes<LE>,
pub symbol_table_index: U32Bytes<LE>,
pub typ: U16Bytes<LE>,
}
pub const IMAGE_REL_I386_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_I386_DIR16: u16 = 0x0001;
pub const IMAGE_REL_I386_REL16: u16 = 0x0002;
pub const IMAGE_REL_I386_DIR32: u16 = 0x0006;
pub const IMAGE_REL_I386_DIR32NB: u16 = 0x0007;
pub const IMAGE_REL_I386_SEG12: u16 = 0x0009;
pub const IMAGE_REL_I386_SECTION: u16 = 0x000A;
pub const IMAGE_REL_I386_SECREL: u16 = 0x000B;
pub const IMAGE_REL_I386_TOKEN: u16 = 0x000C;
pub const IMAGE_REL_I386_SECREL7: u16 = 0x000D;
pub const IMAGE_REL_I386_REL32: u16 = 0x0014;
pub const IMAGE_REL_MIPS_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_MIPS_REFHALF: u16 = 0x0001;
pub const IMAGE_REL_MIPS_REFWORD: u16 = 0x0002;
pub const IMAGE_REL_MIPS_JMPADDR: u16 = 0x0003;
pub const IMAGE_REL_MIPS_REFHI: u16 = 0x0004;
pub const IMAGE_REL_MIPS_REFLO: u16 = 0x0005;
pub const IMAGE_REL_MIPS_GPREL: u16 = 0x0006;
pub const IMAGE_REL_MIPS_LITERAL: u16 = 0x0007;
pub const IMAGE_REL_MIPS_SECTION: u16 = 0x000A;
pub const IMAGE_REL_MIPS_SECREL: u16 = 0x000B;
pub const IMAGE_REL_MIPS_SECRELLO: u16 = 0x000C;
pub const IMAGE_REL_MIPS_SECRELHI: u16 = 0x000D;
pub const IMAGE_REL_MIPS_TOKEN: u16 = 0x000E;
pub const IMAGE_REL_MIPS_JMPADDR16: u16 = 0x0010;
pub const IMAGE_REL_MIPS_REFWORDNB: u16 = 0x0022;
pub const IMAGE_REL_MIPS_PAIR: u16 = 0x0025;
pub const IMAGE_REL_ALPHA_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_ALPHA_REFLONG: u16 = 0x0001;
pub const IMAGE_REL_ALPHA_REFQUAD: u16 = 0x0002;
pub const IMAGE_REL_ALPHA_GPREL32: u16 = 0x0003;
pub const IMAGE_REL_ALPHA_LITERAL: u16 = 0x0004;
pub const IMAGE_REL_ALPHA_LITUSE: u16 = 0x0005;
pub const IMAGE_REL_ALPHA_GPDISP: u16 = 0x0006;
pub const IMAGE_REL_ALPHA_BRADDR: u16 = 0x0007;
pub const IMAGE_REL_ALPHA_HINT: u16 = 0x0008;
pub const IMAGE_REL_ALPHA_INLINE_REFLONG: u16 = 0x0009;
pub const IMAGE_REL_ALPHA_REFHI: u16 = 0x000A;
pub const IMAGE_REL_ALPHA_REFLO: u16 = 0x000B;
pub const IMAGE_REL_ALPHA_PAIR: u16 = 0x000C;
pub const IMAGE_REL_ALPHA_MATCH: u16 = 0x000D;
pub const IMAGE_REL_ALPHA_SECTION: u16 = 0x000E;
pub const IMAGE_REL_ALPHA_SECREL: u16 = 0x000F;
pub const IMAGE_REL_ALPHA_REFLONGNB: u16 = 0x0010;
pub const IMAGE_REL_ALPHA_SECRELLO: u16 = 0x0011;
pub const IMAGE_REL_ALPHA_SECRELHI: u16 = 0x0012;
pub const IMAGE_REL_ALPHA_REFQ3: u16 = 0x0013;
pub const IMAGE_REL_ALPHA_REFQ2: u16 = 0x0014;
pub const IMAGE_REL_ALPHA_REFQ1: u16 = 0x0015;
pub const IMAGE_REL_ALPHA_GPRELLO: u16 = 0x0016;
pub const IMAGE_REL_ALPHA_GPRELHI: u16 = 0x0017;
pub const IMAGE_REL_PPC_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_PPC_ADDR64: u16 = 0x0001;
pub const IMAGE_REL_PPC_ADDR32: u16 = 0x0002;
pub const IMAGE_REL_PPC_ADDR24: u16 = 0x0003;
pub const IMAGE_REL_PPC_ADDR16: u16 = 0x0004;
pub const IMAGE_REL_PPC_ADDR14: u16 = 0x0005;
pub const IMAGE_REL_PPC_REL24: u16 = 0x0006;
pub const IMAGE_REL_PPC_REL14: u16 = 0x0007;
pub const IMAGE_REL_PPC_TOCREL16: u16 = 0x0008;
pub const IMAGE_REL_PPC_TOCREL14: u16 = 0x0009;
pub const IMAGE_REL_PPC_ADDR32NB: u16 = 0x000A;
pub const IMAGE_REL_PPC_SECREL: u16 = 0x000B;
pub const IMAGE_REL_PPC_SECTION: u16 = 0x000C;
pub const IMAGE_REL_PPC_IFGLUE: u16 = 0x000D;
pub const IMAGE_REL_PPC_IMGLUE: u16 = 0x000E;
pub const IMAGE_REL_PPC_SECREL16: u16 = 0x000F;
pub const IMAGE_REL_PPC_REFHI: u16 = 0x0010;
pub const IMAGE_REL_PPC_REFLO: u16 = 0x0011;
pub const IMAGE_REL_PPC_PAIR: u16 = 0x0012;
pub const IMAGE_REL_PPC_SECRELLO: u16 = 0x0013;
pub const IMAGE_REL_PPC_SECRELHI: u16 = 0x0014;
pub const IMAGE_REL_PPC_GPREL: u16 = 0x0015;
pub const IMAGE_REL_PPC_TOKEN: u16 = 0x0016;
pub const IMAGE_REL_PPC_TYPEMASK: u16 = 0x00FF;
pub const IMAGE_REL_PPC_NEG: u16 = 0x0100;
pub const IMAGE_REL_PPC_BRTAKEN: u16 = 0x0200;
pub const IMAGE_REL_PPC_BRNTAKEN: u16 = 0x0400;
pub const IMAGE_REL_PPC_TOCDEFN: u16 = 0x0800;
pub const IMAGE_REL_SH3_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_SH3_DIRECT16: u16 = 0x0001;
pub const IMAGE_REL_SH3_DIRECT32: u16 = 0x0002;
pub const IMAGE_REL_SH3_DIRECT8: u16 = 0x0003;
pub const IMAGE_REL_SH3_DIRECT8_WORD: u16 = 0x0004;
pub const IMAGE_REL_SH3_DIRECT8_LONG: u16 = 0x0005;
pub const IMAGE_REL_SH3_DIRECT4: u16 = 0x0006;
pub const IMAGE_REL_SH3_DIRECT4_WORD: u16 = 0x0007;
pub const IMAGE_REL_SH3_DIRECT4_LONG: u16 = 0x0008;
pub const IMAGE_REL_SH3_PCREL8_WORD: u16 = 0x0009;
pub const IMAGE_REL_SH3_PCREL8_LONG: u16 = 0x000A;
pub const IMAGE_REL_SH3_PCREL12_WORD: u16 = 0x000B;
pub const IMAGE_REL_SH3_STARTOF_SECTION: u16 = 0x000C;
pub const IMAGE_REL_SH3_SIZEOF_SECTION: u16 = 0x000D;
pub const IMAGE_REL_SH3_SECTION: u16 = 0x000E;
pub const IMAGE_REL_SH3_SECREL: u16 = 0x000F;
pub const IMAGE_REL_SH3_DIRECT32_NB: u16 = 0x0010;
pub const IMAGE_REL_SH3_GPREL4_LONG: u16 = 0x0011;
pub const IMAGE_REL_SH3_TOKEN: u16 = 0x0012;
pub const IMAGE_REL_SHM_PCRELPT: u16 = 0x0013;
pub const IMAGE_REL_SHM_REFLO: u16 = 0x0014;
pub const IMAGE_REL_SHM_REFHALF: u16 = 0x0015;
pub const IMAGE_REL_SHM_RELLO: u16 = 0x0016;
pub const IMAGE_REL_SHM_RELHALF: u16 = 0x0017;
pub const IMAGE_REL_SHM_PAIR: u16 = 0x0018;
pub const IMAGE_REL_SH_NOMODE: u16 = 0x8000;
pub const IMAGE_REL_ARM_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_ARM_ADDR32: u16 = 0x0001;
pub const IMAGE_REL_ARM_ADDR32NB: u16 = 0x0002;
pub const IMAGE_REL_ARM_BRANCH24: u16 = 0x0003;
pub const IMAGE_REL_ARM_BRANCH11: u16 = 0x0004;
pub const IMAGE_REL_ARM_TOKEN: u16 = 0x0005;
pub const IMAGE_REL_ARM_GPREL12: u16 = 0x0006;
pub const IMAGE_REL_ARM_GPREL7: u16 = 0x0007;
pub const IMAGE_REL_ARM_BLX24: u16 = 0x0008;
pub const IMAGE_REL_ARM_BLX11: u16 = 0x0009;
pub const IMAGE_REL_ARM_SECTION: u16 = 0x000E;
pub const IMAGE_REL_ARM_SECREL: u16 = 0x000F;
pub const IMAGE_REL_ARM_MOV32A: u16 = 0x0010;
pub const IMAGE_REL_ARM_MOV32: u16 = 0x0010;
pub const IMAGE_REL_ARM_MOV32T: u16 = 0x0011;
pub const IMAGE_REL_THUMB_MOV32: u16 = 0x0011;
pub const IMAGE_REL_ARM_BRANCH20T: u16 = 0x0012;
pub const IMAGE_REL_THUMB_BRANCH20: u16 = 0x0012;
pub const IMAGE_REL_ARM_BRANCH24T: u16 = 0x0014;
pub const IMAGE_REL_THUMB_BRANCH24: u16 = 0x0014;
pub const IMAGE_REL_ARM_BLX23T: u16 = 0x0015;
pub const IMAGE_REL_THUMB_BLX23: u16 = 0x0015;
pub const IMAGE_REL_AM_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_AM_ADDR32: u16 = 0x0001;
pub const IMAGE_REL_AM_ADDR32NB: u16 = 0x0002;
pub const IMAGE_REL_AM_CALL32: u16 = 0x0003;
pub const IMAGE_REL_AM_FUNCINFO: u16 = 0x0004;
pub const IMAGE_REL_AM_REL32_1: u16 = 0x0005;
pub const IMAGE_REL_AM_REL32_2: u16 = 0x0006;
pub const IMAGE_REL_AM_SECREL: u16 = 0x0007;
pub const IMAGE_REL_AM_SECTION: u16 = 0x0008;
pub const IMAGE_REL_AM_TOKEN: u16 = 0x0009;
pub const IMAGE_REL_ARM64_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_ARM64_ADDR32: u16 = 0x0001;
pub const IMAGE_REL_ARM64_ADDR32NB: u16 = 0x0002;
pub const IMAGE_REL_ARM64_BRANCH26: u16 = 0x0003;
pub const IMAGE_REL_ARM64_PAGEBASE_REL21: u16 = 0x0004;
pub const IMAGE_REL_ARM64_REL21: u16 = 0x0005;
pub const IMAGE_REL_ARM64_PAGEOFFSET_12A: u16 = 0x0006;
pub const IMAGE_REL_ARM64_PAGEOFFSET_12L: u16 = 0x0007;
pub const IMAGE_REL_ARM64_SECREL: u16 = 0x0008;
pub const IMAGE_REL_ARM64_SECREL_LOW12A: u16 = 0x0009;
pub const IMAGE_REL_ARM64_SECREL_HIGH12A: u16 = 0x000A;
pub const IMAGE_REL_ARM64_SECREL_LOW12L: u16 = 0x000B;
pub const IMAGE_REL_ARM64_TOKEN: u16 = 0x000C;
pub const IMAGE_REL_ARM64_SECTION: u16 = 0x000D;
pub const IMAGE_REL_ARM64_ADDR64: u16 = 0x000E;
pub const IMAGE_REL_ARM64_BRANCH19: u16 = 0x000F;
pub const IMAGE_REL_AMD64_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_AMD64_ADDR64: u16 = 0x0001;
pub const IMAGE_REL_AMD64_ADDR32: u16 = 0x0002;
pub const IMAGE_REL_AMD64_ADDR32NB: u16 = 0x0003;
pub const IMAGE_REL_AMD64_REL32: u16 = 0x0004;
pub const IMAGE_REL_AMD64_REL32_1: u16 = 0x0005;
pub const IMAGE_REL_AMD64_REL32_2: u16 = 0x0006;
pub const IMAGE_REL_AMD64_REL32_3: u16 = 0x0007;
pub const IMAGE_REL_AMD64_REL32_4: u16 = 0x0008;
pub const IMAGE_REL_AMD64_REL32_5: u16 = 0x0009;
pub const IMAGE_REL_AMD64_SECTION: u16 = 0x000A;
pub const IMAGE_REL_AMD64_SECREL: u16 = 0x000B;
pub const IMAGE_REL_AMD64_SECREL7: u16 = 0x000C;
pub const IMAGE_REL_AMD64_TOKEN: u16 = 0x000D;
pub const IMAGE_REL_AMD64_SREL32: u16 = 0x000E;
pub const IMAGE_REL_AMD64_PAIR: u16 = 0x000F;
pub const IMAGE_REL_AMD64_SSPAN32: u16 = 0x0010;
pub const IMAGE_REL_AMD64_EHANDLER: u16 = 0x0011;
pub const IMAGE_REL_AMD64_IMPORT_BR: u16 = 0x0012;
pub const IMAGE_REL_AMD64_IMPORT_CALL: u16 = 0x0013;
pub const IMAGE_REL_AMD64_CFG_BR: u16 = 0x0014;
pub const IMAGE_REL_AMD64_CFG_BR_REX: u16 = 0x0015;
pub const IMAGE_REL_AMD64_CFG_CALL: u16 = 0x0016;
pub const IMAGE_REL_AMD64_INDIR_BR: u16 = 0x0017;
pub const IMAGE_REL_AMD64_INDIR_BR_REX: u16 = 0x0018;
pub const IMAGE_REL_AMD64_INDIR_CALL: u16 = 0x0019;
pub const IMAGE_REL_AMD64_INDIR_BR_SWITCHTABLE_FIRST: u16 = 0x0020;
pub const IMAGE_REL_AMD64_INDIR_BR_SWITCHTABLE_LAST: u16 = 0x002F;
pub const IMAGE_REL_IA64_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_IA64_IMM14: u16 = 0x0001;
pub const IMAGE_REL_IA64_IMM22: u16 = 0x0002;
pub const IMAGE_REL_IA64_IMM64: u16 = 0x0003;
pub const IMAGE_REL_IA64_DIR32: u16 = 0x0004;
pub const IMAGE_REL_IA64_DIR64: u16 = 0x0005;
pub const IMAGE_REL_IA64_PCREL21B: u16 = 0x0006;
pub const IMAGE_REL_IA64_PCREL21M: u16 = 0x0007;
pub const IMAGE_REL_IA64_PCREL21F: u16 = 0x0008;
pub const IMAGE_REL_IA64_GPREL22: u16 = 0x0009;
pub const IMAGE_REL_IA64_LTOFF22: u16 = 0x000A;
pub const IMAGE_REL_IA64_SECTION: u16 = 0x000B;
pub const IMAGE_REL_IA64_SECREL22: u16 = 0x000C;
pub const IMAGE_REL_IA64_SECREL64I: u16 = 0x000D;
pub const IMAGE_REL_IA64_SECREL32: u16 = 0x000E;
pub const IMAGE_REL_IA64_DIR32NB: u16 = 0x0010;
pub const IMAGE_REL_IA64_SREL14: u16 = 0x0011;
pub const IMAGE_REL_IA64_SREL22: u16 = 0x0012;
pub const IMAGE_REL_IA64_SREL32: u16 = 0x0013;
pub const IMAGE_REL_IA64_UREL32: u16 = 0x0014;
pub const IMAGE_REL_IA64_PCREL60X: u16 = 0x0015;
pub const IMAGE_REL_IA64_PCREL60B: u16 = 0x0016;
pub const IMAGE_REL_IA64_PCREL60F: u16 = 0x0017;
pub const IMAGE_REL_IA64_PCREL60I: u16 = 0x0018;
pub const IMAGE_REL_IA64_PCREL60M: u16 = 0x0019;
pub const IMAGE_REL_IA64_IMMGPREL64: u16 = 0x001A;
pub const IMAGE_REL_IA64_TOKEN: u16 = 0x001B;
pub const IMAGE_REL_IA64_GPREL32: u16 = 0x001C;
pub const IMAGE_REL_IA64_ADDEND: u16 = 0x001F;
pub const IMAGE_REL_CEF_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_CEF_ADDR32: u16 = 0x0001;
pub const IMAGE_REL_CEF_ADDR64: u16 = 0x0002;
pub const IMAGE_REL_CEF_ADDR32NB: u16 = 0x0003;
pub const IMAGE_REL_CEF_SECTION: u16 = 0x0004;
pub const IMAGE_REL_CEF_SECREL: u16 = 0x0005;
pub const IMAGE_REL_CEF_TOKEN: u16 = 0x0006;
pub const IMAGE_REL_CEE_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_CEE_ADDR32: u16 = 0x0001;
pub const IMAGE_REL_CEE_ADDR64: u16 = 0x0002;
pub const IMAGE_REL_CEE_ADDR32NB: u16 = 0x0003;
pub const IMAGE_REL_CEE_SECTION: u16 = 0x0004;
pub const IMAGE_REL_CEE_SECREL: u16 = 0x0005;
pub const IMAGE_REL_CEE_TOKEN: u16 = 0x0006;
pub const IMAGE_REL_M32R_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_M32R_ADDR32: u16 = 0x0001;
pub const IMAGE_REL_M32R_ADDR32NB: u16 = 0x0002;
pub const IMAGE_REL_M32R_ADDR24: u16 = 0x0003;
pub const IMAGE_REL_M32R_GPREL16: u16 = 0x0004;
pub const IMAGE_REL_M32R_PCREL24: u16 = 0x0005;
pub const IMAGE_REL_M32R_PCREL16: u16 = 0x0006;
pub const IMAGE_REL_M32R_PCREL8: u16 = 0x0007;
pub const IMAGE_REL_M32R_REFHALF: u16 = 0x0008;
pub const IMAGE_REL_M32R_REFHI: u16 = 0x0009;
pub const IMAGE_REL_M32R_REFLO: u16 = 0x000A;
pub const IMAGE_REL_M32R_PAIR: u16 = 0x000B;
pub const IMAGE_REL_M32R_SECTION: u16 = 0x000C;
pub const IMAGE_REL_M32R_SECREL32: u16 = 0x000D;
pub const IMAGE_REL_M32R_TOKEN: u16 = 0x000E;
pub const IMAGE_REL_EBC_ABSOLUTE: u16 = 0x0000;
pub const IMAGE_REL_EBC_ADDR32NB: u16 = 0x0001;
pub const IMAGE_REL_EBC_REL32: u16 = 0x0002;
pub const IMAGE_REL_EBC_SECTION: u16 = 0x0003;
pub const IMAGE_REL_EBC_SECREL: u16 = 0x0004;
pub const EMARCH_ENC_I17_IMM7B_INST_WORD_X: u16 = 3;
pub const EMARCH_ENC_I17_IMM7B_SIZE_X: u16 = 7;
pub const EMARCH_ENC_I17_IMM7B_INST_WORD_POS_X: u16 = 4;
pub const EMARCH_ENC_I17_IMM7B_VAL_POS_X: u16 = 0;
pub const EMARCH_ENC_I17_IMM9D_INST_WORD_X: u16 = 3;
pub const EMARCH_ENC_I17_IMM9D_SIZE_X: u16 = 9;
pub const EMARCH_ENC_I17_IMM9D_INST_WORD_POS_X: u16 = 18;
pub const EMARCH_ENC_I17_IMM9D_VAL_POS_X: u16 = 7;
pub const EMARCH_ENC_I17_IMM5C_INST_WORD_X: u16 = 3;
pub const EMARCH_ENC_I17_IMM5C_SIZE_X: u16 = 5;
pub const EMARCH_ENC_I17_IMM5C_INST_WORD_POS_X: u16 = 13;
pub const EMARCH_ENC_I17_IMM5C_VAL_POS_X: u16 = 16;
pub const EMARCH_ENC_I17_IC_INST_WORD_X: u16 = 3;
pub const EMARCH_ENC_I17_IC_SIZE_X: u16 = 1;
pub const EMARCH_ENC_I17_IC_INST_WORD_POS_X: u16 = 12;
pub const EMARCH_ENC_I17_IC_VAL_POS_X: u16 = 21;
pub const EMARCH_ENC_I17_IMM41A_INST_WORD_X: u16 = 1;
pub const EMARCH_ENC_I17_IMM41A_SIZE_X: u16 = 10;
pub const EMARCH_ENC_I17_IMM41A_INST_WORD_POS_X: u16 = 14;
pub const EMARCH_ENC_I17_IMM41A_VAL_POS_X: u16 = 22;
pub const EMARCH_ENC_I17_IMM41B_INST_WORD_X: u16 = 1;
pub const EMARCH_ENC_I17_IMM41B_SIZE_X: u16 = 8;
pub const EMARCH_ENC_I17_IMM41B_INST_WORD_POS_X: u16 = 24;
pub const EMARCH_ENC_I17_IMM41B_VAL_POS_X: u16 = 32;
pub const EMARCH_ENC_I17_IMM41C_INST_WORD_X: u16 = 2;
pub const EMARCH_ENC_I17_IMM41C_SIZE_X: u16 = 23;
pub const EMARCH_ENC_I17_IMM41C_INST_WORD_POS_X: u16 = 0;
pub const EMARCH_ENC_I17_IMM41C_VAL_POS_X: u16 = 40;
pub const EMARCH_ENC_I17_SIGN_INST_WORD_X: u16 = 3;
pub const EMARCH_ENC_I17_SIGN_SIZE_X: u16 = 1;
pub const EMARCH_ENC_I17_SIGN_INST_WORD_POS_X: u16 = 27;
pub const EMARCH_ENC_I17_SIGN_VAL_POS_X: u16 = 63;
pub const X3_OPCODE_INST_WORD_X: u16 = 3;
pub const X3_OPCODE_SIZE_X: u16 = 4;
pub const X3_OPCODE_INST_WORD_POS_X: u16 = 28;
pub const X3_OPCODE_SIGN_VAL_POS_X: u16 = 0;
pub const X3_I_INST_WORD_X: u16 = 3;
pub const X3_I_SIZE_X: u16 = 1;
pub const X3_I_INST_WORD_POS_X: u16 = 27;
pub const X3_I_SIGN_VAL_POS_X: u16 = 59;
pub const X3_D_WH_INST_WORD_X: u16 = 3;
pub const X3_D_WH_SIZE_X: u16 = 3;
pub const X3_D_WH_INST_WORD_POS_X: u16 = 24;
pub const X3_D_WH_SIGN_VAL_POS_X: u16 = 0;
pub const X3_IMM20_INST_WORD_X: u16 = 3;
pub const X3_IMM20_SIZE_X: u16 = 20;
pub const X3_IMM20_INST_WORD_POS_X: u16 = 4;
pub const X3_IMM20_SIGN_VAL_POS_X: u16 = 0;
pub const X3_IMM39_1_INST_WORD_X: u16 = 2;
pub const X3_IMM39_1_SIZE_X: u16 = 23;
pub const X3_IMM39_1_INST_WORD_POS_X: u16 = 0;
pub const X3_IMM39_1_SIGN_VAL_POS_X: u16 = 36;
pub const X3_IMM39_2_INST_WORD_X: u16 = 1;
pub const X3_IMM39_2_SIZE_X: u16 = 16;
pub const X3_IMM39_2_INST_WORD_POS_X: u16 = 16;
pub const X3_IMM39_2_SIGN_VAL_POS_X: u16 = 20;
pub const X3_P_INST_WORD_X: u16 = 3;
pub const X3_P_SIZE_X: u16 = 4;
pub const X3_P_INST_WORD_POS_X: u16 = 0;
pub const X3_P_SIGN_VAL_POS_X: u16 = 0;
pub const X3_TMPLT_INST_WORD_X: u16 = 0;
pub const X3_TMPLT_SIZE_X: u16 = 4;
pub const X3_TMPLT_INST_WORD_POS_X: u16 = 0;
pub const X3_TMPLT_SIGN_VAL_POS_X: u16 = 0;
pub const X3_BTYPE_QP_INST_WORD_X: u16 = 2;
pub const X3_BTYPE_QP_SIZE_X: u16 = 9;
pub const X3_BTYPE_QP_INST_WORD_POS_X: u16 = 23;
pub const X3_BTYPE_QP_INST_VAL_POS_X: u16 = 0;
pub const X3_EMPTY_INST_WORD_X: u16 = 1;
pub const X3_EMPTY_SIZE_X: u16 = 2;
pub const X3_EMPTY_INST_WORD_POS_X: u16 = 14;
pub const X3_EMPTY_INST_VAL_POS_X: u16 = 0;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageLinenumber {
pub symbol_table_index_or_virtual_address: U32Bytes<LE>,
pub linenumber: U16Bytes<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageBaseRelocation {
pub virtual_address: U32Bytes<LE>,
pub size_of_block: U32Bytes<LE>,
}
pub const IMAGE_REL_BASED_ABSOLUTE: u16 = 0;
pub const IMAGE_REL_BASED_HIGH: u16 = 1;
pub const IMAGE_REL_BASED_LOW: u16 = 2;
pub const IMAGE_REL_BASED_HIGHLOW: u16 = 3;
pub const IMAGE_REL_BASED_HIGHADJ: u16 = 4;
pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_5: u16 = 5;
pub const IMAGE_REL_BASED_RESERVED: u16 = 6;
pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_7: u16 = 7;
pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_8: u16 = 8;
pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_9: u16 = 9;
pub const IMAGE_REL_BASED_DIR64: u16 = 10;
pub const IMAGE_REL_BASED_IA64_IMM64: u16 = 9;
pub const IMAGE_REL_BASED_MIPS_JMPADDR: u16 = 5;
pub const IMAGE_REL_BASED_MIPS_JMPADDR16: u16 = 9;
pub const IMAGE_REL_BASED_ARM_MOV32: u16 = 5;
pub const IMAGE_REL_BASED_THUMB_MOV32: u16 = 7;
pub const IMAGE_ARCHIVE_START_SIZE: usize = 8;
pub const IMAGE_ARCHIVE_START: &[u8; 8] = b"!<arch>\n";
pub const IMAGE_ARCHIVE_END: &[u8] = b"`\n";
pub const IMAGE_ARCHIVE_PAD: &[u8] = b"\n";
pub const IMAGE_ARCHIVE_LINKER_MEMBER: &[u8; 16] = b"/ ";
pub const IMAGE_ARCHIVE_LONGNAMES_MEMBER: &[u8; 16] = b"// ";
pub const IMAGE_ARCHIVE_HYBRIDMAP_MEMBER: &[u8; 16] = b"/<HYBRIDMAP>/ ";
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageArchiveMemberHeader {
pub name: [u8; 16],
pub date: [u8; 12],
pub user_id: [u8; 6],
pub group_id: [u8; 6],
pub mode: [u8; 8],
pub size: [u8; 10],
pub end_header: [u8; 2],
}
pub const IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR: u16 = 60;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageExportDirectory {
pub characteristics: U32<LE>,
pub time_date_stamp: U32<LE>,
pub major_version: U16<LE>,
pub minor_version: U16<LE>,
pub name: U32<LE>,
pub base: U32<LE>,
pub number_of_functions: U32<LE>,
pub number_of_names: U32<LE>,
pub address_of_functions: U32<LE>,
pub address_of_names: U32<LE>,
pub address_of_name_ordinals: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageImportByName {
pub hint: U16<LE>,
}
pub const IMAGE_ORDINAL_FLAG64: u64 = 0x8000000000000000;
pub const IMAGE_ORDINAL_FLAG32: u32 = 0x80000000;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageTlsDirectory64 {
pub start_address_of_raw_data: U64<LE>,
pub end_address_of_raw_data: U64<LE>,
pub address_of_index: U64<LE>,
pub address_of_call_backs: U64<LE>,
pub size_of_zero_fill: U32<LE>,
pub characteristics: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageTlsDirectory32 {
pub start_address_of_raw_data: U32<LE>,
pub end_address_of_raw_data: U32<LE>,
pub address_of_index: U32<LE>,
pub address_of_call_backs: U32<LE>,
pub size_of_zero_fill: U32<LE>,
pub characteristics: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageImportDescriptor {
pub original_first_thunk: U32Bytes<LE>,
pub time_date_stamp: U32Bytes<LE>,
pub forwarder_chain: U32Bytes<LE>,
pub name: U32Bytes<LE>,
pub first_thunk: U32Bytes<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageBoundImportDescriptor {
pub time_date_stamp: U32<LE>,
pub offset_module_name: U16<LE>,
pub number_of_module_forwarder_refs: U16<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageBoundForwarderRef {
pub time_date_stamp: U32<LE>,
pub offset_module_name: U16<LE>,
pub reserved: U16<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDelayloadDescriptor {
pub attributes: U32<LE>,
pub dll_name_rva: U32<LE>,
pub module_handle_rva: U32<LE>,
pub import_address_table_rva: U32<LE>,
pub import_name_table_rva: U32<LE>,
pub bound_import_address_table_rva: U32<LE>,
pub unload_information_table_rva: U32<LE>,
pub time_date_stamp: U32<LE>,
}
pub const IMAGE_DELAYLOAD_RVA_BASED: u32 = 0x8000_0000;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageResourceDirectory {
pub characteristics: U32<LE>,
pub time_date_stamp: U32<LE>,
pub major_version: U16<LE>,
pub minor_version: U16<LE>,
pub number_of_named_entries: U16<LE>,
pub number_of_id_entries: U16<LE>,
}
pub const IMAGE_RESOURCE_NAME_IS_STRING: u32 = 0x8000_0000;
pub const IMAGE_RESOURCE_DATA_IS_DIRECTORY: u32 = 0x8000_0000;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageResourceDirectoryEntry {
pub name_or_id: U32<LE>,
pub offset_to_data_or_directory: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageResourceDirectoryString {
pub length: U16<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageResourceDirStringU {
pub length: U16<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageResourceDataEntry {
pub offset_to_data: U32<LE>,
pub size: U32<LE>,
pub code_page: U32<LE>,
pub reserved: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageLoadConfigCodeIntegrity {
pub flags: U16<LE>,
pub catalog: U16<LE>,
pub catalog_offset: U32<LE>,
pub reserved: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDynamicRelocationTable {
pub version: U32<LE>,
pub size: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDynamicRelocation32 {
pub symbol: U32<LE>,
pub base_reloc_size: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDynamicRelocation64 {
pub symbol: U64<LE>,
pub base_reloc_size: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDynamicRelocation32V2 {
pub header_size: U32<LE>,
pub fixup_info_size: U32<LE>,
pub symbol: U32<LE>,
pub symbol_group: U32<LE>,
pub flags: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDynamicRelocation64V2 {
pub header_size: U32<LE>,
pub fixup_info_size: U32<LE>,
pub symbol: U64<LE>,
pub symbol_group: U32<LE>,
pub flags: U32<LE>,
}
pub const IMAGE_DYNAMIC_RELOCATION_GUARD_RF_PROLOGUE: u32 = 0x0000_0001;
pub const IMAGE_DYNAMIC_RELOCATION_GUARD_RF_EPILOGUE: u32 = 0x0000_0002;
pub const IMAGE_DYNAMIC_RELOCATION_GUARD_IMPORT_CONTROL_TRANSFER: u32 = 0x0000_0003;
pub const IMAGE_DYNAMIC_RELOCATION_GUARD_INDIR_CONTROL_TRANSFER: u32 = 0x0000_0004;
pub const IMAGE_DYNAMIC_RELOCATION_GUARD_SWITCHTABLE_BRANCH: u32 = 0x0000_0005;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImagePrologueDynamicRelocationHeader {
pub prologue_byte_count: u8,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageEpilogueDynamicRelocationHeader {
pub epilogue_count: U32Bytes<LE>,
pub epilogue_byte_count: u8,
pub branch_descriptor_element_size: u8,
pub branch_descriptor_count: U16Bytes<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageLoadConfigDirectory32 {
pub size: U32<LE>,
pub time_date_stamp: U32<LE>,
pub major_version: U16<LE>,
pub minor_version: U16<LE>,
pub global_flags_clear: U32<LE>,
pub global_flags_set: U32<LE>,
pub critical_section_default_timeout: U32<LE>,
pub de_commit_free_block_threshold: U32<LE>,
pub de_commit_total_free_threshold: U32<LE>,
pub lock_prefix_table: U32<LE>,
pub maximum_allocation_size: U32<LE>,
pub virtual_memory_threshold: U32<LE>,
pub process_heap_flags: U32<LE>,
pub process_affinity_mask: U32<LE>,
pub csd_version: U16<LE>,
pub dependent_load_flags: U16<LE>,
pub edit_list: U32<LE>,
pub security_cookie: U32<LE>,
pub sehandler_table: U32<LE>,
pub sehandler_count: U32<LE>,
pub guard_cf_check_function_pointer: U32<LE>,
pub guard_cf_dispatch_function_pointer: U32<LE>,
pub guard_cf_function_table: U32<LE>,
pub guard_cf_function_count: U32<LE>,
pub guard_flags: U32<LE>,
pub code_integrity: ImageLoadConfigCodeIntegrity,
pub guard_address_taken_iat_entry_table: U32<LE>,
pub guard_address_taken_iat_entry_count: U32<LE>,
pub guard_long_jump_target_table: U32<LE>,
pub guard_long_jump_target_count: U32<LE>,
pub dynamic_value_reloc_table: U32<LE>,
pub chpe_metadata_pointer: U32<LE>,
pub guard_rf_failure_routine: U32<LE>,
pub guard_rf_failure_routine_function_pointer: U32<LE>,
pub dynamic_value_reloc_table_offset: U32<LE>,
pub dynamic_value_reloc_table_section: U16<LE>,
pub reserved2: U16<LE>,
pub guard_rf_verify_stack_pointer_function_pointer: U32<LE>,
pub hot_patch_table_offset: U32<LE>,
pub reserved3: U32<LE>,
pub enclave_configuration_pointer: U32<LE>,
pub volatile_metadata_pointer: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageLoadConfigDirectory64 {
pub size: U32<LE>,
pub time_date_stamp: U32<LE>,
pub major_version: U16<LE>,
pub minor_version: U16<LE>,
pub global_flags_clear: U32<LE>,
pub global_flags_set: U32<LE>,
pub critical_section_default_timeout: U32<LE>,
pub de_commit_free_block_threshold: U64<LE>,
pub de_commit_total_free_threshold: U64<LE>,
pub lock_prefix_table: U64<LE>,
pub maximum_allocation_size: U64<LE>,
pub virtual_memory_threshold: U64<LE>,
pub process_affinity_mask: U64<LE>,
pub process_heap_flags: U32<LE>,
pub csd_version: U16<LE>,
pub dependent_load_flags: U16<LE>,
pub edit_list: U64<LE>,
pub security_cookie: U64<LE>,
pub sehandler_table: U64<LE>,
pub sehandler_count: U64<LE>,
pub guard_cf_check_function_pointer: U64<LE>,
pub guard_cf_dispatch_function_pointer: U64<LE>,
pub guard_cf_function_table: U64<LE>,
pub guard_cf_function_count: U64<LE>,
pub guard_flags: U32<LE>,
pub code_integrity: ImageLoadConfigCodeIntegrity,
pub guard_address_taken_iat_entry_table: U64<LE>,
pub guard_address_taken_iat_entry_count: U64<LE>,
pub guard_long_jump_target_table: U64<LE>,
pub guard_long_jump_target_count: U64<LE>,
pub dynamic_value_reloc_table: U64<LE>,
pub chpe_metadata_pointer: U64<LE>,
pub guard_rf_failure_routine: U64<LE>,
pub guard_rf_failure_routine_function_pointer: U64<LE>,
pub dynamic_value_reloc_table_offset: U32<LE>,
pub dynamic_value_reloc_table_section: U16<LE>,
pub reserved2: U16<LE>,
pub guard_rf_verify_stack_pointer_function_pointer: U64<LE>,
pub hot_patch_table_offset: U32<LE>,
pub reserved3: U32<LE>,
pub enclave_configuration_pointer: U64<LE>,
pub volatile_metadata_pointer: U64<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageHotPatchInfo {
pub version: U32<LE>,
pub size: U32<LE>,
pub sequence_number: U32<LE>,
pub base_image_list: U32<LE>,
pub base_image_count: U32<LE>,
pub buffer_offset: U32<LE>,
pub extra_patch_size: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageHotPatchBase {
pub sequence_number: U32<LE>,
pub flags: U32<LE>,
pub original_time_date_stamp: U32<LE>,
pub original_check_sum: U32<LE>,
pub code_integrity_info: U32<LE>,
pub code_integrity_size: U32<LE>,
pub patch_table: U32<LE>,
pub buffer_offset: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageHotPatchHashes {
pub sha256: [u8; 32],
pub sha1: [u8; 20],
}
pub const IMAGE_HOT_PATCH_BASE_OBLIGATORY: u32 = 0x0000_0001;
pub const IMAGE_HOT_PATCH_BASE_CAN_ROLL_BACK: u32 = 0x0000_0002;
pub const IMAGE_HOT_PATCH_CHUNK_INVERSE: u32 = 0x8000_0000;
pub const IMAGE_HOT_PATCH_CHUNK_OBLIGATORY: u32 = 0x4000_0000;
pub const IMAGE_HOT_PATCH_CHUNK_RESERVED: u32 = 0x3FF0_3000;
pub const IMAGE_HOT_PATCH_CHUNK_TYPE: u32 = 0x000F_C000;
pub const IMAGE_HOT_PATCH_CHUNK_SOURCE_RVA: u32 = 0x0000_8000;
pub const IMAGE_HOT_PATCH_CHUNK_TARGET_RVA: u32 = 0x0000_4000;
pub const IMAGE_HOT_PATCH_CHUNK_SIZE: u32 = 0x0000_0FFF;
pub const IMAGE_HOT_PATCH_NONE: u32 = 0x0000_0000;
pub const IMAGE_HOT_PATCH_FUNCTION: u32 = 0x0001_C000;
pub const IMAGE_HOT_PATCH_ABSOLUTE: u32 = 0x0002_C000;
pub const IMAGE_HOT_PATCH_REL32: u32 = 0x0003_C000;
pub const IMAGE_HOT_PATCH_CALL_TARGET: u32 = 0x0004_4000;
pub const IMAGE_HOT_PATCH_INDIRECT: u32 = 0x0005_C000;
pub const IMAGE_HOT_PATCH_NO_CALL_TARGET: u32 = 0x0006_4000;
pub const IMAGE_HOT_PATCH_DYNAMIC_VALUE: u32 = 0x0007_8000;
pub const IMAGE_GUARD_CF_INSTRUMENTED: u32 = 0x0000_0100;
pub const IMAGE_GUARD_CFW_INSTRUMENTED: u32 = 0x0000_0200;
pub const IMAGE_GUARD_CF_FUNCTION_TABLE_PRESENT: u32 = 0x0000_0400;
pub const IMAGE_GUARD_SECURITY_COOKIE_UNUSED: u32 = 0x0000_0800;
pub const IMAGE_GUARD_PROTECT_DELAYLOAD_IAT: u32 = 0x0000_1000;
pub const IMAGE_GUARD_DELAYLOAD_IAT_IN_ITS_OWN_SECTION: u32 = 0x0000_2000;
pub const IMAGE_GUARD_CF_EXPORT_SUPPRESSION_INFO_PRESENT: u32 = 0x0000_4000;
pub const IMAGE_GUARD_CF_ENABLE_EXPORT_SUPPRESSION: u32 = 0x0000_8000;
pub const IMAGE_GUARD_CF_LONGJUMP_TABLE_PRESENT: u32 = 0x0001_0000;
pub const IMAGE_GUARD_RF_INSTRUMENTED: u32 = 0x0002_0000;
pub const IMAGE_GUARD_RF_ENABLE: u32 = 0x0004_0000;
pub const IMAGE_GUARD_RF_STRICT: u32 = 0x0008_0000;
pub const IMAGE_GUARD_RETPOLINE_PRESENT: u32 = 0x0010_0000;
pub const IMAGE_GUARD_CF_FUNCTION_TABLE_SIZE_MASK: u32 = 0xF000_0000;
pub const IMAGE_GUARD_CF_FUNCTION_TABLE_SIZE_SHIFT: u32 = 28;
pub const IMAGE_GUARD_FLAG_FID_SUPPRESSED: u16 = 0x01;
pub const IMAGE_GUARD_FLAG_EXPORT_SUPPRESSED: u16 = 0x02;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageArmRuntimeFunctionEntry {
pub begin_address: U32<LE>,
pub unwind_data: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageArm64RuntimeFunctionEntry {
pub begin_address: U32<LE>,
pub unwind_data: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAlpha64RuntimeFunctionEntry {
pub begin_address: U64<LE>,
pub end_address: U64<LE>,
pub exception_handler: U64<LE>,
pub handler_data: U64<LE>,
pub prolog_end_address: U64<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageAlphaRuntimeFunctionEntry {
pub begin_address: U32<LE>,
pub end_address: U32<LE>,
pub exception_handler: U32<LE>,
pub handler_data: U32<LE>,
pub prolog_end_address: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageRuntimeFunctionEntry {
pub begin_address: U32<LE>,
pub end_address: U32<LE>,
pub unwind_info_address_or_data: U32<LE>,
}
pub const IMAGE_ENCLAVE_LONG_ID_LENGTH: usize = 32;
pub const IMAGE_ENCLAVE_SHORT_ID_LENGTH: usize = 16;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageEnclaveConfig32 {
pub size: U32<LE>,
pub minimum_required_config_size: U32<LE>,
pub policy_flags: U32<LE>,
pub number_of_imports: U32<LE>,
pub import_list: U32<LE>,
pub import_entry_size: U32<LE>,
pub family_id: [u8; IMAGE_ENCLAVE_SHORT_ID_LENGTH],
pub image_id: [u8; IMAGE_ENCLAVE_SHORT_ID_LENGTH],
pub image_version: U32<LE>,
pub security_version: U32<LE>,
pub enclave_size: U32<LE>,
pub number_of_threads: U32<LE>,
pub enclave_flags: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageEnclaveConfig64 {
pub size: U32<LE>,
pub minimum_required_config_size: U32<LE>,
pub policy_flags: U32<LE>,
pub number_of_imports: U32<LE>,
pub import_list: U32<LE>,
pub import_entry_size: U32<LE>,
pub family_id: [u8; IMAGE_ENCLAVE_SHORT_ID_LENGTH],
pub image_id: [u8; IMAGE_ENCLAVE_SHORT_ID_LENGTH],
pub image_version: U32<LE>,
pub security_version: U32<LE>,
pub enclave_size: U64<LE>,
pub number_of_threads: U32<LE>,
pub enclave_flags: U32<LE>,
}
pub const IMAGE_ENCLAVE_POLICY_DEBUGGABLE: u32 = 0x0000_0001;
pub const IMAGE_ENCLAVE_FLAG_PRIMARY_IMAGE: u32 = 0x0000_0001;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageEnclaveImport {
pub match_type: U32<LE>,
pub minimum_security_version: U32<LE>,
pub unique_or_author_id: [u8; IMAGE_ENCLAVE_LONG_ID_LENGTH],
pub family_id: [u8; IMAGE_ENCLAVE_SHORT_ID_LENGTH],
pub image_id: [u8; IMAGE_ENCLAVE_SHORT_ID_LENGTH],
pub import_name: U32<LE>,
pub reserved: U32<LE>,
}
pub const IMAGE_ENCLAVE_IMPORT_MATCH_NONE: u32 = 0x0000_0000;
pub const IMAGE_ENCLAVE_IMPORT_MATCH_UNIQUE_ID: u32 = 0x0000_0001;
pub const IMAGE_ENCLAVE_IMPORT_MATCH_AUTHOR_ID: u32 = 0x0000_0002;
pub const IMAGE_ENCLAVE_IMPORT_MATCH_FAMILY_ID: u32 = 0x0000_0003;
pub const IMAGE_ENCLAVE_IMPORT_MATCH_IMAGE_ID: u32 = 0x0000_0004;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDebugDirectory {
pub characteristics: U32<LE>,
pub time_date_stamp: U32<LE>,
pub major_version: U16<LE>,
pub minor_version: U16<LE>,
pub typ: U32<LE>,
pub size_of_data: U32<LE>,
pub address_of_raw_data: U32<LE>,
pub pointer_to_raw_data: U32<LE>,
}
pub const IMAGE_DEBUG_TYPE_UNKNOWN: u32 = 0;
pub const IMAGE_DEBUG_TYPE_COFF: u32 = 1;
pub const IMAGE_DEBUG_TYPE_CODEVIEW: u32 = 2;
pub const IMAGE_DEBUG_TYPE_FPO: u32 = 3;
pub const IMAGE_DEBUG_TYPE_MISC: u32 = 4;
pub const IMAGE_DEBUG_TYPE_EXCEPTION: u32 = 5;
pub const IMAGE_DEBUG_TYPE_FIXUP: u32 = 6;
pub const IMAGE_DEBUG_TYPE_OMAP_TO_SRC: u32 = 7;
pub const IMAGE_DEBUG_TYPE_OMAP_FROM_SRC: u32 = 8;
pub const IMAGE_DEBUG_TYPE_BORLAND: u32 = 9;
pub const IMAGE_DEBUG_TYPE_RESERVED10: u32 = 10;
pub const IMAGE_DEBUG_TYPE_CLSID: u32 = 11;
pub const IMAGE_DEBUG_TYPE_VC_FEATURE: u32 = 12;
pub const IMAGE_DEBUG_TYPE_POGO: u32 = 13;
pub const IMAGE_DEBUG_TYPE_ILTCG: u32 = 14;
pub const IMAGE_DEBUG_TYPE_MPX: u32 = 15;
pub const IMAGE_DEBUG_TYPE_REPRO: u32 = 16;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageCoffSymbolsHeader {
pub number_of_symbols: U32<LE>,
pub lva_to_first_symbol: U32<LE>,
pub number_of_linenumbers: U32<LE>,
pub lva_to_first_linenumber: U32<LE>,
pub rva_to_first_byte_of_code: U32<LE>,
pub rva_to_last_byte_of_code: U32<LE>,
pub rva_to_first_byte_of_data: U32<LE>,
pub rva_to_last_byte_of_data: U32<LE>,
}
pub const FRAME_FPO: u16 = 0;
pub const FRAME_TRAP: u16 = 1;
pub const FRAME_TSS: u16 = 2;
pub const FRAME_NONFPO: u16 = 3;
pub const IMAGE_DEBUG_MISC_EXENAME: u16 = 1;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageDebugMisc {
pub data_type: U32<LE>,
pub length: U32<LE>,
pub unicode: u8,
pub reserved: [u8; 3],
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageFunctionEntry {
pub starting_address: U32<LE>,
pub ending_address: U32<LE>,
pub end_of_prologue: U32<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageFunctionEntry64 {
pub starting_address: U64<LE>,
pub ending_address: U64<LE>,
pub end_of_prologue_or_unwind_info_address: U64<LE>,
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageSeparateDebugHeader {
pub signature: U16<LE>,
pub flags: U16<LE>,
pub machine: U16<LE>,
pub characteristics: U16<LE>,
pub time_date_stamp: U32<LE>,
pub check_sum: U32<LE>,
pub image_base: U32<LE>,
pub size_of_image: U32<LE>,
pub number_of_sections: U32<LE>,
pub exported_names_size: U32<LE>,
pub debug_directory_size: U32<LE>,
pub section_alignment: U32<LE>,
pub reserved: [U32<LE>; 2],
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct NonPagedDebugInfo {
pub signature: U16<LE>,
pub flags: U16<LE>,
pub size: U32<LE>,
pub machine: U16<LE>,
pub characteristics: U16<LE>,
pub time_date_stamp: U32<LE>,
pub check_sum: U32<LE>,
pub size_of_image: U32<LE>,
pub image_base: U64<LE>,
}
pub const IMAGE_SEPARATE_DEBUG_SIGNATURE: u16 = 0x4944;
pub const NON_PAGED_DEBUG_SIGNATURE: u16 = 0x494E;
pub const IMAGE_SEPARATE_DEBUG_FLAGS_MASK: u16 = 0x8000;
pub const IMAGE_SEPARATE_DEBUG_MISMATCH: u16 = 0x8000;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageArchitectureEntry {
pub fixup_inst_rva: U32<LE>,
pub new_inst: U32<LE>,
}
pub const IMPORT_OBJECT_HDR_SIG2: u16 = 0xffff;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImportObjectHeader {
pub sig1: U16<LE>,
pub sig2: U16<LE>,
pub version: U16<LE>,
pub machine: U16<LE>,
pub time_date_stamp: U32<LE>,
pub size_of_data: U32<LE>,
pub ordinal_or_hint: U16<LE>,
pub name_type: U16<LE>,
}
pub const IMPORT_OBJECT_CODE: u16 = 0;
pub const IMPORT_OBJECT_DATA: u16 = 1;
pub const IMPORT_OBJECT_CONST: u16 = 2;
pub const IMPORT_OBJECT_ORDINAL: u16 = 0;
pub const IMPORT_OBJECT_NAME: u16 = 1;
pub const IMPORT_OBJECT_NAME_NO_PREFIX: u16 = 2;
pub const IMPORT_OBJECT_NAME_UNDECORATE: u16 = 3;
pub const IMPORT_OBJECT_NAME_EXPORTAS: u16 = 4;
pub const COMIMAGE_FLAGS_ILONLY: u32 = 0x0000_0001;
pub const COMIMAGE_FLAGS_32BITREQUIRED: u32 = 0x0000_0002;
pub const COMIMAGE_FLAGS_IL_LIBRARY: u32 = 0x0000_0004;
pub const COMIMAGE_FLAGS_STRONGNAMESIGNED: u32 = 0x0000_0008;
pub const COMIMAGE_FLAGS_NATIVE_ENTRYPOINT: u32 = 0x0000_0010;
pub const COMIMAGE_FLAGS_TRACKDEBUGDATA: u32 = 0x0001_0000;
pub const COMIMAGE_FLAGS_32BITPREFERRED: u32 = 0x0002_0000;
pub const COR_VERSION_MAJOR_V2: u16 = 2;
pub const COR_VERSION_MAJOR: u16 = COR_VERSION_MAJOR_V2;
pub const COR_VERSION_MINOR: u16 = 5;
pub const COR_DELETED_NAME_LENGTH: usize = 8;
pub const COR_VTABLEGAP_NAME_LENGTH: usize = 8;
pub const NATIVE_TYPE_MAX_CB: u16 = 1;
pub const COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE: u16 = 0xFF;
pub const IMAGE_COR_MIH_METHODRVA: u16 = 0x01;
pub const IMAGE_COR_MIH_EHRVA: u16 = 0x02;
pub const IMAGE_COR_MIH_BASICBLOCK: u16 = 0x08;
pub const COR_VTABLE_32BIT: u16 = 0x01;
pub const COR_VTABLE_64BIT: u16 = 0x02;
pub const COR_VTABLE_FROM_UNMANAGED: u16 = 0x04;
pub const COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN: u16 = 0x08;
pub const COR_VTABLE_CALL_MOST_DERIVED: u16 = 0x10;
pub const IMAGE_COR_EATJ_THUNK_SIZE: usize = 32;
pub const MAX_CLASS_NAME: usize = 1024;
pub const MAX_PACKAGE_NAME: usize = 1024;
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct ImageCor20Header {
pub cb: U32<LE>,
pub major_runtime_version: U16<LE>,
pub minor_runtime_version: U16<LE>,
pub meta_data: ImageDataDirectory,
pub flags: U32<LE>,
pub entry_point_token_or_rva: U32<LE>,
pub resources: ImageDataDirectory,
pub strong_name_signature: ImageDataDirectory,
pub code_manager_table: ImageDataDirectory,
pub vtable_fixups: ImageDataDirectory,
pub export_address_table_jumps: ImageDataDirectory,
pub managed_native_header: ImageDataDirectory,
}
unsafe_impl_pod!(
ImageDosHeader,
ImageOs2Header,
ImageVxdHeader,
ImageFileHeader,
ImageDataDirectory,
ImageOptionalHeader32,
ImageRomOptionalHeader,
ImageOptionalHeader64,
ImageNtHeaders64,
ImageNtHeaders32,
ImageRomHeaders,
Guid,
AnonObjectHeader,
AnonObjectHeaderV2,
AnonObjectHeaderBigobj,
ImageSectionHeader,
ImageSymbol,
ImageSymbolBytes,
ImageSymbolEx,
ImageSymbolExBytes,
ImageAuxSymbolTokenDef,
ImageAuxSymbolFunction,
ImageAuxSymbolFunctionBeginEnd,
ImageAuxSymbolWeak,
ImageAuxSymbolSection,
ImageAuxSymbolCrc,
ImageRelocation,
ImageLinenumber,
ImageBaseRelocation,
ImageArchiveMemberHeader,
ImageExportDirectory,
ImageImportByName,
ImageTlsDirectory64,
ImageTlsDirectory32,
ImageImportDescriptor,
ImageBoundImportDescriptor,
ImageBoundForwarderRef,
ImageDelayloadDescriptor,
ImageResourceDirectory,
ImageResourceDirectoryEntry,
ImageResourceDirectoryString,
ImageResourceDirStringU,
ImageResourceDataEntry,
ImageLoadConfigCodeIntegrity,
ImageDynamicRelocationTable,
ImageDynamicRelocation32,
ImageDynamicRelocation64,
ImageDynamicRelocation32V2,
ImageDynamicRelocation64V2,
ImagePrologueDynamicRelocationHeader,
ImageEpilogueDynamicRelocationHeader,
ImageLoadConfigDirectory32,
ImageLoadConfigDirectory64,
ImageHotPatchInfo,
ImageHotPatchBase,
ImageHotPatchHashes,
ImageArmRuntimeFunctionEntry,
ImageArm64RuntimeFunctionEntry,
ImageAlpha64RuntimeFunctionEntry,
ImageAlphaRuntimeFunctionEntry,
ImageRuntimeFunctionEntry,
ImageEnclaveConfig32,
ImageEnclaveConfig64,
ImageEnclaveImport,
ImageDebugDirectory,
ImageCoffSymbolsHeader,
ImageDebugMisc,
ImageFunctionEntry,
ImageFunctionEntry64,
ImageSeparateDebugHeader,
NonPagedDebugInfo,
ImageArchitectureEntry,
ImportObjectHeader,
ImageCor20Header,
);