forked from omarghader/pefile-go
/
structures.go
1170 lines (1010 loc) · 29.2 KB
/
structures.go
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
package lib
import (
"encoding/binary"
"fmt"
"reflect"
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"crypto/sha512"
"encoding/hex"
"math"
)
/* Dos Header */
type DosHeader struct {
Data DosHeaderD
FileOffset uint32
Flags map[string]bool
Size uint32
}
func NewDosHeader(fileOffset uint32) (header *DosHeader) {
header = new(DosHeader)
header.Flags = make(map[string]bool)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *DosHeader) String() string {
return sectionString(self.FileOffset, "IMAGE_DOS_HEADER", self.Data) + flagString(self.Flags)
}
type DosHeaderD struct {
E_magic uint16
E_cblp uint16
E_cp uint16
E_crlc uint16
E_cparhd uint16
E_minalloc uint16
E_maxalloc uint16
E_ss uint16
E_sp uint16
E_csum uint16
E_ip uint16
E_cs uint16
E_lfarlc uint16
E_ovno uint16
E_res [8]uint8
E_oemid uint16
E_oeminfo uint16
E_res2 [20]uint8
E_lfanew uint32
}
type NTHeader struct {
Data NTHeaderD
FileOffset uint32
Flags map[string]bool
Size uint32
}
/* NT Header */
func NewNTHeader(fileOffset uint32) (header *NTHeader) {
header = new(NTHeader)
header.Flags = make(map[string]bool)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
type NTHeaderD struct {
Signature uint32
}
func (self *NTHeader) String() string {
return sectionString(self.FileOffset, "IMAGE_NT_HEADER", self.Data) + flagString(self.Flags)
}
/* File Header */
type FileHeader struct {
Data FileHeaderD
FileOffset uint32
Flags map[string]bool
Size uint32
}
func NewFileHeader(fileOffset uint32) (header *FileHeader) {
header = new(FileHeader)
header.Flags = make(map[string]bool)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *FileHeader) String() string {
return sectionString(self.FileOffset, "IMAGE_FILE_HEADER", self.Data) + flagString(self.Flags)
}
type FileHeaderD struct {
Machine uint16
NumberOfSections uint16
TimeDateStamp uint32
PointerToSymbolTable uint32
NumberOfSymbols uint32
SizeOfOptionalHeader uint16
Characteristics uint16
}
/* Optional Header */
type OptionalHeader struct {
Data OptionalHeaderD
FileOffset uint32
Flags map[string]bool
Size uint32
DataDirs map[string]*DataDirectory
}
func NewOptionalHeader(fileOffset uint32) (header *OptionalHeader) {
header = new(OptionalHeader)
header.Flags = make(map[string]bool)
header.DataDirs = make(map[string]*DataDirectory)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *OptionalHeader) String() string {
return sectionString(self.FileOffset, "OPTIONAL_HEADER", self.Data) + flagString(self.Flags)
}
type OptionalHeaderD struct {
Magic uint16
MajorLinkerVersion uint8
MinorLinkerVersion uint8
SizeOfCode uint32
SizeOfInitializedData uint32
SizeOfUninitializedData uint32
AddressOfEntryPoint uint32
BaseOfCode uint32
BaseOfData uint32
ImageBase uint32
SectionAlignment uint32
FileAlignment uint32
MajorOperatingSystemVersion uint16
MinorOperatingSystemVersion uint16
MajorImageVersion uint16
MinorImageVersion uint16
MajorSubsystemVersion uint16
MinorSubsystemVersion uint16
Reserved1 uint32
SizeOfImage uint32
SizeOfHeaders uint32
CheckSum uint32
Subsystem uint16
DllCharacteristics uint16
SizeOfStackReserve uint32
SizeOfStackCommit uint32
SizeOfHeapReserve uint32
SizeOfHeapCommit uint32
LoaderFlags uint32
NumberOfRvaAndSizes uint32
}
type OptionalHeader64 struct {
Data OptionalHeader64D
FileOffset uint32
Flags map[string]bool
DataDirs map[string]*DataDirectory
Size uint32
}
func NewOptionalHeader64(fileOffset uint32) (header *OptionalHeader64) {
header = new(OptionalHeader64)
header.Flags = make(map[string]bool)
header.DataDirs = make(map[string]*DataDirectory)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *OptionalHeader64) String() string {
return sectionString(self.FileOffset, "OPTIONAL_HEADER64", self.Data) + flagString(self.Flags)
}
type OptionalHeader64D struct {
Magic uint16
MajorLinkerVersion uint8
MinorLinkerVersion uint8
SizeOfCode uint32
SizeOfInitializedData uint32
SizeOfUninitializedData uint32
AddressOfEntryPoint uint32
BaseOfCode uint32
BaseOfData uint32
ImageBase uint32
SectionAlignment uint32
FileAlignment uint32
MajorOperatingSystemVersion uint16
MinorOperatingSystemVersion uint16
MajorImageVersion uint16
MinorImageVersion uint16
MajorSubsystemVersion uint16
MinorSubsystemVersion uint16
Reserved1 uint32
SizeOfImage uint32
SizeOfHeaders uint32
CheckSum uint32
Subsystem uint16
DllCharacteristics uint16
SizeOfStackReserve uint64 // Different after this point, specific checks needed
SizeOfStackCommit uint64
SizeOfHeapReserve uint64
SizeOfHeapCommit uint64
LoaderFlags uint32
NumberOfRvaAndSizes uint32
}
/* Data directory */
type DataDirectory struct {
Data DataDirectoryD
FileOffset uint32
Name string
Size uint32
}
type DataDirectoryD struct {
VirtualAddress uint32
Size uint32
}
func NewDataDirectory(fileOffset uint32) (header *DataDirectory) {
header = new(DataDirectory)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *DataDirectory) String() string {
return sectionString(self.FileOffset, "DATA_DIRECTORY", self.Data)
}
/* Image Section */
type SectionHeader struct {
Data SectionHeaderD
FileOffset uint32
Flags map[string]bool
Size uint32
NextHeaderAddr uint32
}
func NewSectionHeader(fileOffset uint32) (header *SectionHeader) {
header = new(SectionHeader)
header.Size = uint32(binary.Size(header.Data))
header.Flags = make(map[string]bool)
header.FileOffset = fileOffset
return header
}
// def get_data(self, start=None, length=None):
// """Get data chunk from a section.
// Allows to query data from the section by passing the
// addresses where the PE file would be loaded by default.
// It is then possible to retrieve code and data by its real
// addresses as it would be if loaded.
// """
// PointerToRawData_adj = self.pe.adjust_FileAlignment( self.PointerToRawData,
// self.pe.OPTIONAL_HEADER.FileAlignment )
// VirtualAddress_adj = self.pe.adjust_SectionAlignment( self.VirtualAddress,
// self.pe.OPTIONAL_HEADER.SectionAlignment, self.pe.OPTIONAL_HEADER.FileAlignment )
// if start is None:
// offset = PointerToRawData_adj
// else:
// offset = ( start - VirtualAddress_adj ) + PointerToRawData_adj
// if length is not None:
// end = offset + length
// else:
// end = offset + self.SizeOfRawData
// # PointerToRawData is not adjusted here as we might want to read any possible extra bytes
// # that might get cut off by aligning the start (and hence cutting something off the end)
// #
// if end > self.PointerToRawData + self.SizeOfRawData:
// end = self.PointerToRawData + self.SizeOfRawData
// return self.pe.__data__[offset:end]
func (self *SectionHeader) String() string {
return sectionString(self.FileOffset, "SECTION_HEADER", self.Data) + flagString(self.Flags)
}
func (self *SectionHeader) Get_entropy(data []byte) float64 {
// """Calculate and return the entropy for the section."""
return self.entropy_H(data)
}
func (self *SectionHeader) Get_hash_sha1(data []byte) string {
// """Get the SHA-1 hex-digest of the section's data."""
h := sha1.New()
h.Write(data)
hash := hex.EncodeToString(h.Sum(nil))
return hash
}
func (self *SectionHeader) Get_hash_sha256(data []byte) string {
// """Get the SHA-512 hex-digest of the section's data."""
h := sha256.New()
h.Write(data)
hash := hex.EncodeToString(h.Sum(nil))
return hash
}
func (self *SectionHeader) Get_hash_sha512(data []byte) string {
// """Get the SHA-256 hex-digest of the section's data."""
h := sha512.New()
h.Write(data)
hash := hex.EncodeToString(h.Sum(nil))
return hash
}
func (self *SectionHeader) Get_hash_md5(data []byte) string {
// """Get the MD5 hex-digest of the section's data."""
h := md5.New()
h.Write(data)
hash := hex.EncodeToString(h.Sum(nil))
return hash
}
func (self *SectionHeader) entropy_H(data []byte) float64 {
// """Calculate the entropy of a chunk of data."""
if len(data) == 0 {
return 0.0
} else {
}
occurences := [256]int{0}
for _, char := range data {
// fmt.Printf("Char: %c , int : %d\n", char, char)
occurences[int(char)]++
}
entropy := 0.0
p_x := 0.0
for _, occurence := range occurences {
if occurence > 0 {
p_x = float64(occurence) / float64(len(data))
entropy = entropy - p_x*math.Log2(p_x)
}
}
// fmt.Println("p_x: ", p_x)
return entropy
}
type SectionHeaderD struct {
Name [8]uint8
Misc uint32
VirtualAddress uint32
SizeOfRawData uint32
PointerToRawData uint32
PointerToRelocations uint32
PointerToLinenumbers uint32
NumberOfRelocations uint16
NumberOfLinenumbers uint16
Characteristics uint32
}
/* Image Import Descriptor */
type ImportDescriptor struct {
Data ImportDescriptorD
FileOffset uint32
Flags map[string]bool
Dll []byte
Imports []*ImportData
Imports64 []*ImportData64
Size uint32
}
func NewImportDescriptor(fileOffset uint32) (header *ImportDescriptor) {
header = new(ImportDescriptor)
header.Size = uint32(binary.Size(header.Data))
header.Flags = make(map[string]bool)
header.FileOffset = fileOffset
return header
}
func (self *ImportDescriptor) String() string {
return sectionString(self.FileOffset, "IMPORT_DESCRIPTOR", self.Data) + flagString(self.Flags)
}
type ImportDescriptorD struct {
Characteristics uint32
TimeDateStamp uint32
ForwarderChain uint32
Name uint32
FirstThunk uint32
}
type ImportData struct {
StructTable *ThunkData
StructIat *ThunkData
ImportByOrdinal bool
Ordinal uint32
OrdinalOffset uint32
Hint uint16
Name []byte
NameOffset uint32
Bound uint32
Address uint32
HintNameTableRva uint32
ThunkOffset uint32
ThunkRva uint32
}
func (self ImportData) String() string {
return sectionString(0, "Import Data", self)
}
type ImportData64 struct {
StructTable *ThunkData64
StructIat *ThunkData64
ImportByOrdinal bool
Ordinal uint64
OrdinalOffset uint64
Hint uint16
Name []byte
NameOffset uint64
Bound uint64
Address uint64
HintNameTableRva uint64
ThunkOffset uint64
ThunkRva uint64
}
func (self ImportData64) String() string {
return sectionString(0, "Import Data 64bit", self)
}
/* Delay Import Descriptor */
type DelayImportDescriptor struct {
Data DelayImportDescriptorD
FileOffset uint32
Flags map[string]bool
Size uint32
}
func NewDelayImportDescriptor(fileOffset uint32) (header *DelayImportDescriptor) {
header = new(DelayImportDescriptor)
header.Size = uint32(binary.Size(header.Data))
header.Flags = make(map[string]bool)
header.FileOffset = fileOffset
return header
}
func (self *DelayImportDescriptor) String() string {
return sectionString(self.FileOffset, "DELAY_IMPORT_DESCRIPTOR", self.Data) + flagString(self.Flags)
}
type DelayImportDescriptorD struct {
DIgrAttrs uint32
DIszName uint32
DIphmod uint32
DIpIAT uint32
DIpINT uint32
DIpBoundIAT uint32
DIpUnloadIAT uint32
DIdwTimeStamp uint32
}
/* Export Directory */
type ExportDirectory struct {
Data ExportDirectoryD
FileOffset uint32
Flags map[string]bool
Exports []*ExportData
Size uint32
}
func NewExportDirectory(fileOffset uint32) (header *ExportDirectory) {
header = new(ExportDirectory)
header.Size = uint32(binary.Size(header.Data))
header.Flags = make(map[string]bool)
header.FileOffset = fileOffset
return header
}
func (self *ExportDirectory) String() string {
return sectionString(self.FileOffset, "EXPORT_DIRECTORY", self.Data) + flagString(self.Flags)
}
type ExportDirectoryD struct {
Characteristics uint32
TimeDateStamp uint32
MajorVersion uint16
MinorVersion uint16
Name uint32
Base uint32
NumberOfFunctions uint32
NumberOfNames uint32
AddressOfFunctions uint32
AddressOfNames uint32
AddressOfNameOrdinals uint32
}
type ExportData struct {
Ordinal uint16
OrdinalOffset uint32
Address uint32
AddressOffset uint32
Name []byte //
NameOffset uint32 //
Forwarder []byte
ForwarderOffset uint32
}
func (self ExportData) String() string {
return sectionString(0, "Export Data", self)
}
/* Resource Directory */
type ResourceDirectory struct {
Data ResourceDirectoryD
FileOffset uint32
Flags map[string]bool
Size uint32
}
func NewResourceDirectory(fileOffset uint32) (header *ResourceDirectory) {
header = new(ResourceDirectory)
header.Size = uint32(binary.Size(header.Data))
header.Flags = make(map[string]bool)
header.FileOffset = fileOffset
return header
}
func (self *ResourceDirectory) String() string {
return sectionString(self.FileOffset, "RESOURCE_DIRECTORY", self.Data) + flagString(self.Flags)
}
type ResourceDirectoryD struct {
Characteristics uint32
TimeDateStamp uint32
MajorVersion uint16
MinorVersion uint16
NumberOfNamedEntries uint16
NumberOfIdEntries uint16
}
/* Resource Directory Entry */
type ResourceDirectoryEntry struct {
Data ResourceDirectoryEntryD
FileOffset uint32
Size uint32
}
func NewResourceDirectoryEntry(fileOffset uint32) (header *ResourceDirectoryEntry) {
header = new(ResourceDirectoryEntry)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *ResourceDirectoryEntry) String() string {
return sectionString(self.FileOffset, "RESOURCE_DIRECTORY_ENTRY", self.Data)
}
type ResourceDirectoryEntryD struct {
Name uint32
OffsetToData uint32
}
/* Resource Data Entry */
type ResourceDataEntry struct {
Data ResourceDataEntryD
FileOffset uint32
Size uint32
}
func NewResourceDataEntry(fileOffset uint32) (header *ResourceDataEntry) {
header = new(ResourceDataEntry)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *ResourceDataEntry) String() string {
return sectionString(self.FileOffset, "RESOURCE_DATA_ENTRY", self.Data)
}
type ResourceDataEntryD struct {
OffsetToData uint32
Size uint32
CodePage uint32
Reserved uint32
}
/* VS Version Info */
type VSVersionInfo struct {
Data VSVersionInfoD
FileOffset uint32
Size uint32
}
func NewVSVersionInfo(fileOffset uint32) (header *VSVersionInfo) {
header = new(VSVersionInfo)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *VSVersionInfo) String() string {
return sectionString(self.FileOffset, "RESOURCE_DATA_ENTRY", self.Data)
}
type VSVersionInfoD struct {
Length uint16
ValueLength uint16
Type uint16
}
/* VSFixedFileInfo */
type VSFixedFileInfo struct {
Data VSFixedFileInfoD
FileOffset uint32
Size uint32
}
func NewVSFixedFileInfo(fileOffset uint32) (header *VSFixedFileInfo) {
header = new(VSFixedFileInfo)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *VSFixedFileInfo) String() string {
return sectionString(self.FileOffset, "VSFixedFileInfo", self.Data)
}
type VSFixedFileInfoD struct {
Signature uint32
StrucVersion uint32
FileVersionMS uint32
FileVersionLS uint32
ProductVersionMS uint32
ProductVersionLS uint32
FileFlagsMask uint32
FileFlags uint32
FileOS uint32
FileType uint32
FileSubtype uint32
FileDateMS uint32
FileDateLS uint32
}
/* StringFileInfo */
type StringFileInfo struct {
Data StringFileInfoD
FileOffset uint32
Size uint32
}
func NewStringFileInfo(fileOffset uint32) (header *StringFileInfo) {
header = new(StringFileInfo)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *StringFileInfo) String() string {
return sectionString(self.FileOffset, "StringFileInfo", self.Data)
}
type StringFileInfoD struct {
Length uint16
ValueLength uint16
Type uint16
}
/* StringTable */
type StringTable struct {
Data StringTableD
FileOffset uint32
Size uint32
}
func NewStringTable(fileOffset uint32) (header *StringTable) {
header = new(StringTable)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *StringTable) String() string {
return sectionString(self.FileOffset, "StringTable", self.Data)
}
type StringTableD struct {
Length uint16
ValueLength uint16
Type uint16
}
/* String */
type String struct {
Data StringD
FileOffset uint32
Size uint32
}
func NewString(fileOffset uint32) (header *String) {
header = new(String)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *String) String() string {
return sectionString(self.FileOffset, "String", self.Data)
}
type StringD struct {
Length uint16
ValueLength uint16
Type uint16
}
/* Var */
type Var struct {
Data VarD
FileOffset uint32
Size uint32
}
func NewVar(fileOffset uint32) (header *Var) {
header = new(Var)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *Var) String() string {
return sectionString(self.FileOffset, "Var", self.Data)
}
type VarD struct {
Length uint16
ValueLength uint16
Type uint16
}
/* ThunkData */
type ThunkData struct {
Data ThunkDataD
FileOffset uint32
Size uint32
}
func NewThunkData(fileOffset uint32) (header *ThunkData) {
header = new(ThunkData)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *ThunkData) String() string {
return sectionString(self.FileOffset, "ThunkData", self.Data)
}
type ThunkDataD struct {
AddressOfData uint32
}
/* ThunkData64 */
type ThunkData64 struct {
Data ThunkData64D
FileOffset uint32
Size uint32
}
func NewThunkData64(fileOffset uint32) (header *ThunkData64) {
header = new(ThunkData64)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *ThunkData64) String() string {
return sectionString(self.FileOffset, "ThunkData64", self.Data)
}
type ThunkData64D struct {
AddressOfData uint64
}
/* DebugDirectory */
type DebugDirectory struct {
Data DebugDirectoryD
FileOffset uint32
Flags map[string]bool
Size uint32
}
func NewDebugDirectory(fileOffset uint32) (header *DebugDirectory) {
header = new(DebugDirectory)
header.Size = uint32(binary.Size(header.Data))
header.Flags = make(map[string]bool)
header.FileOffset = fileOffset
return header
}
func (self *DebugDirectory) String() string {
return sectionString(self.FileOffset, "DebugDirectory", self.Data) + flagString(self.Flags)
}
type DebugDirectoryD struct {
Characteristics uint32
TimeDateStamp uint32
MajorVersion uint16
MinorVersion uint16
Type uint32
SizeOfData uint32
AddressOfRawData uint32
PointerToRawData uint32
}
/* BaseRelocation */
type BaseRelocation struct {
Data BaseRelocationD
FileOffset uint32
Size uint32
}
func NewBaseRelocation(fileOffset uint32) (header *BaseRelocation) {
header = new(BaseRelocation)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *BaseRelocation) String() string {
return sectionString(self.FileOffset, "BaseRelocation", self.Data)
}
type BaseRelocationD struct {
VirtualAddress uint32
SizeOfBlock uint32
}
/* BaseRelocationEntry */
type BaseRelocationEntry struct {
Data BaseRelocationEntryD
FileOffset uint32
Size uint32
}
func NewBaseRelocationEntry(fileOffset uint32) (header *BaseRelocationEntry) {
header = new(BaseRelocationEntry)
header.Size = uint32(binary.Size(header.Data))
header.FileOffset = fileOffset
return header
}
func (self *BaseRelocationEntry) String() string {
return sectionString(self.FileOffset, "BaseRelocationEntry", self.Data)
}
type BaseRelocationEntryD struct {
Data uint16
}
/* TLSDirectory */
type TLSDirectory struct {
Data TLSDirectoryD
FileOffset uint32
Flags map[string]bool
Size uint32
}
func NewTLSDirectory(fileOffset uint32) (header *TLSDirectory) {
header = new(TLSDirectory)
header.Size = uint32(binary.Size(header.Data))
header.Flags = make(map[string]bool)
header.FileOffset = fileOffset
return header
}
func (self *TLSDirectory) String() string {
return sectionString(self.FileOffset, "TLSDirectory", self.Data) + flagString(self.Flags)
}
type TLSDirectoryD struct {
StartAddressOfRawData uint32
EndAddressOfRawData uint32
AddressOfIndex uint32
AddressOfCallBacks uint32
SizeOfZeroFill uint32
Characteristics uint32
}
/* TLSDirectory64 */
type TLSDirectory64 struct {
Data TLSDirectory64D
FileOffset uint32
Flags map[string]bool
Size uint32
}
func NewTLSDirectory64(fileOffset uint32) (header *TLSDirectory64) {
header = new(TLSDirectory64)
header.Size = uint32(binary.Size(header.Data))
header.Flags = make(map[string]bool)
header.FileOffset = fileOffset
return header
}
func (self *TLSDirectory64) String() string {
return sectionString(self.FileOffset, "TLSDirectory64", self.Data) + flagString(self.Flags)
}
type TLSDirectory64D struct {
StartAddressOfRawData uint64
EndAddressOfRawData uint64
AddressOfIndex uint64
AddressOfCallBacks uint64
SizeOfZeroFill uint32
Characteristics uint32
}
/* LoadConfigDirectory */
type LoadConfigDirectory struct {
Data LoadConfigDirectoryD
FileOffset uint32
Flags map[string]bool
Size uint32
}
func NewLoadConfigDirectory(fileOffset uint32) (header *LoadConfigDirectory) {
header = new(LoadConfigDirectory)
header.Size = uint32(binary.Size(header.Data))
header.Flags = make(map[string]bool)
header.FileOffset = fileOffset
return header
}
func (self *LoadConfigDirectory) String() string {
return sectionString(self.FileOffset, "LoadConfigDirectory", self.Data) + flagString(self.Flags)
}
type LoadConfigDirectoryD struct {
Size uint32
TimeDateStamp uint32
MajorVersion uint16
MinorVersion uint16
GlobalFlagsClear uint32
GlobalFlagsSet uint32
CriticalSectionDefaultTimeout uint32
DeCommitFreeBlockThreshold uint32
DeCommitTotalFreeThreshold uint32
LockPrefixTable uint32
MaximumAllocationSize uint32
VirtualMemoryThreshold uint32
ProcessHeapFlags uint32
ProcessAffinityMask uint32
CSDVersion uint16
Reserved1 uint16
EditList uint32
SecurityCookie uint32
SEHandlerTable uint32
SEHandlerCount uint32
GuardCFCheckFunctionPointer uint32
Reserved2 uint32
GuardCFFunctionTable uint32
GuardCFFunctionCount uint32
GuardFlags uint32
}
/* LoadConfigDirectory64 */
type LoadConfigDirectory64 struct {
Data LoadConfigDirectory64D
FileOffset uint32
Flags map[string]bool
Size uint32
}
func NewLoadConfigDirectory64(fileOffset uint32) (header *LoadConfigDirectory64) {
header = new(LoadConfigDirectory64)
header.Size = uint32(binary.Size(header.Data))