package pe
Import Path
debug/pe (on golang.org and go.dev)
Dependency Relation
imports 9 packages, and imported by 0 packages
Involved Source Files
d-> file.go
pe.go
section.go
string.go
symbol.go
Exported Type Names
type COFFSymbol (struct)
COFFSymbol represents single COFF symbol table record.
Name [8]uint8
NumberOfAuxSymbols uint8
SectionNumber int16
StorageClass uint8
Type uint16
Value uint32
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 (struct)
Size uint32
VirtualAddress uint32
type File (struct)
A File represents an open PE file.
// all COFF symbols (including auxiliary symbol records)
FileHeader FileHeader
FileHeader.Characteristics uint16
FileHeader.Machine uint16
FileHeader.NumberOfSections uint16
FileHeader.NumberOfSymbols uint32
FileHeader.PointerToSymbolTable uint32
FileHeader.SizeOfOptionalHeader uint16
FileHeader.TimeDateStamp uint32
// of type *OptionalHeader32 or *OptionalHeader64
Sections []*Section
StringTable StringTable
// COFF symbols with auxiliary symbol records removed
Close closes the File.
If the File was created using NewFile directly instead of Open,
Close has no effect.
(*T) DWARF() (*dwarf.Data, error)
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.
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.
*T : io.Closer
func NewFile(r io.ReaderAt) (*File, error)
func Open(name string) (*File, error)
type FileHeader (struct)
Characteristics uint16
Machine uint16
NumberOfSections uint16
NumberOfSymbols uint32
PointerToSymbolTable uint32
SizeOfOptionalHeader uint16
TimeDateStamp uint32
type FormatError (struct)
FormatError is unused.
The type is retained for compatibility.
(*T) Error() string
*T : error
type ImportDirectory (struct)
FirstThunk uint32
ForwarderChain uint32
Name uint32
OriginalFirstThunk uint32
TimeDateStamp uint32
type OptionalHeader32 (struct)
AddressOfEntryPoint uint32
BaseOfCode uint32
BaseOfData uint32
CheckSum uint32
DataDirectory [16]DataDirectory
DllCharacteristics uint16
FileAlignment uint32
ImageBase uint32
LoaderFlags uint32
Magic uint16
MajorImageVersion uint16
MajorLinkerVersion uint8
MajorOperatingSystemVersion uint16
MajorSubsystemVersion uint16
MinorImageVersion uint16
MinorLinkerVersion uint8
MinorOperatingSystemVersion uint16
MinorSubsystemVersion uint16
NumberOfRvaAndSizes uint32
SectionAlignment uint32
SizeOfCode uint32
SizeOfHeaders uint32
SizeOfHeapCommit uint32
SizeOfHeapReserve uint32
SizeOfImage uint32
SizeOfInitializedData uint32
SizeOfStackCommit uint32
SizeOfStackReserve uint32
SizeOfUninitializedData uint32
Subsystem uint16
Win32VersionValue uint32
type OptionalHeader64 (struct)
AddressOfEntryPoint uint32
BaseOfCode uint32
CheckSum uint32
DataDirectory [16]DataDirectory
DllCharacteristics uint16
FileAlignment uint32
ImageBase uint64
LoaderFlags uint32
Magic uint16
MajorImageVersion uint16
MajorLinkerVersion uint8
MajorOperatingSystemVersion uint16
MajorSubsystemVersion uint16
MinorImageVersion uint16
MinorLinkerVersion uint8
MinorOperatingSystemVersion uint16
MinorSubsystemVersion uint16
NumberOfRvaAndSizes uint32
SectionAlignment uint32
SizeOfCode uint32
SizeOfHeaders uint32
SizeOfHeapCommit uint64
SizeOfHeapReserve uint64
SizeOfImage uint32
SizeOfInitializedData uint32
SizeOfStackCommit uint64
SizeOfStackReserve uint64
SizeOfUninitializedData uint32
Subsystem uint16
Win32VersionValue uint32
type Reloc (struct)
Reloc represents a PE COFF relocation.
Each section contains its own relocation list.
SymbolTableIndex uint32
Type uint16
VirtualAddress uint32
type Section (struct)
Section provides access to PE COFF section.
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.
Relocs []Reloc
SectionHeader SectionHeader
SectionHeader.Characteristics uint32
SectionHeader.Name string
SectionHeader.NumberOfLineNumbers uint16
SectionHeader.NumberOfRelocations uint16
SectionHeader.Offset uint32
SectionHeader.PointerToLineNumbers uint32
SectionHeader.PointerToRelocations uint32
SectionHeader.Size uint32
SectionHeader.VirtualAddress uint32
SectionHeader.VirtualSize uint32
Data reads and returns the contents of the PE section s.
Open returns a new ReadSeeker reading the PE section s.
( T) ReadAt(p []byte, off int64) (n int, err error)
T : io.ReaderAt
func (*File).Section(name string) *Section
type SectionHeader (struct)
SectionHeader is similar to SectionHeader32 with Name
field replaced by Go string.
Characteristics uint32
Name string
NumberOfLineNumbers uint16
NumberOfRelocations uint16
Offset uint32
PointerToLineNumbers uint32
PointerToRelocations uint32
Size uint32
VirtualAddress uint32
VirtualSize uint32
type SectionHeader32 (struct)
SectionHeader32 represents real PE COFF section header.
Characteristics uint32
Name [8]uint8
NumberOfLineNumbers uint16
NumberOfRelocations uint16
PointerToLineNumbers uint32
PointerToRawData uint32
PointerToRelocations uint32
SizeOfRawData uint32
VirtualAddress uint32
VirtualSize uint32
type StringTable ([])
StringTable is a COFF string table.
String extracts string from COFF string table st at offset start.
func (*COFFSymbol).FullName(st StringTable) (string, error)
type Symbol (struct)
Symbol is similar to COFFSymbol with Name field replaced
by Go string. Symbol also does not have NumberOfAuxSymbols.
Name string
SectionNumber int16
StorageClass uint8
Type uint16
Value uint32
Exported Values
const COFFSymbolSize = 18
const IMAGE_DIRECTORY_ENTRY_ARCHITECTURE = 7
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_BASERELOC = 5
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT = 11
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR = 14
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_DEBUG = 6
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT = 13
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_EXCEPTION = 3
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_EXPORT = 0
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_GLOBALPTR = 8
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_IAT = 12
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_IMPORT = 1
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG = 10
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_RESOURCE = 2
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_SECURITY = 4
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_TLS = 9
IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DLLCHARACTERISTICS_APPCONTAINER = 4096
OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE = 64
OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY = 128
OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_GUARD_CF = 16384
OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA = 32
OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_NO_BIND = 2048
OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_NO_ISOLATION = 512
OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_NO_SEH = 1024
OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_NX_COMPAT = 256
OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = 32768
OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = 8192
OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
values. These can be combined together.
const IMAGE_FILE_32BIT_MACHINE = 256
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_AGGRESIVE_WS_TRIM = 16
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_BYTES_REVERSED_HI = 32768
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_BYTES_REVERSED_LO = 128
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_DEBUG_STRIPPED = 512
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_DLL = 8192
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_EXECUTABLE_IMAGE = 2
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_LARGE_ADDRESS_AWARE = 32
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_LINE_NUMS_STRIPPED = 4
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_LOCAL_SYMS_STRIPPED = 8
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_MACHINE_AM33 = 467
const IMAGE_FILE_MACHINE_AMD64 = 34404
const IMAGE_FILE_MACHINE_ARM = 448
const IMAGE_FILE_MACHINE_ARM64 = 43620
const IMAGE_FILE_MACHINE_ARMNT = 452
const IMAGE_FILE_MACHINE_EBC = 3772
const IMAGE_FILE_MACHINE_I386 = 332
const IMAGE_FILE_MACHINE_IA64 = 512
const IMAGE_FILE_MACHINE_M32R = 36929
const IMAGE_FILE_MACHINE_MIPS16 = 614
const IMAGE_FILE_MACHINE_MIPSFPU = 870
const IMAGE_FILE_MACHINE_MIPSFPU16 = 1126
const IMAGE_FILE_MACHINE_POWERPC = 496
const IMAGE_FILE_MACHINE_POWERPCFP = 497
const IMAGE_FILE_MACHINE_R4000 = 358
const IMAGE_FILE_MACHINE_SH3 = 418
const IMAGE_FILE_MACHINE_SH3DSP = 419
const IMAGE_FILE_MACHINE_SH4 = 422
const IMAGE_FILE_MACHINE_SH5 = 424
const IMAGE_FILE_MACHINE_THUMB = 450
const IMAGE_FILE_MACHINE_UNKNOWN = 0
const IMAGE_FILE_MACHINE_WCEMIPSV2 = 361
const IMAGE_FILE_NET_RUN_FROM_SWAP = 2048
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_RELOCS_STRIPPED = 1
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 1024
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_SYSTEM = 4096
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_UP_SYSTEM_ONLY = 16384
Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_SUBSYSTEM_EFI_APPLICATION = 10
OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11
OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_EFI_ROM = 13
OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12
OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_NATIVE = 1
OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_NATIVE_WINDOWS = 8
OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_OS2_CUI = 5
OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_POSIX_CUI = 7
OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_UNKNOWN = 0
OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16
OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_WINDOWS_CE_GUI = 9
OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_WINDOWS_CUI = 3
OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_WINDOWS_GUI = 2
OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_XBOX = 14
OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
![]() |
The pages are generated with Golds v0.1.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project and developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |