Documentation ¶
Overview ¶
Package md contains win32metadata structures and decoding helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLIHeader ¶
type CLIHeader struct { CB uint32 MajorRuntimeVersion uint16 MinorRuntimeVersion uint16 MetaData pe.DataDirectory Flags uint32 EntryPointTokenOrEntryPointRva uint32 Resources pe.DataDirectory StrongNameSignature pe.DataDirectory CodeManagerTable pe.DataDirectory VtableFixups pe.DataDirectory ExportAddressTableJumps pe.DataDirectory ManagedNativeHeader pe.DataDirectory }
CLIHeader is a II.25.3.3 CLI header representation.
type Column ¶
type Column struct { // Offset from row start. Offset uint32 // Size of column in bytes. Size uint32 }
Column represents metadata table column sizes.
type Metadata ¶
type Metadata struct { MetadataRoot // contains filtered or unexported fields }
Metadata is a simple wrapper around MetadataRoot to access metadata streams.
func ParseMetadata ¶
ParseMetadata parses and creates Metadata from given PE file.
func (*Metadata) ReadString ¶
ReadString reads string from String heap.
func (*Metadata) StreamByName ¶
func (m *Metadata) StreamByName(name string) (*io.SectionReader, error)
StreamByName finds and returns metadata section reader by name.
func (*Metadata) Tables ¶
func (m *Metadata) Tables() (TablesHeader, *io.SectionReader, error)
Tables decodes metadata tables header and returns it and table data reader.
type MetadataRoot ¶
type MetadataRoot struct { MajorVersion uint16 MinorVersion uint16 Reserved [4]byte Version string Flags uint16 StreamHeaders []StreamHeader }
MetadataRoot is a representation of II.24.2.1 Metadata root
type StreamHeader ¶
StreamHeader is a representation of II.24.2.2 Stream header.
type Table ¶
Table represents metadata table header.
func (*Table) SetRowType ¶
SetRowType sets rows sizes. NB: Zero size means that column is not present.
type TableType ¶
type TableType int
TableType is a metadata table type.
See II.22.1 Metadata validation rules.
const ( // Module table type. Module TableType = 0x00 // TypeRef table type. TypeRef TableType = 0x01 // TypeDef table type. TypeDef TableType = 0x02 // Field table type. Field TableType = 0x04 // MethodDef table type. MethodDef TableType = 0x06 // Param table type. Param TableType = 0x08 // InterfaceImpl table type. InterfaceImpl TableType = 0x09 // MemberRef table type. MemberRef TableType = 0x0a // Constant table type. Constant TableType = 0x0b // CustomAttribute table type. CustomAttribute TableType = 0x0c // FieldMarshal table type. FieldMarshal TableType = 0x0d // DeclSecurity table type. DeclSecurity TableType = 0x0e // ClassLayout table type. ClassLayout TableType = 0x0f // FieldLayout table type. FieldLayout TableType = 0x10 // StandAloneSig table type. StandAloneSig TableType = 0x11 // EventMap table type. EventMap TableType = 0x12 // Event table type. Event TableType = 0x14 // PropertyMap table type. PropertyMap TableType = 0x15 // Property table type. Property TableType = 0x17 // MethodSemantics table type. MethodSemantics TableType = 0x18 // MethodImpl table type. MethodImpl TableType = 0x19 // ModuleRef table type. ModuleRef TableType = 0x1a // TypeSpec table type. TypeSpec TableType = 0x1b // ImplMap table type. ImplMap TableType = 0x1c // FieldRva table type. FieldRva TableType = 0x1d // Assembly table type. Assembly TableType = 0x20 // AssemblyProcessor table type. AssemblyProcessor TableType = 0x21 // AssemblyOs table type. AssemblyOs TableType = 0x22 // AssemblyRef table type. AssemblyRef TableType = 0x23 // AssemblyRefProcessor table type. AssemblyRefProcessor TableType = 0x24 // AssemblyRefOs table type. AssemblyRefOs TableType = 0x25 // File table type. File TableType = 0x26 // ExportedType table type. ExportedType TableType = 0x27 // ManifestResource table type. ManifestResource TableType = 0x28 // NestedClass table type. NestedClass TableType = 0x29 // GenericParam table type. GenericParam TableType = 0x2a // MethodSpec table type. MethodSpec TableType = 0x2b // GenericParamConstraint table type. GenericParamConstraint TableType = 0x2c )
type TablesHeader ¶
type TablesHeader struct { Reserved [4]byte MajorVersion uint8 MinorVersion uint8 HeapSizes uint8 Reserved2 [1]byte Valid uint64 Sorted uint64 Tables [GenericParamConstraint + 1]Table }
TablesHeader is a representation of II.24.2.6 #~ stream.
func (TablesHeader) BlobIndexSize ¶
func (h TablesHeader) BlobIndexSize() uint32
BlobIndexSize returns size of index of "#Blob" heap.
func (*TablesHeader) Decode ¶
func (h *TablesHeader) Decode(r io.Reader) error
Decode decodes TablesHeader from stream.
func (TablesHeader) GUIDIndexSize ¶
func (h TablesHeader) GUIDIndexSize() uint32
GUIDIndexSize returns size of index of "#GUID" heap.
func (TablesHeader) StringIndexSize ¶
func (h TablesHeader) StringIndexSize() uint32
StringIndexSize returns size of index of "#String" heap.