Overview
Package pe implements access to PE (Microsoft Windows Portable Executable)
files.
Index
- Constants
- type File
- type FileHeader
- type OptionalHeader32
- type Reloc
- type SectionHeader
- type StringTable
- type Symbol
Constants
- const COFFSymbolSize = 18
type COFFSymbol
COFFSymbol represents single COFF symbol table record.
func (*COFFSymbol) FullName
- func (sym *COFFSymbol) FullName(st ) (string, )
FullName finds real name of symbol sym. Normally name is stored in sym.Name, but
if it is longer then 8 characters, it is stored in COFF string table st instead.
type DataDirectory
- type DataDirectory struct {
- VirtualAddress uint32
- Size
- }
- type File struct {
- FileHeader
- OptionalHeader interface{} // of type *OptionalHeader32 or *OptionalHeader64
- Sections []*
- Symbols []*Symbol // COFF symbols with auxiliary symbol records removed
- COFFSymbols [] // all COFF symbols (including auxiliary symbol records)
- StringTable StringTable
- // contains filtered or unexported fields
A File represents an open PE file.
func
¶
NewFile creates a new File for accessing a PE binary in an underlying reader.
func
¶
- func Open(name ) (*File, )
Open opens the named file using os.Open and prepares it for use as a PE binary.
- func (f *File) Close()
Close closes the File. If the File was created using NewFile directly instead of
Open, Close has no effect.
func (*File) DWARF
func (*File) ImportedLibraries
ImportedLibraries returns the names of all libraries referred to by the binary f
that are expected to be linked with the binary at dynamic link time.
func (*File)
¶
- func (f *) ImportedSymbols() ([]string, )
ImportedSymbols returns the names of all symbols referred to by the binary f
that are expected to be satisfied by other libraries at dynamic load time. It
does not return weak symbols.
Section returns the first section with the given name, or nil if no such section
exists.
type
¶
type FormatError
- type FormatError struct {
- }
FormatError is unused. The type is retained for compatibility.
func (*FormatError) Error
- func (e *FormatError) Error()
type ImportDirectory
type
¶
- type OptionalHeader32 struct {
- Magic
- MajorLinkerVersion uint8
- MinorLinkerVersion
- SizeOfCode uint32
- SizeOfInitializedData
- SizeOfUninitializedData uint32
- AddressOfEntryPoint
- BaseOfCode uint32
- BaseOfData
- ImageBase uint32
- SectionAlignment
- FileAlignment uint32
- MajorOperatingSystemVersion
- MinorOperatingSystemVersion uint16
- MajorImageVersion
- MinorImageVersion uint16
- MajorSubsystemVersion
- MinorSubsystemVersion uint16
- Win32VersionValue
- SizeOfImage uint32
- SizeOfHeaders
- CheckSum uint32
- Subsystem
- DllCharacteristics uint16
- SizeOfStackReserve
- SizeOfHeapReserve uint32
- SizeOfHeapCommit
- LoaderFlags uint32
- NumberOfRvaAndSizes
- DataDirectory [16]DataDirectory
- }
type
¶
- type Reloc struct {
- VirtualAddress
- SymbolTableIndex uint32
- Type
- }
type Section
- type Section struct {
- SectionHeader
- Relocs []
- // Embed ReaderAt for ReadAt method.
- // Do not embed SectionReader directly
- // to avoid having Read and Seek.
- // If a client wants Read and Seek it must use
- // Open() to avoid fighting over the seek offset
- // with other clients.
- io.
- // contains filtered or unexported fields
- }
Section provides access to PE COFF section.
func (*Section) Data
Data reads and returns the contents of the PE section s.
func (*Section)
¶
- func (s *) Open() io.
Open returns a new ReadSeeker reading the PE section s.
type SectionHeader
SectionHeader is similar to SectionHeader32 with Name field replaced by Go
string.
type SectionHeader32
SectionHeader32 represents real PE COFF section header.
type StringTable
- type StringTable []byte
StringTable is a COFF string table.
String extracts string from COFF string table st at offset start.
type
¶
Symbol is similar to COFFSymbol with Name field replaced by Go string. Symbol
also does not have NumberOfAuxSymbols.