diff --git a/Cargo.lock b/Cargo.lock index d96cc71..d219bf9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "anyhow" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" + [[package]] name = "autocfg" version = "1.1.0" @@ -237,9 +243,11 @@ dependencies = [ name = "gdke" version = "0.1.0" dependencies = [ + "anyhow", "crossbeam", "dll-syringe", "poggers", + "semver", "windows", ] @@ -615,6 +623,12 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "semver" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" + [[package]] name = "serde" version = "1.0.196" diff --git a/Cargo.toml b/Cargo.toml index a52bd02..4ae859c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,8 @@ strip = false # members = ["gdke-gui"] [dependencies] +semver = "*" +anyhow = "*" windows = { features = [ "Win32_Foundation", "Win32_System", diff --git a/gdkeinj/src/lib.rs b/gdkeinj/src/lib.rs index 2ac8794..3207107 100644 --- a/gdkeinj/src/lib.rs +++ b/gdkeinj/src/lib.rs @@ -1,11 +1,16 @@ use std::{net::UdpSocket, time::Duration}; -#[poggers_derive::create_entry(no_free)] +use poggers::structures::process::{implement::utils::ProcessUtils, Process}; + +#[poggers_derive::create_entry(no_console)] pub fn main() { let sock = UdpSocket::bind("127.0.0.1:29849").unwrap(); let mut buf = [1; 1]; sock.connect("127.0.0.1:28713").expect("uanble to connect"); + let proc = Process::this_process(); + let modd = proc.get_base_module().unwrap(); + println!("sending data"); std::thread::sleep(Duration::from_secs(2)); sock.send(&buf); diff --git a/src/lib.rs b/src/lib.rs index fd0479c..5e45ce0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ #![feature(offset_of)] +pub mod versioning; use std::{ error::Error, ffi::{c_void, CStr, CString}, diff --git a/src/versioning.rs b/src/versioning.rs new file mode 100644 index 0000000..c544bea --- /dev/null +++ b/src/versioning.rs @@ -0,0 +1,15 @@ +use std::{ + io::{Stdin, Stdout}, + path::Path, + process::{Command, Stdio}, +}; +fn check_gd_ver(exe: Path) -> anyhow::Result { + assert!(exe.exists()); + let stdo = Command::new(exe) + .arg("-V") + .arg("-s") + .arg("random-no-way-a-game-has-this-btw") + .stdout(Stdio::null()) + .output()?; + stdo.stdout +}