给个进程窗口保护的C完整代码给你研究研究,HOOK了如下函数:
//处理Kernel函数
UNICODE_STRING uniFuncName;
RtlInitUnicodeString(&uniFuncName,L"ObOpenObjectByPointer");
ObOpenObjectByPointer = MmGetSystemRoutineAddress(&uniFuncName);
RtlInitUnicodeString(&uniFuncName,L"KeInsertQueueApc");
KeInsertQueueApc = MmGetSystemRoutineAddress(&uniFuncName);
RtlInitUnicodeString(&uniFuncName,L"KeStackAttachProcess");
KeStackAttachProcess = MmGetSystemRoutineAddress(&uniFuncName);
RtlInitUnicodeString(&uniFuncName,L"KeAttachProcess");
KeAttachProcess = MmGetSystemRoutineAddress(&uniFuncName);
RtlInitUnicodeString(&uniFuncName,L"PsLookupThreadByThreadId");
PsLookupThreadByThreadId = MmGetSystemRoutineAddress(&uniFuncName);
//处理SSDT/SSSDT函数
NtDuplicateObject=(PVOID)GetSSDTCurAddr(NtDuplicateObject_Index,FALSE);
NtUserQueryWindow=(PVOID)GetSSDTCurAddr(NtUserQueryWindow_Index,TRUE); //当前SSDTSHADOW 函数指针 需要的自己加
NtUserFindWindowEx=(PVOID)GetSSDTCurAddr(NtUserFindWindowEx_Index,TRUE);
NtUserBuildHwndList=(PVOID)GetSSDTCurAddr(NtUserBuildHwndList_Index,TRUE);
NtUserWindowFromPoint=(PVOID)GetSSDTCurAddr(NtUserWindowFromPoint_Index,TRUE);
NtUserSetParent=(PVOID)GetSSDTCurAddr(NtUserSetParent_Index,TRUE);
NtUserPostMessage=(PVOID)GetSSDTCurAddr(NtUserPostMessage_Index,TRUE);
NtUserMessageCall=(PVOID)GetSSDTCurAddr(NtUserMessageCall_Index,TRUE);
NtUserDestroyWindow=(PVOID)GetSSDTCurAddr(NtUserDestroyWindow_Index,TRUE);
NtUserShowWindow=(PVOID)GetSSDTCurAddr(NtUserShowWindow_Index,TRUE);
NtUserSetWindowLong=(PVOID)GetSSDTCurAddr(NtUserSetWindowLong_Index,TRUE);