diff --git a/Cargo.lock b/Cargo.lock index cb9d8c1..12c3815 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1382,6 +1382,7 @@ name = "gdke-gui" version = "0.1.0" dependencies = [ "anyhow", + "gdke", "serde", "serde_json", "tauri", diff --git a/gdke-gui/bun.lockb b/gdke-gui/bun.lockb index dcd9187..d8f95cf 100755 Binary files a/gdke-gui/bun.lockb and b/gdke-gui/bun.lockb differ diff --git a/gdke-gui/src-tauri/Cargo.toml b/gdke-gui/src-tauri/Cargo.toml index 4721efa..a91738c 100644 --- a/gdke-gui/src-tauri/Cargo.toml +++ b/gdke-gui/src-tauri/Cargo.toml @@ -21,4 +21,4 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" tauri-plugin-dialog = "2.0.0-rc" anyhow = "*" -# gdke = { path = "../.." } +gdke = { path = "../.." } diff --git a/gdke-gui/src-tauri/src/lib.rs b/gdke-gui/src-tauri/src/lib.rs index bd343a1..c95a650 100644 --- a/gdke-gui/src-tauri/src/lib.rs +++ b/gdke-gui/src-tauri/src/lib.rs @@ -3,21 +3,23 @@ use std::{ffi::OsStr, path::Path}; // Learn more about Tauri commands at https://tauri.app/v1/guides/features/command #[tauri::command] fn get_secret(program: &Path, sig: &str) -> Result { - spawn_and_inject_sig(program, sig) - .map_err(|e| e.to_string()) - .map(|val| { - let mut hex_str = "0x".to_string(); - for char in val { - hex_str.push_str(&format!("{char:02X}")) - } - hex_str - }) + unsafe { + gdke::spawn_and_inject(program, sig) + .map_err(|e| e.to_string()) + .map(|val| { + let mut hex_str = "0x".to_string(); + for char in val { + hex_str.push_str(&format!("{char:02X}")) + } + hex_str + }) + } // String::new() } -fn spawn_and_inject_sig>(proc: T, sig: &str) -> anyhow::Result<[u8; 32]> { - Ok([62; 32]) - // Err(()) -} +// fn spawn_and_inject_sig>(proc: T, sig: &str) -> anyhow::Result<[u8; 32]> { +// Ok([62; 32]) +// // Err(()) +// } #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { diff --git a/gdke-gui/src/App.tsx b/gdke-gui/src/App.tsx index 8ed8ba5..6d59cd7 100644 --- a/gdke-gui/src/App.tsx +++ b/gdke-gui/src/App.tsx @@ -39,7 +39,7 @@ function App() { set_outcome([true, out as string]); set_loading(false); }, - (e) => { + (_) => { set_loading(false); set_outcome([false]); }, diff --git a/src/lib.rs b/src/lib.rs index 88b3e78..c1e4392 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -66,7 +66,7 @@ pub unsafe fn spawn_and_inject>(proc: T, sig: &str) -> anyhow::R if !pth.is_file() { panic!("file does not exist"); } - let cmd_line_c = CString::new(proc).expect("invalid cstr"); + let cmd_line_c = CString::new(proc.as_ref().as_encoded_bytes()).expect("invalid cstr"); let start_up_info = STARTUPINFOA { wShowWindow: 0, ..Default::default()