Win10 X64 HOOK KiUserExceptionDispatcher
HOOK.ASM
extrn NewKiUserExceptionDispatcher : proc
extrn OrgKiUserExceptionDispatcher : proc
extrn OldKiUserExceptionDispatcher : proc
.data
.code
;hook
public MyKiUserExceptionDispatcher
MyKiUserExceptionDispatcher PROC
mov rcx, rsp
add rcx,4F0h
mov rdx,rsp
call NewKiUserExceptionDispatcher ;先经过我们自己的异常处理
;mov rax,[OldKiUserExceptionDispatcher] ;这样跳转回去会异常 原因未知
;jmp rax
;
mov rax, [OrgKiUserExceptionDispatcher] ;直接用原函数+偏移 跳到RtlDispatchException 这样可以
mov rax,[rax]
add rax ,1ch
jmp rax; RtlDispatchException
ret
MyKiUserExceptionDispatcher ENDP
END
HOOKFUC.H
#pragma once
#include <windows.h>
typedef VOID(WINAPI* PtrKiUserExceptionDispatcher)();
namespace HookEmu {
//extern "C" C形式导出
extern "C" PtrKiUserExceptionDispatcher OrgKiUserExceptionDispatcher;
extern "C" PtrKiUserExceptionDispatcher OldKiUserExceptionDispatcher;
extern HMODULE hNtDll ;
}
namespace HookFunction {
extern VOID HookKi();
}
namespace KiuserExc
{
extern "C" void MyKiUserExceptionDispatcher();//汇编导出
extern "C" void NewKiUserExceptionDispatcher(PEXCEPTION_RECORD ExceptionRecord, PCONTEXT Context);
}
namespace VEH_Tess
{
extern LONG __stdcall VEHandler(
EXCEPTION_POINTERS* ExceptionInfo
);
extern void InitVeh();