This commit is contained in:
2026-07-28 15:11:25 +08:00
parent 7ce2ded971
commit 9b00c5f6eb
16 changed files with 233 additions and 73 deletions
+19 -11
View File
@@ -52,14 +52,22 @@ namespace mouse_keybord_hook
auto install_mouse_keybord_hook() -> BOOL
{
auto _eprocess_process = kernel_function::FindProcess("winlogon.exe");
if (!_eprocess_process)
return FALSE;
auto apc_state = kernel_function::ke_stack_attch_process(_eprocess_process);
_ntSendInput = get_sendinput_hook_addr();
//auto _eprocess_process = kernel_function::FindProcess("winlogon.exe");
//if (!_eprocess_process)
// return FALSE;
//
//auto apc_state = kernel_function::ke_stack_attch_process(_eprocess_process);
if (!_ntSendInput)
{
_ntSendInput = get_sendinput_hook_addr();
}
else
{
if (_ntSendInput[0] == 0xff || _ntSendInput[1] == 0x25)
return TRUE;
}
auto os = utils::GetVersion();
if (os.dwBuildNumber == 7600 || os.dwBuildNumber == 7601)
{
@@ -70,8 +78,8 @@ namespace mouse_keybord_hook
inline_hooks_manager::fn_get_instance()->inline_install_hook(_ntSendInput, mouse_key_win10::hkNtUserSendInput, (void**)&origon_NtUserSendInput_win10);
}
kernel_function::ke_unstack_detach_process(apc_state);
ObDereferenceObject(_eprocess_process);
//kernel_function::ke_unstack_detach_process(apc_state);
//ObDereferenceObject(_eprocess_process);
return 0;
}
@@ -83,11 +91,11 @@ namespace mouse_keybord_hook
auto apc_state = kernel_function::ke_stack_attch_process(_eprocess_process);
inline_hooks_manager::fn_get_instance()->inline_remov_hook((void**)_ntSendInput);
auto status = inline_hooks_manager::fn_get_instance()->inline_remov_hook((void**)_ntSendInput);
kernel_function::ke_unstack_detach_process(apc_state);
ObDereferenceObject(_eprocess_process);
return 0;
return status;
}
}