Trao đổi với tôi

www.hdphim.info OR www.chepphimhdtv.com

1/12/10

[Programming] Leaf API Hook solution Borland delphi component

Leaf API Hook solution Borland delphi component

  • Download version 1.1 (demo included) : download
  • Support :

How to use Leaf API Hook solution

  • License : free for non-commercial softwares
  • When hooking an API, we need to write some kind of hook callback function and original API function variable
var
MessageBoxANext : function (hWnd: HWND; lpText, lpCaption: PAnsiChar; uType: UINT): Integer; stdcall;

function MessageBoxACallback(hWnd: HWND; lpText, lpCaption: PAnsiChar; uType: UINT): Integer; stdcall;
begin
Result := MessageBoxANext(hWnd, lpText, 'Message From Dll', uType);
end;
  • Put all of code in a dll for global API hook like this
procedure DllMain(dwReason: DWORD);
begin
case dwReason of
DLL_PROCESS_ATTACH: begin
HookAPI('user32.dll', 'MessageBoxA',
@MessageBoxACallback, @MessageBoxANext);

end;
DLL_PROCESS_DETACH: begin
UnHookAPI('user32.dll', 'MessageBoxA',
@MessageBoxANext);
end;
end;
end;

begin
DllProc := @DllMain;
DllMain(DLL_PROCESS_ATTACH);
end.
  • We need inject this dll into another process by calling function ProcessInjectLibrary
function ProcessInjectLibrary(PID: DWORD; lpszLibName: PAnsiChar): Boolean;stdcall;

  • For more information please check the demo that included

No comments:

Post a Comment