coff

package
v0.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2021 License: MIT Imports: 10 Imported by: 140

Documentation

Index

Constants

View Source
const (
	MASK_SUBDIRECTORY = 1 << 31

	RT_ICON       = 3
	RT_GROUP_ICON = 3 + 11
	RT_MANIFEST   = 24
)
View Source
const (
	DT_PTR  = 1
	T_UCHAR = 12
)

http://www.delorie.com/djgpp/doc/coff/symtab.html

Variables

View Source
var (
	STRING_RSRC = [8]byte{'.', 'r', 's', 'r', 'c', 0, 0, 0}

	LANG_ENTRY = DirEntry{NameOrId: 0x0409} //FIXME: language; what value should be here?
)

Functions

This section is empty.

Types

type Auxiliary

type Auxiliary [18]byte

type Coff

type Coff struct {
	pe.FileHeader
	pe.SectionHeader32

	*Dir
	DataEntries []DataEntry
	Data        []PaddedData

	Relocations []RelocationEntry
	Symbols     []Symbol
	StringsHeader
	Strings []Sizer
}

func NewRSRC

func NewRSRC() *Coff

func (*Coff) AddResource

func (coff *Coff) AddResource(kind uint32, id uint16, data Sizer)

NOTE: function assumes that 'id' is increasing on each entry NOTE: only usable for Coff created using NewRSRC

func (*Coff) Arch added in v0.8.0

func (coff *Coff) Arch(arch string) error

NOTE: must be called immediately after NewRSRC, before any other functions.

func (*Coff) Freeze

func (coff *Coff) Freeze()

Freeze fills in some important offsets in resulting file.

type DataEntry

type DataEntry struct {
	OffsetToData uint32
	Size1        uint32
	CodePage     uint32 //FIXME: what value here? for now just using 0
	Reserved     uint32
}

type Dir

type Dir struct {
	Characteristics      uint32
	TimeDateStamp        uint32
	MajorVersion         uint16
	MinorVersion         uint16
	NumberOfNamedEntries uint16
	NumberOfIdEntries    uint16
	DirEntries
	Dirs
}

type DirEntries

type DirEntries []DirEntry

type DirEntry

type DirEntry struct {
	NameOrId     uint32
	OffsetToData uint32
}

type Dirs

type Dirs []Dir

type PaddedData added in v0.10.0

type PaddedData struct {
	Data    Sizer
	Padding []byte
}

type RelocationEntry

type RelocationEntry struct {
	RVA         uint32 // "offset within the Section's raw data where the address starts."
	SymbolIndex uint32 // "(zero based) index in the Symbol table to which the reference refers."
	Type        uint16
}

type Sizer

type Sizer interface {
	Size() int64 //NOTE: must not exceed limits of uint32, or behavior is undefined
}

type StringsHeader

type StringsHeader struct {
	Length uint32
}

type Symbol

type Symbol struct {
	Name           [8]byte
	Value          uint32
	SectionNumber  uint16
	Type           uint16
	StorageClass   uint8
	AuxiliaryCount uint8
	Auxiliaries    []Auxiliary
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL