[MetaHook] BaseUI hook

Hook IBaseUI function.

  1 #include <metahook.h>
  2
  3 #include <IBaseUI.h>
  4
  5 IBaseUI *g_pBaseUI = 0;
  6
  7 void (__fastcall *g_pfnCBaseUI_Initialize)(void *pthis, int edx, CreateInterfaceFn *factories, int count) = 0;
  8 void (__fastcall *g_pfnCBaseUI_Start)(void *pthis, int edx, struct cl_enginefuncs_s *engineFuncs, int interfaceVersion) = 0;
  9 void (__fastcall *g_pfnCBaseUI_Shutdown)(void *pthis, int edx) = 0;
 10 int (__fastcall *g_pfnCBaseUI_Key_Event)(void *pthis, int edx, int down, int keynum, const char *pszCurrentBinding) = 0;
 11 void (__fastcall *g_pfnCBaseUI_CallEngineSurfaceProc)(void *pthis, int edx, void *hwnd, unsigned int msg, unsigned int wparam, long lparam) = 0;
 12 void (__fastcall *g_pfnCBaseUI_Paint)(void *pthis, int edx, int x, int y, int right, int bottom) = 0;
 13 void (__fastcall *g_pfnCBaseUI_HideGameUI)(void *pthis, int edx) = 0;
 14 void (__fastcall *g_pfnCBaseUI_ActivateGameUI)(void *pthis, int edx) = 0;
 15 bool (__fastcall *g_pfnCBaseUI_IsGameUIVisible)(void *pthis, int edx) = 0;
 16 void (__fastcall *g_pfnCBaseUI_HideConsole)(void *pthis, int edx) = 0;
 17 void (__fastcall *g_pfnCBaseUI_ShowConsole)(void *pthis, int edx) = 0;
 18
 19 class CBaseUI : public IBaseUI
 20 {
 21 public:
 22     void Initialize(CreateInterfaceFn *factories, int count);
 23     void Start(struct cl_enginefuncs_s *engineFuncs, int interfaceVersion);
 24     void Shutdown(void);
 25     int Key_Event(int down, int keynum, const char *pszCurrentBinding);
 26     void CallEngineSurfaceProc(void *hwnd, unsigned int msg, unsigned int wparam, long lparam);
 27     void Paint(int x, int y, int right, int bottom);
 28     void HideGameUI(void);
 29     void ActivateGameUI(void);
 30     bool IsGameUIVisible(void);
 31     void HideConsole(void);
 32     void ShowConsole(void);
 33 };
 34
 35 void CBaseUI::Initialize(CreateInterfaceFn *factories, int count)
 36 {
 37     return g_pfnCBaseUI_Initialize(this, 0, factories, count);
 38 }
 39
 40 void CBaseUI::Start(struct cl_enginefuncs_s *engineFuncs, int interfaceVersion)
 41 {
 42     return g_pfnCBaseUI_Start(this, 0, engineFuncs, interfaceVersion);
 43 }
 44
 45 void CBaseUI::Shutdown(void)
 46 {
 47     return g_pfnCBaseUI_Shutdown(this, 0);
 48 }
 49
 50 int CBaseUI::Key_Event(int down, int keynum, const char *pszCurrentBinding)
 51 {
 52     return g_pfnCBaseUI_Key_Event(this, 0, down, keynum, pszCurrentBinding);
 53 }
 54
 55 void CBaseUI::CallEngineSurfaceProc(void *hwnd, unsigned int msg, unsigned int wparam, long lparam)
 56 {
 57     return g_pfnCBaseUI_CallEngineSurfaceProc(this, 0, hwnd, msg, wparam, lparam);
 58 }
 59
 60 void CBaseUI::Paint(int x, int y, int right, int bottom)
 61 {
 62     return g_pfnCBaseUI_Paint(this, 0, x, y, right, bottom);
 63 }
 64
 65 void CBaseUI::HideGameUI(void)
 66 {
 67     return g_pfnCBaseUI_HideGameUI(this, 0);
 68 }
 69
 70 void CBaseUI::ActivateGameUI(void)
 71 {
 72     return g_pfnCBaseUI_ActivateGameUI(this, 0);
 73 }
 74
 75 bool CBaseUI::IsGameUIVisible(void)
 76 {
 77     return g_pfnCBaseUI_IsGameUIVisible(this, 0);
 78 }
 79
 80 void CBaseUI::HideConsole(void)
 81 {
 82     return g_pfnCBaseUI_HideConsole(this, 0);
 83 }
 84
 85 void CBaseUI::ShowConsole(void)
 86 {
 87     return g_pfnCBaseUI_ShowConsole(this, 0);
 88 }
 89
 90 void BaseUI_InstallHook(void)
 91 {
 92     CreateInterfaceFn EngineCreateInterface = g_pMetaHookAPI->GetEngineFactory();
 93     g_pBaseUI = (IBaseUI *)EngineCreateInterface(BASEUI_INTERFACE_VERSION, 0);
 94
 95     CBaseUI BaseUI;
 96     DWORD *pVFTable = *(DWORD **)&BaseUI;
 97
 98     g_pMetaHookAPI->VFTHook(g_pBaseUI, 0,  1, (void *)pVFTable[ 1], (void *&)g_pfnCBaseUI_Initialize);
 99     g_pMetaHookAPI->VFTHook(g_pBaseUI, 0,  2, (void *)pVFTable[ 2], (void *&)g_pfnCBaseUI_Start);
100     g_pMetaHookAPI->VFTHook(g_pBaseUI, 0,  3, (void *)pVFTable[ 3], (void *&)g_pfnCBaseUI_Shutdown);
101     g_pMetaHookAPI->VFTHook(g_pBaseUI, 0,  4, (void *)pVFTable[ 4], (void *&)g_pfnCBaseUI_Key_Event);
102     g_pMetaHookAPI->VFTHook(g_pBaseUI, 0,  5, (void *)pVFTable[ 5], (void *&)g_pfnCBaseUI_CallEngineSurfaceProc);
103     g_pMetaHookAPI->VFTHook(g_pBaseUI, 0,  6, (void *)pVFTable[ 6], (void *&)g_pfnCBaseUI_Paint);
104     g_pMetaHookAPI->VFTHook(g_pBaseUI, 0,  7, (void *)pVFTable[ 7], (void *&)g_pfnCBaseUI_HideGameUI);
105     g_pMetaHookAPI->VFTHook(g_pBaseUI, 0,  8, (void *)pVFTable[ 8], (void *&)g_pfnCBaseUI_ActivateGameUI);
106     g_pMetaHookAPI->VFTHook(g_pBaseUI, 0,  9, (void *)pVFTable[ 9], (void *&)g_pfnCBaseUI_IsGameUIVisible);
107     g_pMetaHookAPI->VFTHook(g_pBaseUI, 0, 10, (void *)pVFTable[10], (void *&)g_pfnCBaseUI_HideConsole);
108     g_pMetaHookAPI->VFTHook(g_pBaseUI, 0, 11, (void *)pVFTable[11], (void *&)g_pfnCBaseUI_ShowConsole);
109 }
时间: 2024-10-12 02:21:15

