Clean up slightly

This commit is contained in:
Andrzej Janik
2020-02-10 20:56:09 +01:00
parent 5ec4c5cf72
commit 35caa53c3f

View File

@ -40,21 +40,19 @@ unsafe extern "system" fn NotCudaLoadLibraryExW(
#[no_mangle] #[no_mangle]
unsafe extern "system" fn DllMain(_: *const u8, dwReason: u32, _: *const u8) -> i32 { unsafe extern "system" fn DllMain(_: *const u8, dwReason: u32, _: *const u8) -> i32 {
if dwReason == DLL_PROCESS_ATTACH { if dwReason == DLL_PROCESS_ATTACH {
let mut load_lib_ex = LoadLibraryExW as *mut _;
DetourRestoreAfterWith(); DetourRestoreAfterWith();
DetourTransactionBegin(); DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread()); DetourUpdateThread(GetCurrentThread());
DetourAttach( DetourAttach(
&mut load_lib_ex, std::mem::transmute(&mut LOAD_LIBRARY_EX),
NotCudaLoadLibraryExW as *mut _, NotCudaLoadLibraryExW as *mut _,
); );
DetourTransactionCommit(); DetourTransactionCommit();
LOAD_LIBRARY_EX = std::mem::transmute(load_lib_ex);
} else if dwReason == DLL_PROCESS_DETACH { } else if dwReason == DLL_PROCESS_DETACH {
DetourTransactionBegin(); DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread()); DetourUpdateThread(GetCurrentThread());
DetourDetach( DetourDetach(
&mut (LOAD_LIBRARY_EX as *mut _), std::mem::transmute(&mut LOAD_LIBRARY_EX),
NotCudaLoadLibraryExW as *mut _, NotCudaLoadLibraryExW as *mut _,
); );
DetourTransactionCommit(); DetourTransactionCommit();