?? hookmng.h
字號:
#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"
#include "HookFactory.h"
class HookMng
{
private:
std::vector<Hook> mHooksInfo;
std::deque<Hook> mHooksDeque;
SingleProcessorMode mSingleMode;
public:
HookMng(){}
~HookMng(){ClearHooks();}
bool QueueHook(IN Hook& refHook);
bool ApplyQueuedHooks();
void CleanQueuedHooks();
void ClearHooks();
/* Function that hooking ntoskrnl functions in SDT */
protected:
void ExApplyQueuedHooks();
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 + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -