API Hook 的问题(如果分不够还可以加) ( 积分: 99 )

  • 主题发起人 主题发起人 nc2t
  • 开始时间 开始时间
N

nc2t

Unregistered / Unconfirmed
GUEST, unregistred user!
谁能给我写出一个采用陷阱式、截获MessageBox或者MessageBoxA的例子<br>如果是截获TextOutA的例子请不要打扰了,我只要截获MessageBox或者MessageBoxA的例子<br>谢谢!<br>
 
谁能给我写出一个采用陷阱式、截获MessageBox或者MessageBoxA的例子<br>如果是截获TextOutA的例子请不要打扰了,我只要截获MessageBox或者MessageBoxA的例子<br>谢谢!<br>
 
自己早已经解决了<br>嘿嘿!!
 
发给我看看嘛.<br>temp@mgnet.cn<br>学习下.
 
鄙视楼猪
 
可不可以发一个给我看看啊,xsj_by@163.com
 
可不可以发给我看看,谢了
 
能不能发给我看看<br>rmj011603235@126.com
 
program hook;<br><br>uses<br> &nbsp;windows;<br><br>var<br>oldbytes : array [1..8] of byte;<br>newbytes : array [1..8] of byte;<br>process : cardinal;<br><br>function messageboxWhookproc(hWnd: HWND; lpText, lpCaption: PWideChar; uType: UINT): Integer; stdcall;<br>var<br>process: Cardinal;<br>nAUx: Cardinal;<br>begin<br>process := OpenProcess( PROCESS_ALL_ACCESS, True, GetCurrentProcessId );<br>lpText := 'Hahahaha Got hooked!!!';<br>WriteProcessMemory(process, GetProcAddress( GetModuleHandle( 'user32.dll' ), 'MessageBoxW' ) , @oldBytes, 8, nAux );<br>Result := MessageBoxW( hWnd, lpText, lpCaption, uType );<br>WriteProcessMemory(process, GetProcAddress( GetModuleHandle( 'user32.dll' ), 'MessageBoxW' ) , @newbytes, 8, nAux );<br>closehandle(process);<br>end;<br><br>procedure hookit;<br>type<br>TJumpCode = packed record<br>jmp: Byte; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // mov eax,<br>addresse: cardinal; &nbsp; // address<br>jmp2, jmp3: byte; &nbsp; &nbsp;// call eax<br>end;<br>var<br>process:Cardinal;<br>location:Cardinal;<br>JmpCode:TJumpCode;<br>nAux:DWord;<br>begin<br>process:=OpenProcess( PROCESS_ALL_ACCESS,True, GetCurrentProcessId);<br>location:=Cardinal(GetProcAddress(GetModuleHandle('user32.dll'),'MessageBoxW'));<br>ReadProcessMemory( process, Pointer( location ), @oldbytes, 8, nAux );<br>JmpCode.jmp &nbsp;:= $B8; // MOV EAX,<br>JmpCode.addresse := Cardinal( @messageboxWhookproc);<br>JmpCode.jmp2 := $FF;<br>JmpCode.jmp3 := $e0;<br>WriteProcessMemory(process, Pointer( location ), @jmpcode, SizeOf( TJumpCode ), nAux );<br>closehandle(process);<br>end;<br><br><br><br>procedure unhookit;<br>var<br>process: Cardinal;<br>nAux: Cardinal;<br>begin<br>process := OpenProcess( PROCESS_ALL_ACCESS, True, GetCurrentProcessId );<br>WriteProcessMemory(process, GetProcAddress( GetModuleHandle( 'user32.dll' ), 'MessageBoxW' ) , @oldbytes, 8, nAux );<br>closehandle(process);<br>end;<br><br>begin<br>process:=OpenProcess( PROCESS_ALL_ACCESS, True, GetCurrentProcessId );<br>MessageBoxW(0,'i will be hooked very soonner','hook',mb_ok);<br>hookit;<br>MessageBoxW(0,'i will be faked','lol',mb_ok);<br>unhookit;<br>closehandle(process);<br>end.
 
能不能在代码后面加上一些说明啊,让大家看得更清楚一些
 
简单点的用madhook就行了
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
I
回复
0
查看
947
import
I
后退
顶部