hook 虚表
作者:互联网
原文链接:http://www.cnblogs.com/yueyue184/p/3210463.html
PVOID* GetVtpl(PVOID lpThis, int nIndex)
{
return *(PVOID**)lpThis + nIndex;
}
PVOID HookVtpl(PVOID* lpAddr, PVOID lpNewAddr)
{
DWORD dwOldProtect;
PVOID lpResult = NULL;
if ( VirtualProtect(lpAddr, sizeof (PVOID), PAGE_READWRITE, &dwOldProtect) )
{
lpResult = *lpAddr;
*lpAddr = lpNewAddr;
VirtualProtect(lpAddr, sizeof (PVOID), dwOldProtect, &dwOldProtect);
}
return lpResult;
}
void UnhookVtpl(PVOID* lpAddr, PVOID lpOldAddr)
{
HookVtpl(lpAddr, lpOldAddr);
}
转载于:https://www.cnblogs.com/yueyue184/p/3210463.html
标签:www,lpAddr,虚表,yueyue184,hook,dwOldProtect,PVOID,lpResult 来源: https://blog.csdn.net/weixin_30849403/article/details/99064120