Added basic support for arm64

This commit is contained in:
2025-03-06 13:40:17 +01:00
parent 14abb8202b
commit 2f09b96f34
25 changed files with 270 additions and 33 deletions

View File

@ -35,12 +35,20 @@ func Write(writer io.Writer, code []byte, data []byte, dlls dll.List) {
importDirectorySize = DLLImportSize * len(dllImports)
importSectionSize = len(imports)*8 + len(dllData) + importDirectorySize
imageSize, _ = fs.Align(importsStart+importSectionSize, config.Align)
arch uint16
)
if dlls.Contains("user32") {
subSystem = IMAGE_SUBSYSTEM_WINDOWS_GUI
}
switch config.TargetArch {
case config.ARM:
arch = IMAGE_FILE_MACHINE_ARM64
case config.X86:
arch = IMAGE_FILE_MACHINE_AMD64
}
pe := &EXE{
DOSHeader: DOSHeader{
Magic: [4]byte{'M', 'Z', 0, 0},
@ -48,7 +56,7 @@ func Write(writer io.Writer, code []byte, data []byte, dlls dll.List) {
},
NTHeader: NTHeader{
Signature: [4]byte{'P', 'E', 0, 0},
Machine: IMAGE_FILE_MACHINE_AMD64,
Machine: arch,
NumberOfSections: uint16(NumSections),
TimeDateStamp: 0,
PointerToSymbolTable: 0,