push work on version detection

This commit is contained in:
pozm 2024-01-30 20:38:15 +00:00
parent 6e5f96fd72
commit a2349d7491
No known key found for this signature in database
GPG Key ID: 5AB655AFC8AAA822
5 changed files with 38 additions and 1 deletions

14
Cargo.lock generated
View File

@ -2,6 +2,12 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "anyhow"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
@ -237,9 +243,11 @@ dependencies = [
name = "gdke" name = "gdke"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"anyhow",
"crossbeam", "crossbeam",
"dll-syringe", "dll-syringe",
"poggers", "poggers",
"semver",
"windows", "windows",
] ]
@ -615,6 +623,12 @@ dependencies = [
"syn 2.0.48", "syn 2.0.48",
] ]
[[package]]
name = "semver"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.196" version = "1.0.196"

View File

@ -19,6 +19,8 @@ strip = false
# members = ["gdke-gui"] # members = ["gdke-gui"]
[dependencies] [dependencies]
semver = "*"
anyhow = "*"
windows = { features = [ windows = { features = [
"Win32_Foundation", "Win32_Foundation",
"Win32_System", "Win32_System",

View File

@ -1,11 +1,16 @@
use std::{net::UdpSocket, time::Duration}; 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() { pub fn main() {
let sock = UdpSocket::bind("127.0.0.1:29849").unwrap(); let sock = UdpSocket::bind("127.0.0.1:29849").unwrap();
let mut buf = [1; 1]; let mut buf = [1; 1];
sock.connect("127.0.0.1:28713").expect("uanble to connect"); 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"); println!("sending data");
std::thread::sleep(Duration::from_secs(2)); std::thread::sleep(Duration::from_secs(2));
sock.send(&buf); sock.send(&buf);

View File

@ -1,4 +1,5 @@
#![feature(offset_of)] #![feature(offset_of)]
pub mod versioning;
use std::{ use std::{
error::Error, error::Error,
ffi::{c_void, CStr, CString}, ffi::{c_void, CStr, CString},

15
src/versioning.rs Normal file
View File

@ -0,0 +1,15 @@
use std::{
io::{Stdin, Stdout},
path::Path,
process::{Command, Stdio},
};
fn check_gd_ver(exe: Path) -> anyhow::Result<semver::Version> {
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
}