[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_RunFrame)(void *pthis, int edx) = 0;
 10 VPANEL (__fastcall *g_pfnCSurface_GetEmbeddedPanel)(void *pthis, int edx) = 0;
 11 void (__fastcall *g_pfnCSurface_SetEmbeddedPanel)(void *pthis, int edx, VPANEL pPanel) = 0;
 12 void (__fastcall *g_pfnCSurface_PushMakeCurrent)(void *pthis, int edx, VPANEL panel, bool useInsets) = 0;
 13 void (__fastcall *g_pfnCSurface_PopMakeCurrent)(void *pthis, int edx, VPANEL panel) = 0;
 14 void (__fastcall *g_pfnCSurface_DrawSetColor)(void *pthis, int edx, int r, int g, int b, int a) = 0;
 15 void (__fastcall *g_pfnCSurface_DrawSetColor2)(void *pthis, int edx, Color col) = 0;
 16 void (__fastcall *g_pfnCSurface_DrawFilledRect)(void *pthis, int edx, int x0, int y0, int x1, int y1) = 0;
 17 void (__fastcall *g_pfnCSurface_DrawOutlinedRect)(void *pthis, int edx, int x0, int y0, int x1, int y1) = 0;
 18 void (__fastcall *g_pfnCSurface_DrawLine)(void *pthis, int edx, int x0, int y0, int x1, int y1) = 0;
 19 void (__fastcall *g_pfnCSurface_DrawPolyLine)(void *pthis, int edx, int *px, int *py, int numPoints) = 0;
 20 void (__fastcall *g_pfnCSurface_DrawSetTextFont)(void *pthis, int edx, HFont font) = 0;
 21 void (__fastcall *g_pfnCSurface_DrawSetTextColor)(void *pthis, int edx, int r, int g, int b, int a) = 0;
 22 void (__fastcall *g_pfnCSurface_DrawSetTextColor2)(void *pthis, int edx, Color col) = 0;
 23 void (__fastcall *g_pfnCSurface_DrawSetTextPos)(void *pthis, int edx, int x, int y) = 0;
 24 void (__fastcall *g_pfnCSurface_DrawGetTextPos)(void *pthis, int edx, int &x, int &y) = 0;
 25 void (__fastcall *g_pfnCSurface_DrawPrintText)(void *pthis, int edx, const wchar_t *text, int textLen) = 0;
 26 void (__fastcall *g_pfnCSurface_DrawUnicodeChar)(void *pthis, int edx, wchar_t wch) = 0;
 27 void (__fastcall *g_pfnCSurface_DrawUnicodeCharAdd)(void *pthis, int edx, wchar_t wch) = 0;
 28 void (__fastcall *g_pfnCSurface_DrawFlushText)(void *pthis, int edx) = 0;
 29 IHTML* (__fastcall *g_pfnCSurface_CreateHTMLWindow)(void *pthis, int edx, IHTMLEvents *events, VPANEL context) = 0;
 30 void (__fastcall *g_pfnCSurface_PaintHTMLWindow)(void *pthis, int edx, IHTML *htmlwin) = 0;
 31 void (__fastcall *g_pfnCSurface_DeleteHTMLWindow)(void *pthis, int edx, IHTML *htmlwin) = 0;
 32 void (__fastcall *g_pfnCSurface_DrawSetTextureFile)(void *pthis, int edx, int id, const char *filename, int hardwareFilter, bool forceReload) = 0;
 33 void (__fastcall *g_pfnCSurface_DrawSetTextureRGBA)(void *pthis, int edx, int id, const unsigned char *rgba, int wide, int tall, int hardwareFilter, bool forceReload) = 0;
 34 void (__fastcall *g_pfnCSurface_DrawSetTexture)(void *pthis, int edx, int id) = 0;
 35 void (__fastcall *g_pfnCSurface_DrawGetTextureSize)(void *pthis, int edx, int id, int &wide, int &tall) = 0;
 36 void (__fastcall *g_pfnCSurface_DrawTexturedRect)(void *pthis, int edx, int x0, int y0, int x1, int y1) = 0;
 37 bool (__fastcall *g_pfnCSurface_IsTextureIDValid)(void *pthis, int edx, int id) = 0;
 38 int (__fastcall *g_pfnCSurface_CreateNewTextureID)(void *pthis, int edx, bool procedural) = 0;
 39 void (__fastcall *g_pfnCSurface_GetScreenSize)(void *pthis, int edx, int &wide, int &tall) = 0;
 40 void (__fastcall *g_pfnCSurface_SetAsTopMost)(void *pthis, int edx, VPANEL panel, bool state) = 0;
 41 void (__fastcall *g_pfnCSurface_BringToFront)(void *pthis, int edx, VPANEL panel) = 0;
 42 void (__fastcall *g_pfnCSurface_SetForegroundWindow)(void *pthis, int edx, VPANEL panel) = 0;
 43 void (__fastcall *g_pfnCSurface_SetPanelVisible)(void *pthis, int edx, VPANEL panel, bool state) = 0;
 44 void (__fastcall *g_pfnCSurface_SetMinimized)(void *pthis, int edx, VPANEL panel, bool state) = 0;
 45 bool (__fastcall *g_pfnCSurface_IsMinimized)(void *pthis, int edx, VPANEL panel) = 0;
 46 void (__fastcall *g_pfnCSurface_FlashWindow)(void *pthis, int edx, VPANEL panel, bool state) = 0;
 47 void (__fastcall *g_pfnCSurface_SetTitle)(void *pthis, int edx, VPANEL panel, const wchar_t *title) = 0;
 48 void (__fastcall *g_pfnCSurface_SetAsToolBar)(void *pthis, int edx, VPANEL panel, bool state) = 0;
 49 void (__fastcall *g_pfnCSurface_CreatePopup)(void *pthis, int edx, VPANEL panel, bool minimised, bool showTaskbarIcon, bool disabled, bool mouseInput, bool kbInput) = 0;
 50 void (__fastcall *g_pfnCSurface_SwapBuffers)(void *pthis, int edx, VPANEL panel) = 0;
 51 void (__fastcall *g_pfnCSurface_Invalidate)(void *pthis, int edx, VPANEL panel) = 0;
 52 void (__fastcall *g_pfnCSurface_SetCursor)(void *pthis, int edx, HCursor cursor) = 0;
 53 bool (__fastcall *g_pfnCSurface_IsCursorVisible)(void *pthis, int edx) = 0;
 54 void (__fastcall *g_pfnCSurface_ApplyChanges)(void *pthis, int edx) = 0;
 55 bool (__fastcall *g_pfnCSurface_IsWithin)(void *pthis, int edx, int x, int y) = 0;
 56 bool (__fastcall *g_pfnCSurface_HasFocus)(void *pthis, int edx) = 0;
 57 bool (__fastcall *g_pfnCSurface_SupportsFeature)(void *pthis, int edx, ISurface::SurfaceFeature_e feature) = 0;
 58 void (__fastcall *g_pfnCSurface_RestrictPaintToSinglePanel)(void *pthis, int edx, VPANEL panel) = 0;
 59 void (__fastcall *g_pfnCSurface_SetModalPanel)(void *pthis, int edx, VPANEL panel) = 0;
 60 VPANEL (__fastcall *g_pfnCSurface_GetModalPanel)(void *pthis, int edx) = 0;
 61 void (__fastcall *g_pfnCSurface_UnlockCursor)(void *pthis, int edx) = 0;
 62 void (__fastcall *g_pfnCSurface_LockCursor)(void *pthis, int edx) = 0;
 63 void (__fastcall *g_pfnCSurface_SetTranslateExtendedKeys)(void *pthis, int edx, bool state) = 0;
 64 VPANEL (__fastcall *g_pfnCSurface_GetTopmostPopup)(void *pthis, int edx) = 0;
 65 void (__fastcall *g_pfnCSurface_SetTopLevelFocus)(void *pthis, int edx, VPANEL panel) = 0;
 66 HFont (__fastcall *g_pfnCSurface_CreateFont)(void *pthis, int edx) = 0;
 67 bool (__fastcall *g_pfnCSurface_AddGlyphSetToFont)(void *pthis, int edx, HFont font, const char *windowsFontName, int tall, int weight, int blur, int scanlines, int flags, int lowRange, int highRange) = 0;
 68 bool (__fastcall *g_pfnCSurface_AddCustomFontFile)(void *pthis, int edx, const char *fontFileName) = 0;
 69 int (__fastcall *g_pfnCSurface_GetFontTall)(void *pthis, int edx, HFont font) = 0;
 70 void (__fastcall *g_pfnCSurface_GetCharABCwide)(void *pthis, int edx, HFont font, int ch, int &a, int &b, int &c) = 0;
 71 int (__fastcall *g_pfnCSurface_GetCharacterWidth)(void *pthis, int edx, HFont font, int ch) = 0;
 72 void (__fastcall *g_pfnCSurface_GetTextSize)(void *pthis, int edx, HFont font, const wchar_t *text, int &wide, int &tall) = 0;
 73 VPANEL (__fastcall *g_pfnCSurface_GetNotifyPanel)(void *pthis, int edx) = 0;
 74 void (__fastcall *g_pfnCSurface_SetNotifyIcon)(void *pthis, int edx, VPANEL context, HTexture icon, VPANEL panelToReceiveMessages, const char *text) = 0;
 75 void (__fastcall *g_pfnCSurface_PlaySound)(void *pthis, int edx, const char *fileName) = 0;
 76 int (__fastcall *g_pfnCSurface_GetPopupCount)(void *pthis, int edx) = 0;
 77 VPANEL (__fastcall *g_pfnCSurface_GetPopup)(void *pthis, int edx, int index) = 0;
 78 bool (__fastcall *g_pfnCSurface_ShouldPaintChildPanel)(void *pthis, int edx, VPANEL childPanel) = 0;
 79 bool (__fastcall *g_pfnCSurface_RecreateContext)(void *pthis, int edx, VPANEL panel) = 0;
 80 void (__fastcall *g_pfnCSurface_AddPanel)(void *pthis, int edx, VPANEL panel) = 0;
 81 void (__fastcall *g_pfnCSurface_ReleasePanel)(void *pthis, int edx, VPANEL panel) = 0;
 82 void (__fastcall *g_pfnCSurface_MovePopupToFront)(void *pthis, int edx, VPANEL panel) = 0;
 83 void (__fastcall *g_pfnCSurface_MovePopupToBack)(void *pthis, int edx, VPANEL panel) = 0;
 84 void (__fastcall *g_pfnCSurface_SolveTraverse)(void *pthis, int edx, VPANEL panel, bool forceApplySchemeSettings) = 0;
 85 void (__fastcall *g_pfnCSurface_PaintTraverse)(void *pthis, int edx, VPANEL panel) = 0;
 86 void (__fastcall *g_pfnCSurface_EnableMouseCapture)(void *pthis, int edx, VPANEL panel, bool state) = 0;
 87 void (__fastcall *g_pfnCSurface_GetWorkspaceBounds)(void *pthis, int edx, int &x, int &y, int &wide, int &tall) = 0;
 88 void (__fastcall *g_pfnCSurface_GetAbsoluteWindowBounds)(void *pthis, int edx, int &x, int &y, int &wide, int &tall) = 0;
 89 void (__fastcall *g_pfnCSurface_GetProportionalBase)(void *pthis, int edx, int &width, int &height) = 0;
 90 void (__fastcall *g_pfnCSurface_CalculateMouseVisible)(void *pthis, int edx) = 0;
 91 bool (__fastcall *g_pfnCSurface_NeedKBInput)(void *pthis, int edx) = 0;
 92 bool (__fastcall *g_pfnCSurface_HasCursorPosFunctions)(void *pthis, int edx) = 0;
 93 void (__fastcall *g_pfnCSurface_SurfaceGetCursorPos)(void *pthis, int edx, int &x, int &y) = 0;
 94 void (__fastcall *g_pfnCSurface_SurfaceSetCursorPos)(void *pthis, int edx, int x, int y) = 0;
 95 void (__fastcall *g_pfnCSurface_DrawTexturedPolygon)(void *pthis, int edx, int *p, int n) = 0;
 96 int (__fastcall *g_pfnCSurface_GetFontAscent)(void *pthis, int edx, HFont font, wchar_t wch) = 0;
 97 void (__fastcall *g_pfnCSurface_SetAllowHTMLJavaScript)(void *pthis, int edx, bool state) = 0;
 98
 99 class CSurface : public ISurface
