Improved Windows support
This commit is contained in:
@ -22,8 +22,8 @@ type ELF struct {
|
||||
|
||||
// New creates a new ELF binary.
|
||||
func New(code []byte, data []byte) *ELF {
|
||||
dataOffset := config.CodeOffset + int64(len(code))
|
||||
dataPadding := common.Padding(dataOffset, config.Align)
|
||||
dataOffset := CodeOffset + int64(len(code))
|
||||
dataPadding := common.Padding(dataOffset, Align)
|
||||
dataOffset += dataPadding
|
||||
|
||||
return &ELF{
|
||||
@ -37,7 +37,7 @@ func New(code []byte, data []byte) *ELF {
|
||||
Type: TypeExecutable,
|
||||
Architecture: ArchitectureAMD64,
|
||||
FileVersion: 1,
|
||||
EntryPointInMemory: config.BaseAddress + config.CodeOffset,
|
||||
EntryPointInMemory: config.BaseAddress + CodeOffset,
|
||||
ProgramHeaderOffset: HeaderSize,
|
||||
SectionHeaderOffset: 0,
|
||||
Flags: 0,
|
||||
@ -51,12 +51,12 @@ func New(code []byte, data []byte) *ELF {
|
||||
CodeHeader: ProgramHeader{
|
||||
Type: ProgramTypeLOAD,
|
||||
Flags: ProgramFlagsExecutable | ProgramFlagsReadable,
|
||||
Offset: config.CodeOffset,
|
||||
VirtualAddress: config.BaseAddress + config.CodeOffset,
|
||||
PhysicalAddress: config.BaseAddress + config.CodeOffset,
|
||||
Offset: CodeOffset,
|
||||
VirtualAddress: config.BaseAddress + CodeOffset,
|
||||
PhysicalAddress: config.BaseAddress + CodeOffset,
|
||||
SizeInFile: int64(len(code)),
|
||||
SizeInMemory: int64(len(code)),
|
||||
Align: config.Align,
|
||||
Align: Align,
|
||||
},
|
||||
DataHeader: ProgramHeader{
|
||||
Type: ProgramTypeLOAD,
|
||||
@ -66,7 +66,7 @@ func New(code []byte, data []byte) *ELF {
|
||||
PhysicalAddress: config.BaseAddress + dataOffset,
|
||||
SizeInFile: int64(len(data)),
|
||||
SizeInMemory: int64(len(data)),
|
||||
Align: config.Align,
|
||||
Align: Align,
|
||||
},
|
||||
CodePadding: nil,
|
||||
Code: code,
|
||||
|
Reference in New Issue
Block a user