This commit is contained in:
2026-06-08 20:30:21 -04:00
parent c17122679e
commit 6bc502d284
4 changed files with 45 additions and 13 deletions
+8 -4
View File
@@ -1,6 +1,6 @@
use crate::{
arch::x86_64::*,
backend::{Instr as BInstr, Program, pe::Import},
backend::{Instr as BInstr, Program, pe::LibImport},
};
use std::{fs::OpenOptions, io::Write, os::unix::fs::OpenOptionsExt, process::Command};
@@ -72,14 +72,18 @@ fn linux() {
fn windows() {
let mut program = Program::<X86_64>::default();
let entry = program.func([BInstr::Asm(Asm {
instrs: vec![push(39), pop(rax), Instr::Ret],
instrs: vec![
push(39),
pop(rax),
Instr::Ret
],
})]);
program.entry = Some(entry);
let linked = program.compile().expect("failed to compile");
let imports = &[Import {
let imports = &[LibImport {
name: "KERNEL32.dll".to_string(),
names: ["GetStdHandle", "WriteFile", "ExitProcess"]
syms: ["GetStdHandle", "WriteFile", "ExitProcess"]
.map(String::from)
.to_vec(),
}];