[MetaHook] BaseUI hook的相关文章

[MetaHook] Surface hook

Hook ISurface function. 1 #include <metahook.h> 2 #include <vgui/ISurface.h> 3 4 using namespace vgui; 5 6 ISurface *g_pSurface = 0; 7 8 void (__fastcall *g_pfnCSurface_Shutdown)(void *pthis, int edx) = 0; 9 void (__fastcall *g_pfnCSurface_Run

[MetaHook] Event Hook

1 #include <metahook.h> 2 3 struct event_hook_t 4 { 5 event_hook_t *next; 6 char *name; 7 void (*pfnEvent)(event_args_s *args); 8 }; 9 10 #define HOOKEVENT_SIG "\x8D\x44\x24\x08\x56\x8D\x4C\x24\x08\x50\x51\xFF\x15\x2A\x2A\x2A\x2A\x8B\x44\x24\x1

[MetaHook] Load large texture from model

We need hook "GL_LoadTexture" engine function. GL_LOADTEXTURE_SIG from hw.dll(3266) engine, can not use for other engine version. 1 #include <metahook.h> 2 #include "qgl.h" 3 #include "surface.h" 4 5 extern DWORD g_dwEn

HOOK钩子技术5 SSDT Inline Hook

原理 内联钩子的原理在R3和R0下是相同的,就是不改变SSDT表项,而是改变函数内部前几条指令. 内联钩子的典型伪函数为: 恢复原指令 执行目标操作,或改写参数 执行原函数 返回时重新挂钩 demo #include "stdafx.h" #ifdef __cplusplus extern "C" NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)

HDU 1689 Just a Hook 线段树区间更新求和

点击打开链接 Just a Hook Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 18894    Accepted Submission(s): 9483 Problem Description In the game of DotA, Pudge's meat hook is actually the most horrible

hdu 1698 Just a Hook(线段树,成段更新,懒惰标记)

Just a Hook Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 18384    Accepted Submission(s): 9217 Problem Description In the game of DotA, Pudge's meat hook is actually the most horrible thing

svn集成ReviewBoard,让post-commit hook后台运行

代码评审(Code Review)不但可以提高质量,而且还是一个知识共享和指导的极好的手段. 代码评审(CodeReview)一般有两种形式:pre-commit-review,post-commit-review. pre-commit-review是指代码提交到代码库前进行代码评审: post-commit-review是指代码提交到代码库后进行代码评审. ReviewBoard是一个开源的基于web的代码评审工具,支持Subversion,CVS,Git和Mercurial版本控制系统.

gitlab+jenkins+hook代码自动构建发布上线

Gitlab+Jenkins+Hook 1.gitlab和jenkins的安装见: http://www.cnblogs.com/cuishuai/p/7544663.html http://www.cnblogs.com/cuishuai/p/7544775.html 2.gitlab配置 1)创建一个project,并创建一个monkey的分支. 2)对分支进行设置: 点击project->settings->integrations: 1. 2. 3 Webhook,点击test,返回如

android hook 框架 libinject2 简介、编译、运行

简介: libinject 最开始是2011年看雪android安全版版主之一‘古河’大神发布的一份android平台的注入库:  发个Android平台上的注入代码  ,网上很多随后发布的注入代码都是其变种,不过我这几天尝试运行那份代码,发现有些问题,本博运行和分析的代码是另外一位大神的改进版本,在我的环境里运行注入和挂钩都成功了 : Android中的so注入(inject)和挂钩(hook) - For both x86 and arm ,为了表示区别,我把这个项目称为  libinjec