Improved Windows support

This commit is contained in:
Eduard Urbach 2024-08-18 13:29:44 +02:00
parent 201f783a4d
commit fa1dce31f3
Signed by: eduard
GPG key ID: 49226B848C78F6C8
6 changed files with 127 additions and 63 deletions

View file

@ -77,7 +77,7 @@ func (r *Result) finalize() ([]byte, []byte) {
final.Label(asm.CALL_AT, "ExitProcess")
}
code, data := final.Finalize()
code, data := final.Finalize(windows.DLLs)
return code, data
}
@ -154,24 +154,7 @@ func write(writer io.Writer, code []byte, data []byte) error {
case "mac":
macho.Write(buffer, code, data)
case "windows":
dlls := []pe.DLL{
{
Name: "kernel32.dll",
Functions: []string{
"ExitProcess",
"GetStdHandle",
"WriteFile",
},
},
{
Name: "user32.dll",
Functions: []string{
"MessageBoxA",
},
},
}
pe.Write(buffer, code, data, dlls)
pe.Write(buffer, code, data, windows.DLLs)
default:
return fmt.Errorf("unsupported platform '%s'", config.TargetOS)
}