work
This commit is contained in:
@@ -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(),
|
||||
}];
|
||||
|
||||
Reference in New Issue
Block a user