/
tables.go
328 lines (289 loc) · 7.42 KB
/
tables.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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
//go:generate genlayout
package winmd
import "github.com/microsoft/go-winmd/flags"
// Assembly is defined in §II.22.2.
// @table=0x20
type Assembly struct {
HashAlgID flags.AssemblyHashAlgorithm
MajorVersion uint16
MinorVersion uint16
BuildNumber uint16
RevisionNumber uint16
Flags flags.AssemblyFlags
PublicKey []byte
Name String
Culture String
}
// assemblyOS is defined in §II.22.3.
// This record should not be emitted into any PE file,
// but needed temporarily to calculate sizes and offsets for subsequent tables.
// @table=0x22
type assemblyOS struct {
OSPlatformID uint32
OSMajorVersion uint32
OSMinorVersion uint32
}
// assemblyProcessor is defined in §II.22.4.
// This record should not be emitted into any PE file,
// but needed temporarily to calculate sizes and offsets for subsequent tables.
// @table=0x21
type assemblyProcessor struct {
Processor uint32
}
// AssemblyRef is defined in §II.22.5.
// @table=0x23
type AssemblyRef struct {
MajorVersion uint16
MinorVersion uint16
BuildNumber uint16
RevisionNumber uint16
Flags flags.AssemblyFlags
PublicKeyOrToken []byte
Name String
Culture String
HashValue []byte
}
// assemblyRefOS is defined in §II.22.6.
// This record should not be emitted into any PE file,
// but needed temporarily to calculate sizes and offsets for subsequent tables.
// @table=0x25
type assemblyRefOS struct {
OSPlatformID uint32
OSMajorVersion uint32
OSMinorVersion uint32
AssemblyRef Index // @ref=AssemblyRef
}
// assemblyRefProcessor is defined in §II.22.7.
// This record should not be emitted into any PE file,
// but needed temporarily to calculate sizes and offsets for subsequent tables.
// @table=0x24
type assemblyRefProcessor struct {
Processor uint32
AssemblyRef Index // @ref=AssemblyRef
}
// ClassLayout is defined in §II.22.8.
// @table=0x0F
type ClassLayout struct {
PackingSize uint16
ClassSize uint32
Parent Index // @ref=TypeDef
}
// Constant is defined in §II.22.9.
// @table=0x0B
type Constant struct {
Type flags.ElementType
Padding byte // 1-byte padding zero
Parent CodedIndex // @code=HasConstant
Value []byte
}
// CustomAttribute is defined in §II.22.10.
// @table=0x0C
type CustomAttribute struct {
Parent CodedIndex // @code=HasCustomAttribute
Type CodedIndex // @code=CustomAttributeType
Value []byte
}
// DeclSecurity is defined in §II.22.11.
// @table=0x0E
type DeclSecurity struct {
Action uint16
Parent CodedIndex // @code=HasDeclSecurity
PermissionSet []byte
}
// EventMap is defined in §II.22.12.
// @table=0x12
type EventMap struct {
Parent Index // @ref=TypeDef
EventList Slice // @ref=Event
}
// Event is defined in §II.22.13.
// @table=0x14
type Event struct {
EventFlags flags.EventAttributes
Name String
EventType CodedIndex // @code=TypeDefOrRef
}
// ExportedType is defined in §II.22.14.
// @table=0x27
type ExportedType struct {
Flags flags.TypeAttributes
TypeDefID uint32 // index into a TypeDef table, used as hint only
Name String
Namespace String
Implementation CodedIndex // @code=Implementation
}
// Field is defined in §II.22.15.
// @table=0x04
type Field struct {
Flags flags.FieldAttributes
Name String
Signature SigFieldBlob
}
// FieldLayout is defined in §II.22.16.
// @table=0x10
type FieldLayout struct {
Offset uint32
Field Index // @ref=Field
}
// FieldMarshal is defined in §II.22.17.
// @table=0x0D
type FieldMarshal struct {
Parent CodedIndex // @code=HasFieldMarshal
NativeType []byte
}
// FieldRVA is defined in §II.22.18.
// @table=0x1D
type FieldRVA struct {
RVA uint32
Field Index // @ref=Field
}
// File is defined in §II.22.19.
// @table=0x26
type File struct {
Flags flags.FileAttributes
Name String
HashValue []byte
}
// GenericParam is defined in §II.22.20.
// @table=0x2A
type GenericParam struct {
Number uint16
Flags flags.GenericParamAttributes
Owner CodedIndex // @code=TypeOrMethodDef
Name String
}
// GenericParam is defined in §II.22.21.
// @table=0x2C
type GenericParamConstraint struct {
Owner Index // @ref=GenericParam
Constraint CodedIndex // @code=TypeDefOrRef
}
// ImplMap is defined in §II.22.22.
// @table=0x1C
type ImplMap struct {
MappingFlags flags.PInvokeAttributes
MemberForwarded CodedIndex // @code=MemberForwarded
ImportName String
ImportScope Index // @ref=ModuleRef
}
// InterfaceImpl is defined in §II.22.23.
// @table=0x09
type InterfaceImpl struct {
Class Index // @ref=TypeDef
Interface CodedIndex // @code=TypeDefOrRef
}
// ManifestResource is defined in §II.22.24.
// @table=0x28
type ManifestResource struct {
Offset uint32
Flags flags.ManifestResourceAttributes
Name String
Implementation CodedIndex // @code=Implementation
}
// MemberRef is defined in §II.22.25.
// @table=0x0A
type MemberRef struct {
Class CodedIndex // @code=MemberRefParent
Name String
Signature []byte
}
// MethodDef is defined in §II.22.26.
// @table=0x06
type MethodDef struct {
RVA uint32
ImplFlags flags.MethodImplAttributes
Flags flags.MethodAttributes
Name String
Signature SigMethodDefBlob
ParamList Slice // @ref=Param
}
// MethodImpl is defined in §II.22.27.
// @table=0x19
type MethodImpl struct {
Class Index // @ref=TypeDef
MethodBody CodedIndex // @code=MethodDefOrRef
MethodDeclaration CodedIndex // @code=MethodDefOrRef
}
// MethodImpl is defined in §II.22.28.
// @table=0x18
type MethodSemantics struct {
Semantics flags.MethodSemanticsAttributes
Method Index // @ref=MethodDef
Association CodedIndex // @code=HasSemantics
}
// MethodSpec is defined in §II.22.29.
// @table=0x2B
type MethodSpec struct {
Method CodedIndex // @code=MethodDefOrRef
Instantiation []byte
}
// Module is defined in §II.22.30.
// @table=0x00
type Module struct {
Generation uint16
Name String
Mvid [16]byte
EncID [16]byte
EncBaseID [16]byte
}
// ModuleRef is defined in §II.22.31.
// @table=0x1A
type ModuleRef struct {
Name String
}
// NestedClass is defined in §II.22.32.
// @table=0x29
type NestedClass struct {
NestedClass Index // @ref=TypeDef
EnclosingClass Index // @ref=TypeDef
}
// Param is defined in §II.22.33.
// @table=0x08
type Param struct {
Flags flags.ParamAttributes
Sequence uint16
Name String
}
// Property is defined in §II.22.34.
// @table=0x17
type Property struct {
Flags flags.PropertyAttributes
Name String
Type SigPropertyBlob
}
// PropertyMap is defined in §II.22.35.
// @table=0x15
type PropertyMap struct {
Parent Index // @ref=TypeDef
PropertyList Slice // @ref=Property
}
// StandAloneSig is defined in §II.22.36.
// @table=0x11
type StandAloneSig struct {
Signature []byte
}
// TypeDef is defined in §II.22.37.
// @table=0x02
type TypeDef struct {
Flags flags.TypeAttributes
Name String
Namespace String
Extends CodedIndex // @code=TypeDefOrRef
FieldList Slice // @ref=Field
MethodList Slice // @ref=MethodDef
}
// TypeRef is defined in §II.22.38.
// @table=0x01
type TypeRef struct {
ResolutionScope CodedIndex // @code=ResolutionScope
Name String
Namespace String
}
// TypeSpec is defined in §II.22.39.
// @table=0x1B
type TypeSpec struct {
Signature []byte
}