1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48:
| library bth;
uses windows, madCodeHook, dialogs, Controls, sysutils;
var next_CreateWindowExA: function(dwExStyle: DWORD; lpClassName: PAnsiChar; lpWindowName: PAnsiChar; dwStyle: DWORD; X, Y, nWidth, nHeight: Integer; hWndParent: HWND; hMenu: HMENU; hInstance: HINST; lpParam: Pointer): HWND; stdcall;
function my_CreateWindowExA(dwExStyle: DWORD; lpClassName: PAnsiChar; lpWindowName: PAnsiChar; dwStyle: DWORD; X, Y, nWidth, nHeight: Integer; hWndParent: HWND; hMenu: HMENU; hInstance: HINST; lpParam: Pointer): HWND; stdcall; begin Result := next_CreateWindowExA(dwExStyle, lpClassName, lpWindowName, dwStyle, X,Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); if lpClassName = 'tooltips_class32' then MessageBox(0, PCHAR(IntToStr(X)+' - '+IntToStr(Y)), 'CreateWindowExA-Hook', 0); end;
procedure injectmain; begin madCodeHook.HookAPI('user32.dll', 'CreateWindowExA',@my_CreateWindowExA, @next_CreateWindowExA); end;
procedure uninjectmain; begin madCodeHook.UnhookAPI(@next_CreateWindowExA); end;
procedure dllmain(dwReason: integer); begin case dwreason of DLL_PROCESS_ATTACH: injectmain; DLL_PROCESS_DETACH: uninjectmain; end; end;
begin DLLProc := @DLLMain; DLLMain(1); end. |