-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathxpe.h
1054 lines (893 loc) · 43.8 KB
/
xpe.h
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
// copyright (c) 2017-2020 hors<horsicq@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
#ifndef XPE_H
#define XPE_H
#include "xmsdos.h"
#include "xpe_def.h"
class XPE : public XMSDOS
{
Q_OBJECT
public:
struct SECTION_RECORD
{
QString sName;
qint64 nOffset;
qint64 nRVA;
qint64 nSize;
qint64 nCharacteristics;
};
struct SECTIONRVA_RECORD
{
qint64 nRVA;
qint64 nSize;
qint64 nCharacteristics;
};
struct IMPORT_RECORD
{
qint64 nOffset;
qint64 nRVA;
QString sLibrary;
QString sFunction;
};
struct IMPORT_POSITION
{
qint64 nThunkRVA;
qint64 nThunkOffset;
quint64 nThunkValue;
QString sName;
quint16 nHint;
qint64 nOrdinal;
QString sFunction;
};
struct IMPORT_HEADER
{
QString sName;
quint32 nFirstThunk; // For patch only!
QList<IMPORT_POSITION> listPositions;
};
struct DELAYIMPORT_POSITION
{
qint64 nNameThunkRVA;
qint64 nNameThunkOffset;
quint64 nNameThunkValue;
QString sName;
quint16 nHint;
qint64 nOrdinal;
QString sFunction;
qint64 nAddressThunkRVA;
qint64 nAddressThunkOffset;
quint64 nAddressThunkValue;
qint64 nBoundThunkRVA;
qint64 nBoundThunkOffset;
quint64 nBoundThunkValue;
};
struct EXPORT_RECORD
{
quint32 nOrdinal;
QString sFunctionName;
qint64 nLibraryBase;
QString sLibraryName;
};
struct EXPORT_POSITION
{
quint16 nOrdinal;
quint32 nRVA;
qint64 nAddress;
quint32 nNameRVA;
QString sFunctionName;
};
struct EXPORT_HEADER
{
XPE_DEF::IMAGE_EXPORT_DIRECTORY directory;
QString sName;
QList<EXPORT_POSITION> listPositions;
};
struct TLS_HEADER
{
quint64 StartAddressOfRawData;
quint64 EndAddressOfRawData;
quint64 AddressOfIndex;
quint64 AddressOfCallBacks;
quint32 SizeOfZeroFill;
quint32 Characteristics;
};
struct RESOURCES_ID_NAME
{
bool bIsName;
quint32 nID;
QString sName;
quint32 nNameOffset;
};
struct RESOURCE_RECORD
{
RESOURCES_ID_NAME irin[3];
qint64 nIRDEOffset;
qint64 nAddress;
qint64 nRVA;
qint64 nOffset;
qint64 nSize;
};
struct RESOURCE_POSITION
{
qint64 nOffset;
bool bIsValid;
quint32 nLevel;
bool bIsDataDirectory;
RESOURCES_ID_NAME rin;
XPE_DEF::IMAGE_RESOURCE_DIRECTORY directory;
XPE_DEF::IMAGE_RESOURCE_DIRECTORY_ENTRY dir_entry;
XPE_DEF::IMAGE_RESOURCE_DATA_ENTRY data_entry;
qint64 nDataAddress;
qint64 nDataOffset;
QList<RESOURCE_POSITION> listPositions;
};
struct RESOURCE_HEADER
{
qint64 nOffset;
XPE_DEF::IMAGE_RESOURCE_DIRECTORY directory;
QList<RESOURCE_POSITION> listPositions;
};
struct RELOCS_POSITION
{
qint16 nTypeOffset;
quint32 nType;
qint64 nAddress;
};
struct RELOCS_HEADER
{
qint64 nOffset;
XPE_DEF::IMAGE_BASE_RELOCATION ibr;
qint32 nCount;
};
struct DUMP_OPTIONS
{
quint32 nImageBase;
quint32 nAddressOfEntryPoint;
// bool bClearHeader;
// bool bCheckImport;
// QMap<qint64,QString> mapImport;
// QMap<qint64,quint64> mapInitImportOffsets;
// bool bIs64;
// bool bSaveIAT;
};
struct RESOURCE_VERSION
{
qint64 nFixedFileInfoOffset;
XPE_DEF::S_tagVS_FIXEDFILEINFO fileInfo;
QList<QString> listRecords; // TODO rename
// TODO VarFileInfo
};
struct CLI_METADATA_HEADER
{
quint32 nSignature;
quint16 nMajorVersion;
quint16 nMinorVersion;
quint32 nReserved;
quint32 nVersionStringLength;
QString sVersion;
quint16 nFlags;
quint16 nStreams;
};
struct CLI_METADATA_STREAM
{
qint64 nOffset;
qint64 nSize;
QString sName;
};
struct CLI_METADATA
{
CLI_METADATA_HEADER header;
QList<CLI_METADATA_STREAM> listStreams;
qint64 nTablesHeaderOffset;
qint64 nTablesSize;
quint32 nTables_Reserved1;
quint8 cTables_MajorVersion;
quint8 cTables_MinorVersion;
quint8 cTables_HeapOffsetSizes;
quint8 cTables_Reserved2;
quint64 nTables_Valid;
quint64 nTables_Sorted;
quint32 nTables_Valid_NumberOfRows;
quint32 Tables_TablesNumberOfIndexes[64]; // TODO const
qint64 Tables_TablesOffsets[64]; // TODO const
qint64 Tables_TablesSizes[64]; // TODO const
qint64 nStringsOffset;
qint64 nStringsSize;
qint64 nUSOffset;
qint64 nUSSize;
qint64 nBlobOffset;
qint64 nBlobSize;
qint64 nGUIDOffset;
qint64 nGUIDSize;
qint64 nEntryPoint;
qint64 nEntryPointSize;
QList<QString> listAnsiStrings;
QList<QString> listUnicodeStrings;
};
struct CLI_INFO
{
bool bInit;
bool bHidden;
qint64 nHeaderOffset;
XPE_DEF::IMAGE_COR20_HEADER header;
qint64 nMetaDataOffset;
CLI_METADATA cliMetadata;
};
struct IMAGE_IMPORT_DESCRIPTOR_EX
{
union
{
quint32 Characteristics;
quint32 OriginalFirstThunk;
};
quint32 TimeDateStamp;
quint32 ForwarderChain;
quint32 Name;
quint32 FirstThunk;
QString sLibrary; // Extra
};
struct BOUND_IMPORT_POSITION
{
XPE_DEF::S_IMAGE_BOUND_IMPORT_DESCRIPTOR descriptor;
QString sName;
};
enum TYPE
{
TYPE_UNKNOWN=0,
TYPE_GUI,
TYPE_CONSOLE,
TYPE_DLL,
TYPE_DRIVER
};
explicit XPE(QIODevice *__pDevice=nullptr,bool bIsImage=false,qint64 nImageBase=-1);
virtual bool isValid();
virtual MODE getMode();
virtual QString getArch();
virtual bool isBigEndian();
virtual int getType();
virtual QString typeIdToString(int nType);
qint64 getNtHeadersOffset();
quint32 getNtHeaders_Signature();
void setNtHeaders_Signature(quint32 nValue);
qint64 getFileHeaderOffset();
qint64 getFileHeaderSize();
XPE_DEF::S_IMAGE_FILE_HEADER getFileHeader();
void setFileHeader(XPE_DEF::S_IMAGE_FILE_HEADER *pFileHeader);
quint16 getFileHeader_Machine();
quint16 getFileHeader_NumberOfSections();
quint32 getFileHeader_TimeDateStamp();
quint32 getFileHeader_PointerToSymbolTable();
quint32 getFileHeader_NumberOfSymbols();
quint16 getFileHeader_SizeOfOptionalHeader();
quint16 getFileHeader_Characteristics();
void setFileHeader_Machine(quint16 nValue);
void setFileHeader_NumberOfSections(quint16 nValue);
void setFileHeader_TimeDateStamp(quint32 nValue);
void setFileHeader_PointerToSymbolTable(quint32 nValue);
void setFileHeader_NumberOfSymbols(quint32 nValue);
void setFileHeader_SizeOfOptionalHeader(quint16 nValue);
void setFileHeader_Characteristics(quint16 nValue);
qint64 getOptionalHeaderOffset();
qint64 getOptionalHeaderSize();
XPE_DEF::IMAGE_OPTIONAL_HEADER32 getOptionalHeader32();
XPE_DEF::IMAGE_OPTIONAL_HEADER64 getOptionalHeader64();
void setOptionalHeader32(XPE_DEF::IMAGE_OPTIONAL_HEADER32 *pOptionalHeader32);
void setOptionalHeader64(XPE_DEF::IMAGE_OPTIONAL_HEADER64 *pOptionalHeader64);
XPE_DEF::IMAGE_OPTIONAL_HEADER32S getOptionalHeader32S();
XPE_DEF::IMAGE_OPTIONAL_HEADER64S getOptionalHeader64S();
void setOptionalHeader32S(XPE_DEF::IMAGE_OPTIONAL_HEADER32S *pOptionalHeader32S);
void setOptionalHeader64S(XPE_DEF::IMAGE_OPTIONAL_HEADER64S *pOptionalHeader64S);
quint16 getOptionalHeader_Magic();
quint8 getOptionalHeader_MajorLinkerVersion();
quint8 getOptionalHeader_MinorLinkerVersion();
quint32 getOptionalHeader_SizeOfCode();
quint32 getOptionalHeader_SizeOfInitializedData();
quint32 getOptionalHeader_SizeOfUninitializedData();
quint32 getOptionalHeader_AddressOfEntryPoint();
quint32 getOptionalHeader_BaseOfCode();
quint32 getOptionalHeader_BaseOfData();
quint64 getOptionalHeader_ImageBase();
quint32 getOptionalHeader_SectionAlignment();
quint32 getOptionalHeader_FileAlignment();
quint16 getOptionalHeader_MajorOperatingSystemVersion();
quint16 getOptionalHeader_MinorOperatingSystemVersion();
quint16 getOptionalHeader_MajorImageVersion();
quint16 getOptionalHeader_MinorImageVersion();
quint16 getOptionalHeader_MajorSubsystemVersion();
quint16 getOptionalHeader_MinorSubsystemVersion();
quint32 getOptionalHeader_Win32VersionValue();
quint32 getOptionalHeader_SizeOfImage();
quint32 getOptionalHeader_SizeOfHeaders();
quint32 getOptionalHeader_CheckSum();
quint16 getOptionalHeader_Subsystem();
quint16 getOptionalHeader_DllCharacteristics();
qint64 getOptionalHeader_SizeOfStackReserve();
qint64 getOptionalHeader_SizeOfStackCommit();
qint64 getOptionalHeader_SizeOfHeapReserve();
qint64 getOptionalHeader_SizeOfHeapCommit();
quint32 getOptionalHeader_LoaderFlags();
quint32 getOptionalHeader_NumberOfRvaAndSizes();
void setOptionalHeader_Magic(quint16 nValue);
void setOptionalHeader_MajorLinkerVersion(quint8 nValue);
void setOptionalHeader_MinorLinkerVersion(quint8 nValue);
void setOptionalHeader_SizeOfCode(quint32 nValue);
void setOptionalHeader_SizeOfInitializedData(quint32 nValue);
void setOptionalHeader_SizeOfUninitializedData(quint32 nValue);
void setOptionalHeader_AddressOfEntryPoint(quint32 nValue);
void setOptionalHeader_BaseOfCode(quint32 nValue);
void setOptionalHeader_BaseOfData(quint32 nValue);
void setOptionalHeader_ImageBase(quint64 nValue);
void setOptionalHeader_SectionAlignment(quint32 nValue);
void setOptionalHeader_FileAlignment(quint32 nValue);
void setOptionalHeader_MajorOperatingSystemVersion(quint16 nValue);
void setOptionalHeader_MinorOperatingSystemVersion(quint16 nValue);
void setOptionalHeader_MajorImageVersion(quint16 nValue);
void setOptionalHeader_MinorImageVersion(quint16 nValue);
void setOptionalHeader_MajorSubsystemVersion(quint16 nValue);
void setOptionalHeader_MinorSubsystemVersion(quint16 nValue);
void setOptionalHeader_Win32VersionValue(quint32 nValue);
void setOptionalHeader_SizeOfImage(quint32 nValue);
void setOptionalHeader_SizeOfHeaders(quint32 nValue);
void setOptionalHeader_CheckSum(quint32 nValue);
void setOptionalHeader_Subsystem(quint16 nValue);
void setOptionalHeader_DllCharacteristics(quint16 nValue);
void setOptionalHeader_SizeOfStackReserve(quint64 nValue);
void setOptionalHeader_SizeOfStackCommit(quint64 nValue);
void setOptionalHeader_SizeOfHeapReserve(quint64 nValue);
void setOptionalHeader_SizeOfHeapCommit(quint64 nValue);
void setOptionalHeader_LoaderFlags(quint32 nValue);
void setOptionalHeader_NumberOfRvaAndSizes(quint32 nValue);
XPE_DEF::IMAGE_DATA_DIRECTORY read_IMAGE_DATA_DIRECTORY(qint64 nOffset);
void write_IMAGE_DATA_DIRECTORY(qint64 nOffset,XPE_DEF::IMAGE_DATA_DIRECTORY *pDataDirectory);
XPE_DEF::IMAGE_DATA_DIRECTORY getOptionalHeader_DataDirectory(quint32 nNumber);
void setOptionalHeader_DataDirectory(quint32 nNumber,XPE_DEF::IMAGE_DATA_DIRECTORY *pDataDirectory);
void setOptionalHeader_DataDirectory_VirtualAddress(quint32 nNumber,quint32 nValue);
void setOptionalHeader_DataDirectory_Size(quint32 nNumber,quint32 nValue);
void clearOptionalHeader_DataDirectory(quint32 nNumber);
bool isOptionalHeader_DataDirectoryPresent(quint32 nNumber);
QList<XPE_DEF::IMAGE_DATA_DIRECTORY> getDirectories();
void setDirectories(QList<XPE_DEF::IMAGE_DATA_DIRECTORY> *pListDirectories);
qint64 getDataDirectoryOffset(quint32 nNumber);
qint64 getDataDirectoryOffset(_MEMORY_MAP *pMemoryMap,quint32 nNumber);
QByteArray getDataDirectory(quint32 nNumber);
QByteArray getDataDirectory(_MEMORY_MAP *pMemoryMap,quint32 nNumber);
qint64 getSectionsTableOffset();
qint64 getSectionHeaderOffset(quint32 nNumber);
qint64 getSectionHeaderSize();
bool isSectionsTablePresent();
XPE_DEF::IMAGE_SECTION_HEADER getSectionHeader(quint32 nNumber);
void setSectionHeader(quint32 nNumber,XPE_DEF::IMAGE_SECTION_HEADER *pSectionHeader);
QList<XPE_DEF::IMAGE_SECTION_HEADER> getSectionHeaders();
// TODO with __getSectionOffsetAndSize
static QList<SECTION_RECORD> getSectionRecords(QList<XPE_DEF::IMAGE_SECTION_HEADER> *pList,bool bIsImage);
static QList<QString> getSectionNames(QList<XPE::SECTION_RECORD> *pList);
QList<SECTIONRVA_RECORD> getSectionRVARecords();
QString getSection_NameAsString(quint32 nNumber);
quint32 getSection_VirtualSize(quint32 nNumber);
quint32 getSection_VirtualAddress(quint32 nNumber);
quint32 getSection_SizeOfRawData(quint32 nNumber);
quint32 getSection_PointerToRawData(quint32 nNumber);
quint32 getSection_PointerToRelocations(quint32 nNumber);
quint32 getSection_PointerToLinenumbers(quint32 nNumber);
quint16 getSection_NumberOfRelocations(quint32 nNumber);
quint16 getSection_NumberOfLinenumbers(quint32 nNumber);
quint32 getSection_Characteristics(quint32 nNumber);
void setSection_NameAsString(quint32 nNumber,QString sName);
void setSection_VirtualSize(quint32 nNumber,quint32 nValue);
void setSection_VirtualAddress(quint32 nNumber,quint32 nValue);
void setSection_SizeOfRawData(quint32 nNumber,quint32 nValue);
void setSection_PointerToRawData(quint32 nNumber,quint32 nValue);
void setSection_PointerToRelocations(quint32 nNumber,quint32 nValue);
void setSection_PointerToLinenumbers(quint32 nNumber,quint32 nValue);
void setSection_NumberOfRelocations(quint32 nNumber,quint16 nValue);
void setSection_NumberOfLinenumbers(quint32 nNumber,quint16 nValue);
void setSection_Characteristics(quint32 nNumber,quint32 nValue);
QString getSection_NameAsString(quint32 nNumber,QList<QString> *pListSectionNames);
quint32 getSection_VirtualSize(quint32 nNumber,QList<XPE_DEF::IMAGE_SECTION_HEADER> *pListSectionHeaders);
quint32 getSection_VirtualAddress(quint32 nNumber,QList<XPE_DEF::IMAGE_SECTION_HEADER> *pListSectionHeaders);
quint32 getSection_SizeOfRawData(quint32 nNumber,QList<XPE_DEF::IMAGE_SECTION_HEADER> *pListSectionHeaders);
quint32 getSection_PointerToRawData(quint32 nNumber,QList<XPE_DEF::IMAGE_SECTION_HEADER> *pListSectionHeaders);
quint32 getSection_PointerToRelocations(quint32 nNumber,QList<XPE_DEF::IMAGE_SECTION_HEADER> *pListSectionHeaders);
quint32 getSection_PointerToLinenumbers(quint32 nNumber,QList<XPE_DEF::IMAGE_SECTION_HEADER> *pListSectionHeaders);
quint16 getSection_NumberOfRelocations(quint32 nNumber,QList<XPE_DEF::IMAGE_SECTION_HEADER> *pListSectionHeaders);
quint16 getSection_NumberOfLinenumbers(quint32 nNumber,QList<XPE_DEF::IMAGE_SECTION_HEADER> *pListSectionHeaders);
quint32 getSection_Characteristics(quint32 nNumber,QList<XPE_DEF::IMAGE_SECTION_HEADER> *pListSectionHeaders);
bool isSectionNamePresent(QString sSectionName);
static bool isSectionNamePresent(QString sSectionName,QList<XPE_DEF::IMAGE_SECTION_HEADER> *pListSections);
static XPE_DEF::IMAGE_SECTION_HEADER getSectionByName(QString sSectionName,QList<XPE_DEF::IMAGE_SECTION_HEADER> *pListSections);
qint32 getSectionNumber(QString sSectionName);
static qint32 getSectionNumber(QString sSectionName,QList<XPE_DEF::IMAGE_SECTION_HEADER> *pListSections);
bool isImportPresent();
QList<IMPORT_RECORD> getImportRecords();
QList<IMPORT_RECORD> getImportRecords(_MEMORY_MAP *pMemoryMap);
quint64 getImportHash64(_MEMORY_MAP *pMemoryMap);
quint32 getImportHash32(_MEMORY_MAP *pMemoryMap);
qint64 getImportDescriptorOffset(quint32 nNumber);
qint64 getImportDescriptorSize();
QList<XPE_DEF::IMAGE_IMPORT_DESCRIPTOR> getImportDescriptors();
QList<XPE_DEF::IMAGE_IMPORT_DESCRIPTOR> getImportDescriptors(_MEMORY_MAP *pMemoryMap);
QList<IMAGE_IMPORT_DESCRIPTOR_EX> getImportDescriptorsEx();
QList<IMAGE_IMPORT_DESCRIPTOR_EX> getImportDescriptorsEx(_MEMORY_MAP *pMemoryMap);
XPE_DEF::IMAGE_IMPORT_DESCRIPTOR getImportDescriptor(quint32 nNumber);
void setImportDescriptor(quint32 nNumber,XPE_DEF::IMAGE_IMPORT_DESCRIPTOR *pImportDescriptor);
void setImportDescriptor_OriginalFirstThunk(quint32 nNumber,quint32 nValue);
void setImportDescriptor_TimeDateStamp(quint32 nNumber,quint32 nValue);
void setImportDescriptor_ForwarderChain(quint32 nNumber,quint32 nValue);
void setImportDescriptor_Name(quint32 nNumber,quint32 nValue);
void setImportDescriptor_FirstThunk(quint32 nNumber,quint32 nValue);
QList<IMPORT_HEADER> getImports();
QList<IMPORT_HEADER> getImports(_MEMORY_MAP *pMemoryMap);
QList<IMPORT_POSITION> _getImportPositions(XBinary::_MEMORY_MAP *pMemoryMap,qint64 nThunksRVA,qint64 nRVA);
QList<IMPORT_POSITION> getImportPositions(int nIndex);
QList<quint32> getImportPositionHashes(_MEMORY_MAP *pMemoryMap);
bool isImportLibraryPresentI(QString sLibrary);
static bool isImportLibraryPresentI(QString sLibrary,QList<IMPORT_HEADER> *pListImport);
bool isImportFunctionPresentI(QString sLibrary,QString sFunction);
static bool isImportFunctionPresentI(QString sLibrary,QString sFunction,QList<IMPORT_HEADER> *pListImport);
bool setImports(QList<IMPORT_HEADER> *pListHeaders);
bool setImports(QIODevice *pDevice,bool bIsImage,QList<IMPORT_HEADER> *pListHeaders);
bool setImports(QString sFileName,bool bIsImage,QList<IMPORT_HEADER> *pListHeaders);
QString getImportFunctionName(quint32 nImport,quint32 nFunctionNumber,QList<IMPORT_HEADER> *pListHeaders);
RESOURCE_HEADER getResourceHeader();
RESOURCE_HEADER getResourceHeader(_MEMORY_MAP *pMemoryMap);
QList<RESOURCE_RECORD> getResources();
QList<RESOURCE_RECORD> getResources(_MEMORY_MAP *pMemoryMap);
static RESOURCE_RECORD getResourceRecord(quint32 nID1,quint32 nID2,QList<RESOURCE_RECORD> *pListRecords);
static RESOURCE_RECORD getResourceRecord(quint32 nID1,QString sName2,QList<RESOURCE_RECORD> *pListRecords);
static RESOURCE_RECORD getResourceRecord(QString sName1,quint32 nID2,QList<RESOURCE_RECORD> *pListRecords);
static RESOURCE_RECORD getResourceRecord(QString sName1,QString sName2,QList<RESOURCE_RECORD> *pListRecords);
static bool isResourcePresent(quint32 nID1,quint32 nID2,QList<RESOURCE_RECORD> *pListHeaders);
static bool isResourcePresent(quint32 nID1,QString sName2,QList<RESOURCE_RECORD> *pListHeaders);
static bool isResourcePresent(QString sName1,quint32 nID2,QList<RESOURCE_RECORD> *pListHeaders);
static bool isResourcePresent(QString sName1,QString sName2,QList<RESOURCE_RECORD> *pListHeaders);
bool isResourceManifestPresent();
bool isResourceManifestPresent(QList<XPE::RESOURCE_RECORD> *pListHeaders);
QString getResourceManifest();
QString getResourceManifest(QList<XPE::RESOURCE_RECORD> *pListHeaders);
bool isResourceVersionPresent();
bool isResourceVersionPresent(QList<XPE::RESOURCE_RECORD> *pListHeaders);
RESOURCE_VERSION getResourceVersion();
XPE_DEF::S_VS_VERSION_INFO readVS_VERSION_INFO(qint64 nOffset);
RESOURCE_VERSION getResourceVersion(QList<XPE::RESOURCE_RECORD> *pListHeaders);
QString getFileVersion();
QString getFileVersion(RESOURCE_VERSION *pResourceVersion);
void setFixedFileInfo_dwSignature(quint32 nValue);
void setFixedFileInfo_dwStrucVersion(quint32 nValue);
void setFixedFileInfo_dwFileVersionMS(quint32 nValue);
void setFixedFileInfo_dwFileVersionLS(quint32 nValue);
void setFixedFileInfo_dwProductVersionMS(quint32 nValue);
void setFixedFileInfo_dwProductVersionLS(quint32 nValue);
void setFixedFileInfo_dwFileFlagsMask(quint32 nValue);
void setFixedFileInfo_dwFileFlags(quint32 nValue);
void setFixedFileInfo_dwFileOS(quint32 nValue);
void setFixedFileInfo_dwFileType(quint32 nValue);
void setFixedFileInfo_dwFileSubtype(quint32 nValue);
void setFixedFileInfo_dwFileDateMS(quint32 nValue);
void setFixedFileInfo_dwFileDateLS(quint32 nValue);
QString getResourceVersionValue(QString sKey);
static QString getResourceVersionValue(QString sKey,XPE::RESOURCE_VERSION *pResVersion);
quint32 getResourceIdByNumber(quint32 nNumber);
quint32 getResourceIdByNumber(quint32 nNumber,QList<XPE::RESOURCE_RECORD> *pList);
QString getResourceNameByNumber(quint32 nNumber);
QString getResourceNameByNumber(quint32 nNumber,QList<XPE::RESOURCE_RECORD> *pList);
qint64 getResourceOffsetByNumber(quint32 nNumber);
qint64 getResourceOffsetByNumber(quint32 nNumber,QList<XPE::RESOURCE_RECORD> *pList);
qint64 getResourceSizeByNumber(quint32 nNumber);
qint64 getResourceSizeByNumber(quint32 nNumber,QList<XPE::RESOURCE_RECORD> *pList);
quint32 getResourceTypeByNumber(quint32 nNumber);
quint32 getResourceTypeByNumber(quint32 nNumber,QList<XPE::RESOURCE_RECORD> *pList);
qint64 getResourceNameOffset(QString sName);
qint64 getResourceNameOffset(QString sName,QList<XPE::RESOURCE_RECORD> *pList);
bool isResourceNamePresent(QString sName);
bool isResourceNamePresent(QString sName,QList<XPE::RESOURCE_RECORD> *pList);
virtual _MEMORY_MAP getMemoryMap();
virtual qint64 getBaseAddress();
virtual void setBaseAddress(qint64 nBaseAddress);
virtual qint64 getEntryPointOffset(_MEMORY_MAP *pMemoryMap);
virtual void setEntryPointOffset(qint64 nEntryPointOffset);
XPE_DEF::IMAGE_IMPORT_DESCRIPTOR read_IMAGE_IMPORT_DESCRIPTOR(qint64 nOffset);
void write_IMAGE_IMPORT_DESCRIPTOR(qint64 nOffset,XPE_DEF::IMAGE_IMPORT_DESCRIPTOR idd);
XPE_DEF::S_IMAGE_DELAYLOAD_DESCRIPTOR _read_IMAGE_DELAYLOAD_DESCRIPTOR(qint64 nOffset);
bool isExportPresent();
EXPORT_HEADER getExport();
EXPORT_HEADER getExport(_MEMORY_MAP *pMemoryMap);
static QList<QString> getExportFunctionsList(EXPORT_HEADER *pExportHeader);
XPE_DEF::IMAGE_EXPORT_DIRECTORY getExportDirectory();
void setExportDirectory(XPE_DEF::IMAGE_EXPORT_DIRECTORY *pExportDirectory);
void setExportDirectory_Characteristics(quint32 nValue);
void setExportDirectory_TimeDateStamp(quint32 nValue);
void setExportDirectory_MajorVersion(quint16 nValue);
void setExportDirectory_MinorVersion(quint16 nValue);
void setExportDirectory_Name(quint32 nValue);
void setExportDirectory_Base(quint32 nValue);
void setExportDirectory_NumberOfFunctions(quint32 nValue);
void setExportDirectory_NumberOfNames(quint32 nValue);
void setExportDirectory_AddressOfFunctions(quint32 nValue);
void setExportDirectory_AddressOfNames(quint32 nValue);
void setExportDirectory_AddressOfNameOrdinals(quint32 nValue);
QByteArray getHeaders();
OFFSETSIZE __getSectionOffsetAndSize(quint32 nSection);
QByteArray getSection(quint32 nSection);
QString getSectionHash(HASH hash,quint32 nSection);
double getSectionEntropy(quint32 nSection);
bool addImportSection(QMap<qint64,QString> *pMapIAT);
bool addImportSection(QIODevice *pDevice,bool bIsImage,QMap<qint64,QString> *pMapIAT);
bool addImportSection(QString sFileName,bool bIsImage,QMap<qint64,QString> *pMapIAT);
static QList<XPE::IMPORT_HEADER> mapIATToList(QMap<qint64,QString> *pMapIAT,bool bIs64);
quint32 calculateCheckSum();
bool addSection(XPE_DEF::IMAGE_SECTION_HEADER *pSectionHeader,char *pData,qint64 nDataSize);
bool addSection(QString sFileName,bool bIsImage,XPE_DEF::IMAGE_SECTION_HEADER *pSectionHeader,char *pData,qint64 nDataSize);
bool addSection(QIODevice *pDevice, bool bIsImage, XPE_DEF::IMAGE_SECTION_HEADER *pSectionHeader, char *pData, qint64 nDataSize);
bool removeLastSection();
static bool removeLastSection(QIODevice *pDevice, bool bIsImage);
static bool removeLastSection(QString sFileName,bool bIsImage);
// TODO copy Overlay function -> XBinary
XPE_DEF::IMAGE_RESOURCE_DIRECTORY_ENTRY read_IMAGE_RESOURCE_DIRECTORY_ENTRY(qint64 nOffset);
XPE_DEF::IMAGE_RESOURCE_DIRECTORY read_IMAGE_RESOURCE_DIRECTORY(qint64 nOffset);
XPE_DEF::IMAGE_RESOURCE_DATA_ENTRY read_IMAGE_RESOURCE_DATA_ENTRY(qint64 nOffset);
XPE::RESOURCES_ID_NAME getResourcesIDName(qint64 nResourceOffset, quint32 nValue);
QList<qint64> getRelocsAsRVAList();
QList<RELOCS_HEADER> getRelocsHeaders();
QList<RELOCS_POSITION> getRelocsPositions(qint64 nOffset);
XPE_DEF::IMAGE_BASE_RELOCATION _readIMAGE_BASE_RELOCATION(qint64 nOffset);
quint32 getRelocsVirtualAddress(qint64 nOffset);
quint32 getRelocsSizeOfBlock(qint64 nOffset);
void setRelocsVirtualAddress(qint64 nOffset,quint32 nValue);
void setRelocsSizeOfBlock(qint64 nOffset,quint32 nValue);
bool addRelocsSection(QList<qint64> *pList);
bool addRelocsSection(QIODevice *pDevice, bool bIsImage, QList<qint64> *pList);
bool addRelocsSection(QString sFileName, bool bIsImage, QList<qint64> *pList);
static QByteArray relocsAsRVAListToByteArray(QList<qint64> *pList,bool bIs64);
bool isResourcesPresent();
bool isRelocsPresent();
bool isDebugPresent();
bool isTLSPresent();
bool isSignPresent();
bool isExceptionPresent();
bool isLoadConfigPresent();
bool isBoundImportPresent();
bool isDelayImportPresent();
qint64 getTLSHeaderOffset();
qint64 getTLSHeaderSize();
XPE_DEF::S_IMAGE_TLS_DIRECTORY32 getTLSDirectory32();
XPE_DEF::S_IMAGE_TLS_DIRECTORY64 getTLSDirectory64();
quint64 getTLS_StartAddressOfRawData();
quint64 getTLS_EndAddressOfRawData();
quint64 getTLS_AddressOfIndex();
quint64 getTLS_AddressOfCallBacks();
quint32 getTLS_SizeOfZeroFill();
quint32 getTLS_Characteristics();
void setTLS_StartAddressOfRawData(quint64 nValue);
void setTLS_EndAddressOfRawData(quint64 nValue);
void setTLS_AddressOfIndex(quint64 nValue);
void setTLS_AddressOfCallBacks(quint64 nValue);
void setTLS_SizeOfZeroFill(quint32 nValue);
void setTLS_Characteristics(quint32 nValue);
QList<qint64> getTLS_CallbacksList();
QList<qint64> getTLS_CallbacksList(XBinary::_MEMORY_MAP *pMemoryMap);
TLS_HEADER getTLSHeader();
static QMap<quint64,QString> getImageNtHeadersSignatures();
static QMap<quint64,QString> getImageNtHeadersSignaturesS();
static QMap<quint64,QString> getImageMagics();
static QMap<quint64,QString> getImageMagicsS();
static QMap<quint64,QString> getImageFileHeaderMachines();
static QMap<quint64,QString> getImageFileHeaderMachinesS();
static QMap<quint64,QString> getImageFileHeaderCharacteristics();
static QMap<quint64,QString> getImageFileHeaderCharacteristicsS();
static QMap<quint64,QString> getImageOptionalHeaderMagic();
static QMap<quint64,QString> getImageOptionalHeaderMagicS();
static QMap<quint64,QString> getImageOptionalHeaderSubsystem();
static QMap<quint64,QString> getImageOptionalHeaderSubsystemS();
static QMap<quint64,QString> getImageOptionalHeaderDllCharacteristics();
static QMap<quint64,QString> getImageOptionalHeaderDllCharacteristicsS();
static QMap<quint64,QString> getImageOptionalHeaderDataDirectory();
static QMap<quint64,QString> getImageOptionalHeaderDataDirectoryS();
static QMap<quint64,QString> getImageSectionHeaderFlags();
static QMap<quint64,QString> getImageSectionHeaderFlagsS();
static QMap<quint64,QString> getImageSectionHeaderAligns();
static QMap<quint64,QString> getImageSectionHeaderAlignsS();
static QMap<quint64,QString> getResourceTypes();
static QMap<quint64,QString> getResourceTypesS();
static QMap<quint64,QString> getImageRelBased();
static QMap<quint64,QString> getImageRelBasedS();
static QMap<quint64,QString> getComImageFlags();
static QMap<quint64,QString> getComImageFlagsS();
static QMap<quint64,QString> getTypes();
static QMap<quint64,QString> getTypesS();
static QMap<quint64,QString> getDebugTypes();
static QMap<quint64,QString> getDebugTypesS();
qint64 calculateHeadersSize();
qint64 _calculateHeadersSize(qint64 nSectionsTableOffset, quint32 nNumberOfSections);
bool isDll();
static bool isDll(QString sFileName);
bool isConsole();
bool isDriver();
bool isNETPresent();
CLI_INFO getCliInfo(bool bFindHidden);
CLI_INFO getCliInfo(bool bFindHidden,XBinary::_MEMORY_MAP *pMemoryMap);
OFFSETSIZE getNet_MetadataOffsetSize();
CLI_METADATA_HEADER _read_MetadataHeader(qint64 nOffset);
void setMetadataHeader_Signature(quint32 nValue);
void setMetadataHeader_MajorVersion(quint16 nValue);
void setMetadataHeader_MinorVersion(quint16 nValue);
void setMetadataHeader_Reserved(quint32 nValue);
void setMetadataHeader_VersionStringLength(quint32 nValue);
void setMetadataHeader_Version(QString sValue);
void setMetadataHeader_Flags(quint16 nValue);
void setMetadataHeader_Streams(quint16 nValue);
bool isDataDirectoryValid(XPE_DEF::IMAGE_DATA_DIRECTORY *pDataDirectory);
bool isDataDirectoryValid(XPE_DEF::IMAGE_DATA_DIRECTORY *pDataDirectory, XBinary::_MEMORY_MAP *pMemoryMap);
bool isNetMetadataPresent();
bool isNetMetadataPresent(CLI_INFO *pCliInfo,XBinary::_MEMORY_MAP *pMemoryMap);
bool isNETAnsiStringPresent(QString sString);
static bool isNETAnsiStringPresent(QString sString,CLI_INFO *pCliInfo);
bool isNETUnicodeStringPresent(QString sString);
static bool isNETUnicodeStringPresent(QString sString,CLI_INFO *pCliInfo);
int getEntryPointSection();
int getEntryPointSection(XBinary::_MEMORY_MAP *pMemoryMap);
int getImportSection();
int getImportSection(XBinary::_MEMORY_MAP *pMemoryMap);
int getExportSection();
int getExportSection(XBinary::_MEMORY_MAP *pMemoryMap);
int getTLSSection();
int getTLSSection(XBinary::_MEMORY_MAP *pMemoryMap);
int getResourcesSection();
int getResourcesSection(XBinary::_MEMORY_MAP *pMemoryMap);
int getRelocsSection();
int getRelocsSection(XBinary::_MEMORY_MAP *pMemoryMap);
int getNormalCodeSection();
int getNormalCodeSection(XBinary::_MEMORY_MAP *pMemoryMap);
int getNormalDataSection();
int getNormalDataSection(XBinary::_MEMORY_MAP *pMemoryMap);
int getConstDataSection();
int getConstDataSection(XBinary::_MEMORY_MAP *pMemoryMap);
// TODO .INIT section
struct REBUILD_OPTIONS
{
bool bOptimize;
bool bClearHeader;
// bool bRemoveLastSection;
bool bSetEntryPoint;
quint32 nEntryPoint;
// bool bAddImportSection;
QMap<qint64,QString> mapIAT;
QMap<qint64,quint64> mapPatches;
// bool bAddRelocsSection;
QList<qint64> listRelocsRVAs;
bool bRenameSections;
QString sSectionName;
bool bFixChecksum;
};
bool rebuildDump(QString sResultFile,REBUILD_OPTIONS *pRebuildOptions);
static bool rebuildDump(QString sInputFile,QString sResultFile,REBUILD_OPTIONS *pRebuildOptions);
static bool fixCheckSum(QString sFileName,bool bIsImage);
void fixCheckSum();
static QList<XPE_DEF::IMAGE_SECTION_HEADER> splitSection(QByteArray *pbaData,XPE_DEF::IMAGE_SECTION_HEADER shOriginal,quint32 nBlockSize);
struct HEADER_OPTIONS
{
quint16 nMachine;
quint16 nCharacteristics;
quint16 nMagic;
quint64 nImagebase;
quint16 nSubsystem;
quint16 nDllcharacteristics;
quint8 nMajorOperationSystemVersion;
quint8 nMinorOperationSystemVersion;
quint32 nFileAlignment;
quint32 nSectionAlignment;
quint32 nAddressOfEntryPoint;
quint32 nResourceRVA;
quint32 nResourceSize;
};
static QByteArray createHeaderStub(HEADER_OPTIONS *pHeaderOptions);
XPE_DEF::S_IMAGE_LOAD_CONFIG_DIRECTORY32 getLoadConfigDirectory32();
XPE_DEF::S_IMAGE_LOAD_CONFIG_DIRECTORY64 getLoadConfigDirectory64();
qint64 getLoadConfigDirectoryOffset();
qint64 getLoadConfigDirectorySize();
quint32 getLoadConfig_Size();
quint32 getLoadConfig_TimeDateStamp();
quint16 getLoadConfig_MajorVersion();
quint16 getLoadConfig_MinorVersion();
quint32 getLoadConfig_GlobalFlagsClear();
quint32 getLoadConfig_GlobalFlagsSet();
quint32 getLoadConfig_CriticalSectionDefaultTimeout();
quint64 getLoadConfig_DeCommitFreeBlockThreshold();
quint64 getLoadConfig_DeCommitTotalFreeThreshold();
quint64 getLoadConfig_LockPrefixTable();
quint64 getLoadConfig_MaximumAllocationSize();
quint64 getLoadConfig_VirtualMemoryThreshold();
quint64 getLoadConfig_ProcessAffinityMask();
quint16 getLoadConfig_CSDVersion();
quint16 getLoadConfig_DependentLoadFlags();
quint64 getLoadConfig_EditList();
quint64 getLoadConfig_SecurityCookie();
quint64 getLoadConfig_SEHandlerTable();
quint64 getLoadConfig_SEHandlerCount();
quint64 getLoadConfig_GuardCFCheckFunctionPointer();
quint64 getLoadConfig_GuardCFDispatchFunctionPointer();
quint64 getLoadConfig_GuardCFFunctionTable();
quint64 getLoadConfig_GuardCFFunctionCount();
quint32 getLoadConfig_GuardFlags();
quint16 getLoadConfig_CodeIntegrity_Flags();
quint16 getLoadConfig_CodeIntegrity_Catalog();
quint32 getLoadConfig_CodeIntegrity_CatalogOffset();
quint32 getLoadConfig_CodeIntegrity_Reserved();
quint64 getLoadConfig_GuardAddressTakenIatEntryTable();
quint64 getLoadConfig_GuardAddressTakenIatEntryCount();
quint64 getLoadConfig_GuardLongJumpTargetTable();
quint64 getLoadConfig_GuardLongJumpTargetCount();
quint64 getLoadConfig_DynamicValueRelocTable();
quint64 getLoadConfig_CHPEMetadataPointer();
quint64 getLoadConfig_GuardRFFailureRoutine();
quint64 getLoadConfig_GuardRFFailureRoutineFunctionPointer();
quint32 getLoadConfig_DynamicValueRelocTableOffset();
quint16 getLoadConfig_DynamicValueRelocTableSection();
quint16 getLoadConfig_Reserved2();
quint64 getLoadConfig_GuardRFVerifyStackPointerFunctionPointer();
quint32 getLoadConfig_HotPatchTableOffset();
quint32 getLoadConfig_Reserved3();
quint64 getLoadConfig_EnclaveConfigurationPointer();
quint64 getLoadConfig_VolatileMetadataPointer();
void setLoadConfig_Size(quint32 nValue);
void setLoadConfig_TimeDateStamp(quint32 nValue);
void setLoadConfig_MajorVersion(quint16 nValue);
void setLoadConfig_MinorVersion(quint16 nValue);
void setLoadConfig_GlobalFlagsClear(quint32 nValue);
void setLoadConfig_GlobalFlagsSet(quint32 nValue);
void setLoadConfig_CriticalSectionDefaultTimeout(quint32 nValue);
void setLoadConfig_DeCommitFreeBlockThreshold(quint64 nValue);
void setLoadConfig_DeCommitTotalFreeThreshold(quint64 nValue);
void setLoadConfig_LockPrefixTable(quint64 nValue);
void setLoadConfig_MaximumAllocationSize(quint64 nValue);
void setLoadConfig_VirtualMemoryThreshold(quint64 nValue);
void setLoadConfig_ProcessAffinityMask(quint64 nValue);
void setLoadConfig_CSDVersion(quint16 nValue);
void setLoadConfig_DependentLoadFlags(quint16 nValue);
void setLoadConfig_EditList(quint64 nValue);
void setLoadConfig_SecurityCookie(quint64 nValue);
void setLoadConfig_SEHandlerTable(quint64 nValue);
void setLoadConfig_SEHandlerCount(quint64 nValue);
void setLoadConfig_GuardCFCheckFunctionPointer(quint64 nValue);
void setLoadConfig_GuardCFDispatchFunctionPointer(quint64 nValue);
void setLoadConfig_GuardCFFunctionTable(quint64 nValue);
void setLoadConfig_GuardCFFunctionCount(quint64 nValue);
void setLoadConfig_GuardFlags(quint32 nValue);
void setLoadConfig_CodeIntegrity_Flags(quint16 nValue);
void setLoadConfig_CodeIntegrity_Catalog(quint16 nValue);
void setLoadConfig_CodeIntegrity_CatalogOffset(quint32 nValue);
void setLoadConfig_CodeIntegrity_Reserved(quint32 nValue);
void setLoadConfig_GuardAddressTakenIatEntryTable(quint64 nValue);
void setLoadConfig_GuardAddressTakenIatEntryCount(quint64 nValue);
void setLoadConfig_GuardLongJumpTargetTable(quint64 nValue);
void setLoadConfig_GuardLongJumpTargetCount(quint64 nValue);
void setLoadConfig_DynamicValueRelocTable(quint64 nValue);
void setLoadConfig_CHPEMetadataPointer(quint64 nValue);
void setLoadConfig_GuardRFFailureRoutine(quint64 nValue);
void setLoadConfig_GuardRFFailureRoutineFunctionPointer(quint64 nValue);
void setLoadConfig_DynamicValueRelocTableOffset(quint32 nValue);
void setLoadConfig_DynamicValueRelocTableSection(quint16 nValue);
void setLoadConfig_Reserved2(quint16 nValue);
void setLoadConfig_GuardRFVerifyStackPointerFunctionPointer(quint64 nValue);
void setLoadConfig_HotPatchTableOffset(quint32 nValue);
void setLoadConfig_Reserved3(quint32 nValue);
void setLoadConfig_EnclaveConfigurationPointer(quint64 nValue);
void setLoadConfig_VolatileMetadataPointer(quint64 nValue);
XPE_DEF::S_IMAGE_RUNTIME_FUNCTION_ENTRY _read_IMAGE_RUNTIME_FUNCTION_ENTRY(qint64 nOffset);
XPE_DEF::S_IMAGE_RUNTIME_FUNCTION_ENTRY _getException(qint32 nNumber);
void setException_BeginAddress(qint32 nNumber,quint32 nValue);
void setException_EndAddress(qint32 nNumber,quint32 nValue);
void setException_UnwindInfoAddress(qint32 nNumber,quint32 nValue);
qint64 getExceptionRecordOffset(qint32 nNumber);
qint64 getExceptionRecordSize();
QList<XPE_DEF::S_IMAGE_RUNTIME_FUNCTION_ENTRY> getExceptionsList();
QList<XPE_DEF::S_IMAGE_RUNTIME_FUNCTION_ENTRY> getExceptionsList(XBinary::_MEMORY_MAP *pMemoryMap);
XPE_DEF::S_IMAGE_DEBUG_DIRECTORY _read_IMAGE_DEBUG_DIRECTORY(qint64 nOffset);
QList<XPE_DEF::S_IMAGE_DEBUG_DIRECTORY> getDebugList();
QList<XPE_DEF::S_IMAGE_DEBUG_DIRECTORY> getDebugList(XBinary::_MEMORY_MAP *pMemoryMap);
qint64 getDebugHeaderOffset(quint32 nNumber);
qint64 getDebugHeaderSize();
XPE_DEF::S_IMAGE_DEBUG_DIRECTORY getDebugHeader(quint32 nNumber);
// TODO Get
void setDebugHeader_Characteristics(quint32 nNumber,quint32 nValue);
void setDebugHeader_TimeDateStamp(quint32 nNumber,quint32 nValue);
void setDebugHeader_MajorVersion(quint32 nNumber,quint16 nValue);
void setDebugHeader_MinorVersion(quint32 nNumber,quint16 nValue);
void setDebugHeader_Type(quint32 nNumber,quint32 nValue);
void setDebugHeader_SizeOfData(quint32 nNumber,quint32 nValue);
void setDebugHeader_AddressOfRawData(quint32 nNumber,quint32 nValue);
void setDebugHeader_PointerToRawData(quint32 nNumber,quint32 nValue);
qint64 getDelayImportRecordOffset(qint32 nNumber);
qint64 getDelayImportRecordSize();
QList<XPE_DEF::S_IMAGE_DELAYLOAD_DESCRIPTOR> getDelayImportsList();
QList<XPE_DEF::S_IMAGE_DELAYLOAD_DESCRIPTOR> getDelayImportsList(XBinary::_MEMORY_MAP *pMemoryMap);
// TODO Get
void setDelayImport_AllAttributes(quint32 nNumber,quint32 nValue);
void setDelayImport_DllNameRVA(quint32 nNumber,quint32 nValue);
void setDelayImport_ModuleHandleRVA(quint32 nNumber,quint32 nValue);
void setDelayImport_ImportAddressTableRVA(quint32 nNumber,quint32 nValue);
void setDelayImport_ImportNameTableRVA(quint32 nNumber,quint32 nValue);
void setDelayImport_BoundImportAddressTableRVA(quint32 nNumber,quint32 nValue);
void setDelayImport_UnloadInformationTableRVA(quint32 nNumber,quint32 nValue);
void setDelayImport_TimeDateStamp(quint32 nNumber,quint32 nValue);
QList<DELAYIMPORT_POSITION> getDelayImportPositions(int nIndex);
QList<DELAYIMPORT_POSITION> getDelayImportPositions(XBinary::_MEMORY_MAP *pMemoryMap,int nIndex);
QList<BOUND_IMPORT_POSITION> getBoundImportPositions();
QList<BOUND_IMPORT_POSITION> getBoundImportPositions(XBinary::_MEMORY_MAP *pMemoryMap);
XPE_DEF::S_IMAGE_BOUND_IMPORT_DESCRIPTOR _read_IMAGE_BOUND_IMPORT_DESCRIPTOR(qint64 nOffset);
qint64 getBoundImportRecordOffset(qint32 nNumber);
qint64 getBoundImportRecordSize();
void setBoundImport_TimeDateStamp(quint32 nNumber,quint32 nValue);
void setBoundImport_OffsetModuleName(quint32 nNumber,quint16 nValue);
void setBoundImport_NumberOfModuleForwarderRefs(quint32 nNumber,quint16 nValue);
qint32 getNumberOfImports();
QString getImportLibraryName(quint32 nNumber);
QString getImportLibraryName(quint32 nNumber, QList<XPE::IMPORT_HEADER> *pListImport);
qint32 getNumberOfImportThunks(quint32 nNumber);
qint32 getNumberOfImportThunks(quint32 nNumber, QList<XPE::IMPORT_HEADER> *pListImport);
qint64 getNetHeaderOffset();
qint64 getNetHeaderSize();