This commit is contained in:
davidontop 2024-08-01 15:08:56 +02:00
parent 5caed9b6dc
commit 9ce292f450
Signed by: DavidOnTop
GPG key ID: 5D05538A45D5149F
3 changed files with 19 additions and 6 deletions

View file

@ -13,4 +13,12 @@ repository = "https://git.davidon.top/public/elfloader.git"
memfd-exec = "0.2.1"
[target.'cfg(target_os = "windows")'.dependencies]
winapi = "0.3.9"
winapi = { version = "0.3.9", features = [
"fileapi",
"namedpipeapi",
"processenv",
"memoryapi",
"processthreadsapi",
"winbase",
"winnt",
] }

View file

@ -1,6 +1,6 @@
#[cfg(target_os = "linux")]
pub mod linux;
#[cfg(target_os = "windows")]
//#[cfg(target_os = "windows")]
pub mod win;
pub fn run(name: String, executable: Vec<u8>) { todo!() }

View file

@ -1,10 +1,15 @@
use std::{ptr, thread};
use std::{os::windows::raw::HANDLE, ptr, thread};
use winapi::um::{
memoryapi::{VirtualAllocEx, VirtualProtectEx},
fileapi::WriteFile,
memoryapi::{VirtualAllocEx, VirtualProtectEx, WriteProcessMemory},
namedpipeapi::CreatePipe,
processenv::GetStdHandle,
processthreadsapi::{CreateProcessA, OpenProcess},
winbase::CREATE_NO_WINDOW,
winnt::{PROCESS_ALL_ACCESS, SECURITY_ATTRIBUTES},
winbase::{CREATE_NO_WINDOW, STD_INPUT_HANDLE},
winnt::{
MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE_READWRITE, PROCESS_ALL_ACCESS, SECURITY_ATTRIBUTES,
},
};
pub fn run(name: String, pe: Vec<u8>, stdin: Vec<u8>) -> std::io::Result<()> {