100 {
101 public:
102     void Shutdown(void);
103     void RunFrame(void);
104     VPANEL GetEmbeddedPanel(void);
105     void SetEmbeddedPanel(VPANEL pPanel);
106     void PushMakeCurrent(VPANEL panel, bool useInsets);
107     void PopMakeCurrent(VPANEL panel);
108     void DrawSetColor(int r, int g, int b, int a);
109     void DrawSetColor(Color col);
110     void DrawFilledRect(int x0, int y0, int x1, int y1);
111     void DrawOutlinedRect(int x0, int y0, int x1, int y1);
112     void DrawLine(int x0, int y0, int x1, int y1);
113     void DrawPolyLine(int *px, int *py, int numPoints);
114     void DrawSetTextFont(HFont font);
115     void DrawSetTextColor(int r, int g, int b, int a);
116     void DrawSetTextColor(Color col);
117     void DrawSetTextPos(int x, int y);
118     void DrawGetTextPos(int &x, int &y);
119     void DrawPrintText(const wchar_t *text, int textLen);
120     void DrawUnicodeChar(wchar_t wch);
121     void DrawUnicodeCharAdd(wchar_t wch);
122     void DrawFlushText(void);
123     IHTML *CreateHTMLWindow(IHTMLEvents *events, VPANEL context);
124     void PaintHTMLWindow(IHTML *htmlwin);
125     void DeleteHTMLWindow(IHTML *htmlwin);
126     void DrawSetTextureFile(int id, const char *filename, int hardwareFilter, bool forceReload);
127     void DrawSetTextureRGBA(int id, const unsigned char *rgba, int wide, int tall, int hardwareFilter, bool forceReload);
128     void DrawSetTexture(int id);
129     void DrawGetTextureSize(int id, int &wide, int &tall);
130     void DrawTexturedRect(int x0, int y0, int x1, int y1);
131     bool IsTextureIDValid(int id);
132     int CreateNewTextureID(bool procedural = false);
133     void GetScreenSize(int &wide, int &tall);
134     void SetAsTopMost(VPANEL panel, bool state);
135     void BringToFront(VPANEL panel);
136     void SetForegroundWindow(VPANEL panel);
137     void SetPanelVisible(VPANEL panel, bool state);
138     void SetMinimized(VPANEL panel, bool state);
139     bool IsMinimized(VPANEL panel);
140     void FlashWindow(VPANEL panel, bool state);
141     void SetTitle(VPANEL panel, const wchar_t *title);
142     void SetAsToolBar(VPANEL panel, bool state);
143     void CreatePopup(VPANEL panel, bool minimised, bool showTaskbarIcon = true, bool disabled = false, bool mouseInput = true, bool kbInput = true);
144     void SwapBuffers(VPANEL panel);
145     void Invalidate(VPANEL panel);
146     void SetCursor(HCursor cursor);
147     bool IsCursorVisible(void);
148     void ApplyChanges(void);
149     bool IsWithin(int x, int y);
150     bool HasFocus(void);
151     bool SupportsFeature(SurfaceFeature_e feature);
152     void RestrictPaintToSinglePanel(VPANEL panel);
153     void SetModalPanel(VPANEL panel);
154     VPANEL GetModalPanel(void);
155     void UnlockCursor(void);
156     void LockCursor(void);
157     void SetTranslateExtendedKeys(bool state);
158     VPANEL GetTopmostPopup(void);
159     void SetTopLevelFocus(VPANEL panel);
160     HFont CreateFont(void);
161     bool AddGlyphSetToFont(HFont font, const char *windowsFontName, int tall, int weight, int blur, int scanlines, int flags, int lowRange, int highRange);
162     bool AddCustomFontFile(const char *fontFileName);
163     int GetFontTall(HFont font);
164     void GetCharABCwide(HFont font, int ch, int &a, int &b, int &c);
165     int GetCharacterWidth(HFont font, int ch);
166     void GetTextSize(HFont font, const wchar_t *text, int &wide, int &tall);
167     VPANEL GetNotifyPanel(void);
168     void SetNotifyIcon(VPANEL context, HTexture icon, VPANEL panelToReceiveMessages, const char *text);
169     void PlaySound(const char *fileName);
170     int GetPopupCount(void);
171     VPANEL GetPopup(int index);
172     bool ShouldPaintChildPanel(VPANEL childPanel);
173     bool RecreateContext(VPANEL panel);
174     void AddPanel(VPANEL panel);
175     void ReleasePanel(VPANEL panel);
176     void MovePopupToFront(VPANEL panel);
177     void MovePopupToBack(VPANEL panel);
178     void SolveTraverse(VPANEL panel, bool forceApplySchemeSettings = false);
179     void PaintTraverse(VPANEL panel);
180     void EnableMouseCapture(VPANEL panel, bool state);
181     void GetWorkspaceBounds(int &x, int &y, int &wide, int &tall);
182     void GetAbsoluteWindowBounds(int &x, int &y, int &wide, int &tall);
183     void GetProportionalBase(int &width, int &height);
184     void CalculateMouseVisible(void);
185     bool NeedKBInput(void);
186     bool HasCursorPosFunctions(void);
187     void SurfaceGetCursorPos(int &x, int &y);
188     void SurfaceSetCursorPos(int x, int y);
189     void DrawTexturedPolygon(int *p, int n);
190     int GetFontAscent(HFont font, wchar_t wch);
191     void SetAllowHTMLJavaScript(bool state);
192 };
193
194 void CSurface::Shutdown(void)
195 {
196     return g_pfnCSurface_Shutdown(this, 0);
197 }
198
199 void CSurface::RunFrame(void)
200 {
201     return g_pfnCSurface_RunFrame(this, 0);
202 }
203
204 VPANEL CSurface::GetEmbeddedPanel(void)
205 {
206     return g_pfnCSurface_GetEmbeddedPanel(this, 0);
207 }
208
209 void CSurface::SetEmbeddedPanel(VPANEL pPanel)
210 {
211     return g_pfnCSurface_SetEmbeddedPanel(this, 0, pPanel);
212 }
213
214 void CSurface::PushMakeCurrent(VPANEL panel, bool useInsets)
215 {
216     return g_pfnCSurface_PushMakeCurrent(this, 0, panel, useInsets);
217 }
218
219 void CSurface::PopMakeCurrent(VPANEL panel)
220 {
221     return g_pfnCSurface_PopMakeCurrent(this, 0, panel);
222 }
223
224 void CSurface::DrawSetColor(int r, int g, int b, int a)
225 {
226     return g_pfnCSurface_DrawSetColor(this, 0, r, g, b, a);
227 }
228
229 void CSurface::DrawSetColor(Color col)
230 {
231     return g_pfnCSurface_DrawSetColor2(this, 0, col);
232 }
233
234 void CSurface::DrawFilledRect(int x0, int y0, int x1, int y1)
235 {
236     return g_pfnCSurface_DrawFilledRect(this, 0, x0, y0, x1, y1);
237 }
238
239 void CSurface::DrawOutlinedRect(int x0, int y0, int x1, int y1)
240 {
241     return g_pfnCSurface_DrawOutlinedRect(this, 0, x0, y0, x1, y1);
242 }
243
244 void CSurface::DrawLine(int x0, int y0, int x1, int y1)
245 {
246     return g_pfnCSurface_DrawLine(this, 0, x0, y0, x1, y1);
247 }
248
249 void CSurface::DrawPolyLine(int *px, int *py, int numPoints)
250 {
251     return g_pfnCSurface_DrawPolyLine(this, 0, px, py, numPoints);
252 }
253
254 void CSurface::DrawSetTextFont(HFont font)
255 {
256     return g_pfnCSurface_DrawSetTextFont(this, 0, font);
257 }
258
259 void CSurface::DrawSetTextColor(int r, int g, int b, int a)
260 {
261     return g_pfnCSurface_DrawSetTextColor(this, 0, r, g, b, a);
262 }
263
264 void CSurface::DrawSetTextColor(Color col)
265 {
266     return g_pfnCSurface_DrawSetTextColor2(this, 0, col);
267 }
268
269 void CSurface::DrawSetTextPos(int x, int y)
270 {
271     return g_pfnCSurface_DrawSetTextPos(this, 0, x, y);
272 }
273
274 void CSurface::DrawGetTextPos(int &x, int &y)
275 {
276     return g_pfnCSurface_DrawGetTextPos(this, 0, x, y);
277 }
278
279 void CSurface::DrawPrintText(const wchar_t *text, int textLen)
280 {
281     return g_pfnCSurface_DrawPrintText(this, 0, text, textLen);
282 }
283
284 void CSurface::DrawUnicodeChar(wchar_t wch)
285 {
286     return g_pfnCSurface_DrawUnicodeChar(this, 0, wch);
287 }
288
289 void CSurface::DrawUnicodeCharAdd(wchar_t wch)
290 {
291     return g_pfnCSurface_DrawUnicodeCharAdd(this, 0, wch);
292 }
293
294 void CSurface::DrawFlushText(void)
295 {
296     return g_pfnCSurface_DrawFlushText(this, 0);
297 }
298
299 IHTML* CSurface::CreateHTMLWindow(IHTMLEvents *events, VPANEL context)
300 {
301     return g_pfnCSurface_CreateHTMLWindow(this, 0, events, context);
302 }
303
304 void CSurface::PaintHTMLWindow(IHTML *htmlwin)
305 {
306     return g_pfnCSurface_PaintHTMLWindow(this, 0, htmlwin);
307 }
308
309 void CSurface::DeleteHTMLWindow(IHTML *htmlwin)
310 {
311     return g_pfnCSurface_DeleteHTMLWindow(this, 0, htmlwin);
312 }
313
314 void CSurface::DrawSetTextureFile(int id, const char *filename, int hardwareFilter, bool forceReload)
315 {
316     return g_pfnCSurface_DrawSetTextureFile(this, 0, id, filename, hardwareFilter, forceReload);
317 }
318
319 void CSurface::DrawSetTextureRGBA(int id, const unsigned char *rgba, int wide, int tall, int hardwareFilter, bool forceReload)
320 {
321     return g_pfnCSurface_DrawSetTextureRGBA(this, 0, id, rgba, wide, tall, hardwareFilter, forceReload);
322 }
323
324 void CSurface::DrawSetTexture(int id)
325 {
326     return g_pfnCSurface_DrawSetTexture(this, 0, id);
327 }
328
329 void CSurface::DrawGetTextureSize(int id, int &wide, int &tall)
330 {
331     return g_pfnCSurface_DrawGetTextureSize(this, 0, id, wide, tall);
332 }
333
334 void CSurface::DrawTexturedRect(int x0, int y0, int x1, int y1)
335 {
336     return g_pfnCSurface_DrawTexturedRect(this, 0, x0, y0, x1, y1);
337 }
338
339 bool CSurface::IsTextureIDValid(int id)
340 {
341     return g_pfnCSurface_IsTextureIDValid(this, 0, id);
342 }
343
344 int CSurface::CreateNewTextureID(bool procedural)
345 {
346     return g_pfnCSurface_CreateNewTextureID(this, 0, procedural);
347 }
348
349 void CSurface::GetScreenSize(int &wide, int &tall)
350 {
351     return g_pfnCSurface_GetScreenSize(this, 0, wide, tall);
352 }
353
354 void CSurface::SetAsTopMost(VPANEL panel, bool state)
355 {
356     return g_pfnCSurface_SetAsTopMost(this, 0, panel, state);
357 }
358
359 void CSurface::BringToFront(VPANEL panel)
360 {
361     return g_pfnCSurface_BringToFront(this, 0, panel);
362 }
363
364 void CSurface::SetForegroundWindow(VPANEL panel)
365 {
366     return g_pfnCSurface_SetForegroundWindow(this, 0, panel);
367 }
368
369 void CSurface::SetPanelVisible(VPANEL panel, bool state)
370 {
371     return g_pfnCSurface_SetPanelVisible(this, 0, panel, state);
372 }
373
374 void CSurface::SetMinimized(VPANEL panel, bool state)
375 {
376     return g_pfnCSurface_SetMinimized(this, 0, panel, state);
377 }
378
379 bool CSurface::IsMinimized(VPANEL panel)
380 {
381     return g_pfnCSurface_IsMinimized(this, 0, panel);
382 }
383
384 void CSurface::FlashWindow(VPANEL panel, bool state)
385 {
386     return g_pfnCSurface_FlashWindow(this, 0, panel, state);
387 }
388
389 void CSurface::SetTitle(VPANEL panel, const wchar_t *title)
390 {
391     return g_pfnCSurface_SetTitle(this, 0, panel, title);
392 }
393
394 void CSurface::SetAsToolBar(VPANEL panel, bool state)
395 {
396     return g_pfnCSurface_SetAsToolBar(this, 0, panel, state);
397 }
398
399 void CSurface::CreatePopup(VPANEL panel, bool minimised, bool showTaskbarIcon, bool disabled, bool mouseInput, bool kbInput)
400 {
401     return g_pfnCSurface_CreatePopup(this, 0, panel, minimised, showTaskbarIcon, disabled, mouseInput, kbInput);
402 }
403
404 void CSurface::SwapBuffers(VPANEL panel)
405 {
406     return g_pfnCSurface_SwapBuffers(this, 0, panel);
407 }
408
409 void CSurface::Invalidate(VPANEL panel)
410 {
411     return g_pfnCSurface_Invalidate(this, 0, panel);
412 }
413
414 void CSurface::SetCursor(HCursor cursor)
415 {
416     return g_pfnCSurface_SetCursor(this, 0, cursor);
417 }
418
419 bool CSurface::IsCursorVisible(void)
420 {
421     return g_pfnCSurface_IsCursorVisible(this, 0);
422 }
423
424 void CSurface::ApplyChanges(void)
425 {
426     return g_pfnCSurface_ApplyChanges(this, 0);
427 }
428
429 bool CSurface::IsWithin(int x, int y)
430 {
431     return g_pfnCSurface_IsWithin(this, 0, x, y);
432 }
433
434 bool CSurface::HasFocus(void)
435 {
436     return g_pfnCSurface_HasFocus(this, 0);
437 }
438
439 bool CSurface::SupportsFeature(SurfaceFeature_e feature)
440 {
441     return g_pfnCSurface_SupportsFeature(this, 0, feature);
442 }
443
444 void CSurface::RestrictPaintToSinglePanel(VPANEL panel)
445 {
446     return g_pfnCSurface_RestrictPaintToSinglePanel(this, 0, panel);
447 }
448
449 void CSurface::SetModalPanel(VPANEL panel)
450 {
451     return g_pfnCSurface_SetModalPanel(this, 0, panel);
452 }
453
454 VPANEL CSurface::GetModalPanel(void)
455 {
456     return g_pfnCSurface_GetModalPanel(this, 0);
457 }
458
459 void CSurface::UnlockCursor(void)
460 {
461     return g_pfnCSurface_UnlockCursor(this, 0);
462 }
463
464 void CSurface::LockCursor(void)
465 {
466     return g_pfnCSurface_LockCursor(this, 0);
467 }
468
469 void CSurface::SetTranslateExtendedKeys(bool state)
470 {
471     return g_pfnCSurface_SetTranslateExtendedKeys(this, 0, state);
472 }
473
474 VPANEL CSurface::GetTopmostPopup(void)
475 {
476     return g_pfnCSurface_GetTopmostPopup(this, 0);
477 }
478
479 void CSurface::SetTopLevelFocus(VPANEL panel)
480 {
481     return g_pfnCSurface_SetTopLevelFocus(this, 0, panel);
482 }
483
484 HFont CSurface::CreateFont(void)
485 {
486     return g_pfnCSurface_CreateFont(this, 0);
487 }
488
489 bool CSurface::AddGlyphSetToFont(HFont font, const char *windowsFontName, int tall, int weight, int blur, int scanlines, int flags, int lowRange, int highRange)
490 {
491     return g_pfnCSurface_AddGlyphSetToFont(this, 0, font, windowsFontName, tall, weight, blur, scanlines, flags, lowRange, highRange);
492 }
493
494 bool CSurface::AddCustomFontFile(const char *fontFileName)
495 {
496     return g_pfnCSurface_AddCustomFontFile(this, 0, fontFileName);
497 }
498
499 int CSurface::GetFontTall(HFont font)
500 {
501     return g_pfnCSurface_GetFontTall(this, 0, font);
502 }
503
504 void CSurface::GetCharABCwide(HFont font, int ch, int &a, int &b, int &c)
505 {
506     return g_pfnCSurface_GetCharABCwide(this, 0, font, ch, a, b, c);
507 }
508
509 int CSurface::GetCharacterWidth(HFont font, int ch)
510 {
511     return g_pfnCSurface_GetCharacterWidth(this, 0, font, ch);
512 }
513
514 void CSurface::GetTextSize(HFont font, const wchar_t *text, int &wide, int &tall)
515 {
516     return g_pfnCSurface_GetTextSize(this, 0, font, text, wide, tall);
517 }
518
519 VPANEL CSurface::GetNotifyPanel(void)
520 {
521     return g_pfnCSurface_GetNotifyPanel(this, 0);
522 }
523
524 void CSurface::SetNotifyIcon(VPANEL context, HTexture icon, VPANEL panelToReceiveMessages, const char *text)
525 {
526     return g_pfnCSurface_SetNotifyIcon(this, 0, context, icon, panelToReceiveMessages, text);
527 }
528
529 void CSurface::PlaySound(const char *fileName)
530 {
531     return g_pfnCSurface_PlaySound(this, 0, fileName);
532 }
533
534 int CSurface::GetPopupCount(void)
535 {
536     return g_pfnCSurface_GetPopupCount(this, 0);
537 }
538
539 VPANEL CSurface::GetPopup(int index)
540 {
541     return g_pfnCSurface_GetPopup(this, 0, index);
542 }
543
544 bool CSurface::ShouldPaintChildPanel(VPANEL childPanel)
545 {
546     return g_pfnCSurface_ShouldPaintChildPanel(this, 0, childPanel);
547 }
548
549 bool CSurface::RecreateContext(VPANEL panel)
550 {
551     return g_pfnCSurface_RecreateContext(this, 0, panel);
552 }
553
554 void CSurface::AddPanel(VPANEL panel)
555 {
556     return g_pfnCSurface_AddPanel(this, 0, panel);
557 }
558
559 void CSurface::ReleasePanel(VPANEL panel)
560 {
561     return g_pfnCSurface_ReleasePanel(this, 0, panel);
562 }
563
564 void CSurface::MovePopupToFront(VPANEL panel)
565 {
566     return g_pfnCSurface_MovePopupToFront(this, 0, panel);
567 }
568
569 void CSurface::MovePopupToBack(VPANEL panel)
570 {
571     return g_pfnCSurface_MovePopupToBack(this, 0, panel);
572 }
573
574 void CSurface::SolveTraverse(VPANEL panel, bool forceApplySchemeSettings)
575 {
576     return g_pfnCSurface_SolveTraverse(this, 0, panel, forceApplySchemeSettings);
577 }
578
579 void CSurface::PaintTraverse(VPANEL panel)
580 {
581     return g_pfnCSurface_PaintTraverse(this, 0, panel);
582 }
583
584 void CSurface::EnableMouseCapture(VPANEL panel, bool state)
585 {
586     return g_pfnCSurface_EnableMouseCapture(this, 0, panel, state);
587 }
588
589 void CSurface::GetWorkspaceBounds(int &x, int &y, int &wide, int &tall)
590 {
591     return g_pfnCSurface_GetWorkspaceBounds(this, 0, x, y, wide, tall);
592 }
593
594 void CSurface::GetAbsoluteWindowBounds(int &x, int &y, int &wide, int &tall)
595 {
596     return g_pfnCSurface_GetAbsoluteWindowBounds(this, 0, x, y, wide, tall);
597 }
598
599 void CSurface::GetProportionalBase(int &width, int &height)
600 {
601     return g_pfnCSurface_GetProportionalBase(this, 0, width, height);
602 }
603
604 void CSurface::CalculateMouseVisible(void)
605 {
606     return g_pfnCSurface_CalculateMouseVisible(this, 0);
607 }
608
609 bool CSurface::NeedKBInput(void)
610 {
611     return g_pfnCSurface_NeedKBInput(this, 0);
612 }
613
614 bool CSurface::HasCursorPosFunctions(void)
615 {
616     return g_pfnCSurface_HasCursorPosFunctions(this, 0);
617 }
618
619 void CSurface::SurfaceGetCursorPos(int &x, int &y)
620 {
621     return g_pfnCSurface_SurfaceGetCursorPos(this, 0, x, y);
622 }
623
624 void CSurface::SurfaceSetCursorPos(int x, int y)
625 {
626     return g_pfnCSurface_SurfaceSetCursorPos(this, 0, x, y);
627 }
628
629 void CSurface::DrawTexturedPolygon(int *p, int n)
630 {
631     return g_pfnCSurface_DrawTexturedPolygon(this, 0, p, n);
632 }
633
634 int CSurface::GetFontAscent(HFont font, wchar_t wch)
635 {
636     return g_pfnCSurface_GetFontAscent(this, 0, font, wch);
637 }
638
639 void CSurface::SetAllowHTMLJavaScript(bool state)
640 {
641     return g_pfnCSurface_SetAllowHTMLJavaScript(this, 0, state);
642 }
643
644 void Surface_InstallHook(void)
645 {
646     CreateInterfaceFn EngineCreateInterface = g_pMetaHookAPI->GetEngineFactory();
647     g_pSurface = (ISurface *)EngineCreateInterface(VGUI_SURFACE_INTERFACE_VERSION, 0);
648
649     CSurface Surface;
650     DWORD *pVFTable = *(DWORD **)&Surface;
651
652     g_pMetaHookAPI->VFTHook(g_pSurface, 0,  1, (void *)pVFTable[ 1], (void *&)g_pfnCSurface_Shutdown);
653     g_pMetaHookAPI->VFTHook(g_pSurface, 0,  2, (void *)pVFTable[ 2], (void *&)g_pfnCSurface_RunFrame);
654     g_pMetaHookAPI->VFTHook(g_pSurface, 0,  3, (void *)pVFTable[ 3], (void *&)g_pfnCSurface_GetEmbeddedPanel);
655     g_pMetaHookAPI->VFTHook(g_pSurface, 0,  4, (void *)pVFTable[ 4], (void *&)g_pfnCSurface_SetEmbeddedPanel);
656     g_pMetaHookAPI->VFTHook(g_pSurface, 0,  5, (void *)pVFTable[ 5], (void *&)g_pfnCSurface_PushMakeCurrent);
657     g_pMetaHookAPI->VFTHook(g_pSurface, 0,  6, (void *)pVFTable[ 6], (void *&)g_pfnCSurface_PopMakeCurrent);
658     g_pMetaHookAPI->VFTHook(g_pSurface, 0,  7, (void *)pVFTable[ 7], (void *&)g_pfnCSurface_DrawSetColor2);
659     g_pMetaHookAPI->VFTHook(g_pSurface, 0,  8, (void *)pVFTable[ 8], (void *&)g_pfnCSurface_DrawSetColor);
660     g_pMetaHookAPI->VFTHook(g_pSurface, 0,  9, (void *)pVFTable[ 9], (void *&)g_pfnCSurface_DrawFilledRect);
661     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 10, (void *)pVFTable[10], (void *&)g_pfnCSurface_DrawOutlinedRect);
662     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 11, (void *)pVFTable[11], (void *&)g_pfnCSurface_DrawLine);
663     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 12, (void *)pVFTable[12], (void *&)g_pfnCSurface_DrawPolyLine);
664     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 13, (void *)pVFTable[13], (void *&)g_pfnCSurface_DrawSetTextFont);
665     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 14, (void *)pVFTable[14], (void *&)g_pfnCSurface_DrawSetTextColor2);
666     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 15, (void *)pVFTable[15], (void *&)g_pfnCSurface_DrawSetTextColor);
667     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 16, (void *)pVFTable[16], (void *&)g_pfnCSurface_DrawSetTextPos);
668     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 17, (void *)pVFTable[17], (void *&)g_pfnCSurface_DrawGetTextPos);
669     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 18, (void *)pVFTable[18], (void *&)g_pfnCSurface_DrawPrintText);
670     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 19, (void *)pVFTable[19], (void *&)g_pfnCSurface_DrawUnicodeChar);
671     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 20, (void *)pVFTable[20], (void *&)g_pfnCSurface_DrawUnicodeCharAdd);
672     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 21, (void *)pVFTable[21], (void *&)g_pfnCSurface_DrawFlushText);
673     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 22, (void *)pVFTable[22], (void *&)g_pfnCSurface_CreateHTMLWindow);
674     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 23, (void *)pVFTable[23], (void *&)g_pfnCSurface_PaintHTMLWindow);
675     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 24, (void *)pVFTable[24], (void *&)g_pfnCSurface_DeleteHTMLWindow);
676     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 25, (void *)pVFTable[25], (void *&)g_pfnCSurface_DrawSetTextureFile);
677     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 26, (void *)pVFTable[26], (void *&)g_pfnCSurface_DrawSetTextureRGBA);
678     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 27, (void *)pVFTable[27], (void *&)g_pfnCSurface_DrawSetTexture);
679     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 28, (void *)pVFTable[28], (void *&)g_pfnCSurface_DrawGetTextureSize);
680     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 29, (void *)pVFTable[29], (void *&)g_pfnCSurface_DrawTexturedRect);
681     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 30, (void *)pVFTable[30], (void *&)g_pfnCSurface_IsTextureIDValid);
682     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 31, (void *)pVFTable[31], (void *&)g_pfnCSurface_CreateNewTextureID);
683     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 32, (void *)pVFTable[32], (void *&)g_pfnCSurface_GetScreenSize);
684     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 33, (void *)pVFTable[33], (void *&)g_pfnCSurface_SetAsTopMost);
685     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 34, (void *)pVFTable[34], (void *&)g_pfnCSurface_BringToFront);
686     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 35, (void *)pVFTable[35], (void *&)g_pfnCSurface_SetForegroundWindow);
687     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 36, (void *)pVFTable[36], (void *&)g_pfnCSurface_SetPanelVisible);
688     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 37, (void *)pVFTable[37], (void *&)g_pfnCSurface_SetMinimized);
689     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 38, (void *)pVFTable[38], (void *&)g_pfnCSurface_IsMinimized);
690     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 39, (void *)pVFTable[39], (void *&)g_pfnCSurface_FlashWindow);
691     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 40, (void *)pVFTable[40], (void *&)g_pfnCSurface_SetTitle);
692     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 41, (void *)pVFTable[41], (void *&)g_pfnCSurface_SetAsToolBar);
693     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 42, (void *)pVFTable[42], (void *&)g_pfnCSurface_CreatePopup);
694     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 43, (void *)pVFTable[43], (void *&)g_pfnCSurface_SwapBuffers);
695     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 44, (void *)pVFTable[44], (void *&)g_pfnCSurface_Invalidate);
696     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 45, (void *)pVFTable[45], (void *&)g_pfnCSurface_SetCursor);
697     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 46, (void *)pVFTable[46], (void *&)g_pfnCSurface_IsCursorVisible);
698     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 47, (void *)pVFTable[47], (void *&)g_pfnCSurface_ApplyChanges);
699     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 48, (void *)pVFTable[48], (void *&)g_pfnCSurface_IsWithin);
700     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 49, (void *)pVFTable[49], (void *&)g_pfnCSurface_HasFocus);
701     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 50, (void *)pVFTable[50], (void *&)g_pfnCSurface_SupportsFeature);
702     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 51, (void *)pVFTable[51], (void *&)g_pfnCSurface_RestrictPaintToSinglePanel);
703     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 52, (void *)pVFTable[52], (void *&)g_pfnCSurface_SetModalPanel);
704     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 53, (void *)pVFTable[53], (void *&)g_pfnCSurface_GetModalPanel);
705     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 54, (void *)pVFTable[54], (void *&)g_pfnCSurface_UnlockCursor);
706     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 55, (void *)pVFTable[55], (void *&)g_pfnCSurface_LockCursor);
707     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 56, (void *)pVFTable[56], (void *&)g_pfnCSurface_SetTranslateExtendedKeys);
708     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 57, (void *)pVFTable[57], (void *&)g_pfnCSurface_GetTopmostPopup);
709     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 58, (void *)pVFTable[58], (void *&)g_pfnCSurface_SetTopLevelFocus);
710     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 59, (void *)pVFTable[59], (void *&)g_pfnCSurface_CreateFont);
711     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 60, (void *)pVFTable[60], (void *&)g_pfnCSurface_AddGlyphSetToFont);
712     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 61, (void *)pVFTable[61], (void *&)g_pfnCSurface_AddCustomFontFile);
713     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 62, (void *)pVFTable[62], (void *&)g_pfnCSurface_GetFontTall);
714     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 63, (void *)pVFTable[63], (void *&)g_pfnCSurface_GetCharABCwide);
715     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 64, (void *)pVFTable[64], (void *&)g_pfnCSurface_GetCharacterWidth);
716     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 65, (void *)pVFTable[65], (void *&)g_pfnCSurface_GetTextSize);
717     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 66, (void *)pVFTable[66], (void *&)g_pfnCSurface_GetNotifyPanel);
718     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 67, (void *)pVFTable[67], (void *&)g_pfnCSurface_SetNotifyIcon);
719     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 68, (void *)pVFTable[68], (void *&)g_pfnCSurface_PlaySound);
720     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 69, (void *)pVFTable[69], (void *&)g_pfnCSurface_GetPopupCount);
721     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 70, (void *)pVFTable[70], (void *&)g_pfnCSurface_GetPopup);
722     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 71, (void *)pVFTable[71], (void *&)g_pfnCSurface_ShouldPaintChildPanel);
723     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 72, (void *)pVFTable[72], (void *&)g_pfnCSurface_RecreateContext);
724     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 73, (void *)pVFTable[73], (void *&)g_pfnCSurface_AddPanel);
725     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 74, (void *)pVFTable[74], (void *&)g_pfnCSurface_ReleasePanel);
726     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 75, (void *)pVFTable[75], (void *&)g_pfnCSurface_MovePopupToFront);
727     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 76, (void *)pVFTable[76], (void *&)g_pfnCSurface_MovePopupToBack);
728     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 77, (void *)pVFTable[77], (void *&)g_pfnCSurface_SolveTraverse);
729     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 78, (void *)pVFTable[78], (void *&)g_pfnCSurface_PaintTraverse);
730     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 79, (void *)pVFTable[79], (void *&)g_pfnCSurface_EnableMouseCapture);
731     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 80, (void *)pVFTable[80], (void *&)g_pfnCSurface_GetWorkspaceBounds);
732     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 81, (void *)pVFTable[81], (void *&)g_pfnCSurface_GetAbsoluteWindowBounds);
733     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 82, (void *)pVFTable[82], (void *&)g_pfnCSurface_GetProportionalBase);
734     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 83, (void *)pVFTable[83], (void *&)g_pfnCSurface_CalculateMouseVisible);
735     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 84, (void *)pVFTable[84], (void *&)g_pfnCSurface_NeedKBInput);
736     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 85, (void *)pVFTable[85], (void *&)g_pfnCSurface_HasCursorPosFunctions);
737     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 86, (void *)pVFTable[86], (void *&)g_pfnCSurface_SurfaceGetCursorPos);
738     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 87, (void *)pVFTable[87], (void *&)g_pfnCSurface_SurfaceSetCursorPos);
739     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 88, (void *)pVFTable[88], (void *&)g_pfnCSurface_DrawTexturedPolygon);
740     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 89, (void *)pVFTable[89], (void *&)g_pfnCSurface_GetFontAscent);
741     g_pMetaHookAPI->VFTHook(g_pSurface, 0, 90, (void *)pVFTable[90], (void *&)g_pfnCSurface_SetAllowHTMLJavaScript);
742 }
时间: 2024-10-10 17:56:08

[MetaHook] Surface hook的相关文章

[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_pfnCBa

[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

[MetaHook] Quake Bink function

If you want to play Bink video in game, maybe you need this code. QBink.h 1 #ifndef QBINK_H 2 #define QBINK_H 3 4 #include "bink.h" 5 6 extern void PTR4* (RADEXPLINK *qBinkLogoAddress)(void); 7 extern void (RADEXPLINK *qBinkSetError)(const char

Understanding Canvas and Surface concepts

Here are some definitions: A Surface is an object holding pixels that are being composited to the screen. Every window you see on the screen (a dialog, your full-screen activity, the status bar) has its own surface that it draws in to, and Surface Fl

Android下so注入和hook

总结一下这两天学习的Android注入so文件,通过遍历got表hook函数调用 1.注入so文件 2.so文件中遍历got表hook函数 一.注入so文件 分为以下几个步骤 1.每个进程都在/proc目录下,以进程id为文件夹名,所以可以通过/proc/id/cmdline文件中中读取进程名称,和我们需要注入的进程名称比较,获得进程id 2.以root身份运行注入程序,通过ptrace函数,传入PTRACE_ATIACH附加到目标进程,PTRACE_SETREGS设置进程寄存器,PTRACE_

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