hookmng.h
来自「在驱动下实现进程隐藏,在驱动下实现进程隐藏.」· C头文件 代码 · 共 50 行
H
50 行
#if !defined(AFX_HOOKMNG_H__CC466B43_CEF2_4037_8D0C_630973995D56__INCLUDED_)
#define AFX_HOOKMNG_H__CC466B43_CEF2_4037_8D0C_630973995D56__INCLUDED_
#include "common.h"
#include "SingleMode.h"
class HookMng
{
protected:
SingleProcessorMode mSingleMode;
public:
HookMng(){}
~HookMng(){}
template<class _Type>
bool ExSetHook(
_Type& refObject, // Object of specified _Type
void (_Type::*FuncPtr)()); // Pointer to a method of specified _Type
};
template<class _Type>
bool HookMng::ExSetHook(
_Type& refObject, // Object of specified _Type
void (_Type::*FuncPtr)()) // Pointer to a method of specified _Type
{
ULONG CR0Reg;
mSingleMode.Enter();
__asm
{
mov eax, cr0
mov CR0Reg,eax // save WP bit
and eax,0xFFFEFFFF // clear WP bit
mov cr0, eax
}
// Calling a method of specified _Type
(refObject.*FuncPtr)();
__asm
{
mov eax, CR0Reg
mov cr0, eax // restore WP bit
}
mSingleMode.Exit();
return true;
}
#endif // !defined(AFX_HOOKMNG_H__CC466B43_CEF2_4037_8D0C_630973995D56__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?