I need to hook code: (all run in the kernel)
` ` ` c
Constexpr would s_RustClientModule []=L "uplay_r164. DLL";
UNICODE_STRING u_RustClientModule={0};
Funcs: : RtlInitUnicodeString (& amp; U_RustClientModule s_RustClientModule);
Const auto rust_client_exe=game. Get_module (& amp; U_RustClientModule nullptr);
if ( ! Rust_client_exe)
{
Game. Detach ();
Return STATUS_UNSUCCESSFUL;
}
Funcs: : DbgPrint (" rust_client_exe: % p \ n ", rust_client_exe);
Utils: : sleep (2000);
Auto import_address=utils: : get_imported_function (rust_client_exe, "CloseHandle");
if ( ! Import_address)
{
Game. Detach ();
Return STATUS_UNSUCCESSFUL;
}
Funcs: : DbgPrint (" import_address: % p \ n ", import_address);
Utils: : sleep (2000);
Auto import_ptr_protect=reinterpret_cast & lt; PVOID & gt; (import_address);
Auto import_ptr=reinterpret_cast & lt; Uintptr_t * & gt; (import_address);
Const auto original_import_ptr=* import_ptr;
Funcs: : DbgPrint (" import_ptr: % p \ n ", import_ptr);
Funcs: : DbgPrint (" import_ptr deref: % p \ n ", * import_ptr);
Funcs: : DbgPrint (" import_ptr address of: % p \ n ", & amp; Import_ptr);
Utils: : sleep (2000);
SIZE_T size=sizeof (uintptr_t);
ULONG old_access;
ULONG old_access2;
if ( ! NT_SUCCESS (funcs: : ZwProtectVirtualMemory (NtCurrentProcess (), & amp; Import_ptr_protect, & amp; The size, PAGE_READWRITE, & amp; Old_access)))
{
Funcs: : DbgPrint (" failed protect 1 ");
Utils: : sleep (2000);
Game. Detach ();
Return STATUS_UNSUCCESSFUL;
}
RtlCopyMemory (import_ptr, & amp; Entry_point, sizeof (entry_point));
Utils: : sleep (50);
if ( ! NT_SUCCESS (funcs: : ZwProtectVirtualMemory (NtCurrentProcess (), & amp; Import_ptr_protect, & amp; The size, old_access, & amp; Old_access2)))
{
Funcs: : DbgPrint (" failed protect 2 ");
Utils: : sleep (2000);
Game. Detach ();
Return STATUS_UNSUCCESSFUL;
}
Funcs: : DbgPrint (" finished hook ");
Utils: : sleep (2000); ` ` `
What is wrong?
