fix win
This commit is contained in:
parent
5caed9b6dc
commit
9ce292f450
3 changed files with 19 additions and 6 deletions
10
Cargo.toml
10
Cargo.toml
|
@ -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",
|
||||
] }
|
||||
|
|
|
@ -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!() }
|
||||
|
|
13
src/win.rs
13
src/win.rs
|
@ -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<()> {
|
||||
|
|
Loading…
Reference in a new issue