上一个内容:43.实现HOOK接管寄存器数据
以 43.实现HOOK接管寄存器数据 它的代码为基础进行修改
首先创建一个类
这里创建的名为HOOKPOINT.h
HOOKPOINT.cpp文件里面的内容
#include "pch.h"
#include "HOOKPOINT.h"
HOOKPOINT::HOOKPOINT()
{
}
HOOKPOINT::HOOKPOINT(LPVOID _adr, HOOKBACK _hbk, HOOKPOINT* _BackP, HOOKPOINT* _NextPoint):
Address(_adr), DestCall(_hbk), BackPoint{ _BackP }, NextPoint{ _NextPoint }
{
}
HOOKPOINT* HOOKPOINT::AddPonit(LPVOID _adr, HOOKBACK _hbk)
{
NextPoint = new HOOKPOINT(_adr, _hbk, this);
return NextPoint;
}
HOOKPOINT* HOOKPOINT::FindPoint(LPVOID _adr)
{
PHOOKPOINT _point = this;
do {
if (_point->Address == _adr)return this;
_point = _point->NextPoint;
}while(_point);
return nullptr;
}
HOOKPOINT.h文件中的内容
#pragma once
typedef struct CPUINFO {
unsigned eflags;
unsigned edi;
unsigned esi;
unsigned ebp;
unsigned esp;
unsigned ebx;
unsigned edx;
unsigned ecx;
unsigned eax;
unsigned eip;
}*PCPUINFO;
typedef bool (*HOOKBACK)(PCPUINFO);
typedef class HOOKPOINT
{
LPVOID Address;
HOOKBACK DestCall;
HOOKPOINT* NextPoint;
HOOKPOINT* BackPoint;
public:
HOOKPOINT();
HOOKPOINT(LPVOID, HOOKBACK, HOOKPOINT*, HOOKPOINT* _NextPoint = NULL);
HOOKPOINT* AddPonit(LPVOID, HOOKBACK);
HOOKPOINT* FindPoint(LPVOID);
}*PHOOKPOINT;