coff

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2015 License: MIT Imports: 9 Imported by: 0

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}
	STRING_RDATA = [8]byte{'.', 'r', 'd', 'a', 't', 'a', 0, 0}

	LANG_ENTRY  = DirEntry{NameOrId: 0x0409} //FIXME: language; what value should be here?
	RELOC_ENTRY = RelocationEntry{
		SymbolIndex: 0,
		Type:        7,
	}
)

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        []Sizer

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

func NewRDATA

func NewRDATA() *Coff

func NewRSRC

func NewRSRC() *Coff

func (*Coff) AddData

func (coff *Coff) AddData(symbol string, data Sizer)

NOTE: only usable for Coff created using NewRDATA NOTE: symbol names must be probably >8 characters long NOTE: symbol names should not contain embedded zeroes

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) 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 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