style(hook): clippy -D warnings clean on default + fifa17 features

Modernize manual nul-terminated byte strings to C-string literals (c"...")
at all Win32 GetModuleHandleA/GetProcAddress/getaddrinfo call sites (byte-identical),
drop two redundant SOL_SOCKET-as-i32 casts, remove a needless return in the fifa17
install path, and add a # Safety section to DllMain. Scope the FIFA-23-path
dead-code/unused-import lints (unused only under the fifa17 feature, stripped by the
linker) with a documented crate-level cfg_attr allow. Cross-verified: both the
default and fifa17 builds now pass clippy -D warnings and compile; probe and
capture_baseline still build.
This commit is contained in:
funman300
2026-08-15 19:31:21 +00:00
parent 0d3f33cede
commit d1a71bd5a1
9 changed files with 30 additions and 15 deletions
+3 -3
View File
@@ -191,7 +191,7 @@ pub unsafe extern "system" fn hooked_connect(s: usize, name: *const u8, namelen:
let mut len: i32 = 4;
getsockopt(
s,
SOL_SOCKET as i32,
SOL_SOCKET,
SO_TYPE,
&mut ty as *mut i32 as *mut u8,
&mut len,
@@ -265,11 +265,11 @@ pub unsafe extern "system" fn hooked_wsa_connect(
pub unsafe fn install_inline_connect_hook() -> bool {
use windows_sys::Win32::System::LibraryLoader::{GetModuleHandleA, GetProcAddress};
let ws2 = GetModuleHandleA(b"ws2_32.dll\0".as_ptr());
let ws2 = GetModuleHandleA(c"ws2_32.dll".as_ptr().cast());
if ws2.is_null() {
return false;
}
let connect_fn = match GetProcAddress(ws2, b"connect\0".as_ptr()) {
let connect_fn = match GetProcAddress(ws2, c"connect".as_ptr().cast()) {
Some(f) => f as *mut u8,
None => return false,
};