1+ using System . Runtime . InteropServices ;
2+
3+ namespace AuthenticodeLint . Interop
4+ {
5+ [ type: StructLayout ( LayoutKind . Sequential , Pack = 4 ) ]
6+ internal struct IMAGE_DOS_HEADER
7+ {
8+ public ushort e_magic ;
9+ public ushort e_cblp ;
10+ public ushort e_cp ;
11+ public ushort e_crlc ;
12+ public ushort e_cparhdr ;
13+ public ushort e_minalloc ;
14+ public ushort e_maxalloc ;
15+ public ushort e_ss ;
16+ public ushort e_sp ;
17+ public ushort e_csum ;
18+ public ushort e_ip ;
19+ public ushort e_cs ;
20+ public ushort e_lfarlc ;
21+ public ushort e_ovno ;
22+ public unsafe fixed ushort e_res [ 4 ] ;
23+ public ushort e_oemid ;
24+ public ushort e_oeminfo ;
25+ public unsafe fixed ushort e_res2 [ 10 ] ;
26+ public int e_lfanew ;
27+ }
28+
29+ [ type: StructLayout ( LayoutKind . Sequential , Size = 20 , Pack = 4 ) ]
30+ internal struct IMAGE_FILE_HEADER
31+ {
32+ public ushort Machine ;
33+ public ushort NumberOfSections ;
34+ public uint TimeDateStamp ;
35+ public uint PointerToSymbolTable ;
36+ public uint NumberOfSymbols ;
37+ public ushort SizeOfOptionalHeader ;
38+ public ushort Characteristics ;
39+ }
40+
41+ [ type: StructLayout ( LayoutKind . Sequential , Pack = 4 ) ]
42+ internal struct IMAGE_OPTIONAL_HEADER32
43+ {
44+ public ushort Magic ;
45+ public byte MajorLinkerVersion ;
46+ public byte MinorLinkerVersion ;
47+ public uint SizeOfCode ;
48+ public uint SizeOfInitializedData ;
49+ public uint SizeOfUninitializedData ;
50+ public uint AddressOfEntryPoint ;
51+ public uint BaseOfCode ;
52+ public uint BaseOfData ;
53+ public uint ImageBase ;
54+ public uint SectionAlignment ;
55+ public uint FileAlignment ;
56+ public ushort MajorOperatingSystemVersion ;
57+ public ushort MinorOperatingSystemVersion ;
58+ public ushort MajorImageVersion ;
59+ public ushort MinorImageVersion ;
60+ public ushort MajorSubsystemVersion ;
61+ public ushort MinorSubsystemVersion ;
62+ public uint Win32VersionValue ;
63+ public uint SizeOfImage ;
64+ public uint SizeOfHeaders ;
65+ public uint CheckSum ;
66+ public ushort Subsystem ;
67+ public ushort DllCharacteristics ;
68+ public uint SizeOfStackReserve ;
69+ public uint SizeOfStackCommit ;
70+ public uint SizeOfHeapReserve ;
71+ public uint SizeOfHeapCommit ;
72+ public uint LoaderFlags ;
73+ public uint NumberOfRvaAndSizes ;
74+ //Remove data directory.
75+ }
76+
77+ [ type: StructLayout ( LayoutKind . Sequential , Pack = 4 ) ]
78+ internal struct IMAGE_OPTIONAL_HEADER64
79+ {
80+ public ushort Magic ;
81+ public byte MajorLinkerVersion ;
82+ public byte MinorLinkerVersion ;
83+ public uint SizeOfCode ;
84+ public uint SizeOfInitializedData ;
85+ public uint SizeOfUninitializedData ;
86+ public uint AddressOfEntryPoint ;
87+ public uint BaseOfCode ;
88+ public ulong ImageBase ;
89+ public uint SectionAlignment ;
90+ public uint FileAlignment ;
91+ public ushort MajorOperatingSystemVersion ;
92+ public ushort MinorOperatingSystemVersion ;
93+ public ushort MajorImageVersion ;
94+ public ushort MinorImageVersion ;
95+ public ushort MajorSubsystemVersion ;
96+ public ushort MinorSubsystemVersion ;
97+ public uint Win32VersionValue ;
98+ public uint SizeOfImage ;
99+ public uint SizeOfHeaders ;
100+ public uint CheckSum ;
101+ public ushort Subsystem ;
102+ public ushort DllCharacteristics ;
103+ public ulong SizeOfStackReserve ;
104+ public ulong SizeOfStackCommit ;
105+ public ulong SizeOfHeapReserve ;
106+ public ulong SizeOfHeapCommit ;
107+ public uint LoaderFlags ;
108+ public uint NumberOfRvaAndSizes ;
109+ //Remove data directory.
110+ }
111+
112+ [ type: StructLayout ( LayoutKind . Sequential , Pack = 4 ) ]
113+ public struct IMAGE_DATA_DIRECTORY
114+ {
115+ public uint VirtualAddress ;
116+ public uint Size ;
117+ }
118+
119+ [ type: StructLayout ( LayoutKind . Sequential , Pack = 4 ) ]
120+ public struct IMAGE_SECTION_HEADER
121+ {
122+ public unsafe fixed byte Name [ 8 ] ;
123+ public uint PhysicalAddressOrVirtualSize ;
124+ public uint VirtualAddress ;
125+ public uint SizeOfRawData ;
126+ public uint PointerToRawData ;
127+ public uint PointerToRelocations ;
128+ public uint PointerToLinenumbers ;
129+ public ushort NumberOfRelocations ;
130+ public ushort NumberOfLinenumbers ;
131+ public uint Characteristics ;
132+ }
133+ }
0 commit comments