Delphi函数定义使用和WriteProcessMemory ( 积分: 100 )

  • 主题发起人 主题发起人 amwfhv
  • 开始时间 开始时间
A

amwfhv

Unregistered / Unconfirmed
GUEST, unregistred user!
1.<br>lpfn_CONNECT = function ( const s: TSocket; const name: PSockAddr; const namelen: Integer): Integer; stdcall;<br> &nbsp;lpfn_WSACONNECT = function ( const s : TSocket; const name : PSockAddr; const namelen : Integer; lpCallerData,lpCalleeData : LPWSABUF; lpSQOS,lpGQOS : LPQOS ) : Integer; stdcall;<br>var<br> &nbsp;DLLData: PData;<br> &nbsp;MainHwnd:THandle;<br><br> &nbsp;Oldconect:lpfn_CONNECT;<br> &nbsp;OldWSAConnect: lpfn_WSACONNECT; &nbsp; &nbsp; &nbsp;//原来的API地址<br> &nbsp;JmpCodeCONNECT: TJmpCodeCONNECT;<br> &nbsp;JmpCodeWSACONNECT: TJmpCodeWSACONNECT;<br> &nbsp;OldProcCONNECT:TJmpCodeCONNECT;<br> &nbsp;OldProcWSACONNECT:TJmpCodeWSACONNECT;<br> &nbsp;Addconect, AddWSAConnect: pointer; &nbsp; &nbsp; &nbsp; &nbsp;//API地址<br>// &nbsp;TmpJmp: TJmpCode;<br> &nbsp;ProcessHandle: THandle;<br>//conect函数的HOOK<br>function Myconect( const s: TSocket; const name: PSockAddr; const namelen: Integer): Integer; stdcall;<br>var<br> &nbsp;dwSize: cardinal;<br> &nbsp;port:word;<br>begin<br> &nbsp;WriteProcessMemory(ProcessHandle, Addconect, @OldProcCONNECT, 8, dwSize);<br> &nbsp;//showmessage(inttostr(mainhwnd));<br> &nbsp;port:=ntohs(name^.sin_port);<br> &nbsp;if (port&lt;&gt;80) and (port&lt;&gt;7000) and (port&lt;&gt;7100) then<br> &nbsp;begin<br> &nbsp; &nbsp;sendmessage(mainhwnd,Wm_NeedConnect,name^.sin_port,name^.sin_addr.S_addr);//发送消息,并等待消息执行结果<br> &nbsp; &nbsp;name^.sin_addr.S_addr:=inet_Addr('127.0.0.1');<br> &nbsp;end;<br> &nbsp;Result := Oldconect(S, name,namelen);<br> &nbsp;//MessageBeep(1000);<br> &nbsp;JmpCodeCONNECT.Address := @Myconect;<br> &nbsp;WriteProcessMemory(ProcessHandle, Addconect, @JmpCodeCONNECT, 8, dwSize);<br>end;<br>请问<br>lpfn_CONNECT = function ( const s: TSocket; const name: PSockAddr; const namelen: Integer): Integer; stdcall;<br> &nbsp;lpfn_WSACONNECT = function ( const s : TSocket; const name : PSockAddr; const namelen : Integer; lpCallerData,lpCalleeData : LPWSABUF; lpSQOS,lpGQOS : LPQOS ) : Integer; stdcall;<br>这几句是什么意思啊第一次见到这种语句<br><br>2.WriteProcessMemoryAPI函数的作用用法
 
1.<br>lpfn_CONNECT = function ( const s: TSocket; const name: PSockAddr; const namelen: Integer): Integer; stdcall;<br> &nbsp;lpfn_WSACONNECT = function ( const s : TSocket; const name : PSockAddr; const namelen : Integer; lpCallerData,lpCalleeData : LPWSABUF; lpSQOS,lpGQOS : LPQOS ) : Integer; stdcall;<br>var<br> &nbsp;DLLData: PData;<br> &nbsp;MainHwnd:THandle;<br><br> &nbsp;Oldconect:lpfn_CONNECT;<br> &nbsp;OldWSAConnect: lpfn_WSACONNECT; &nbsp; &nbsp; &nbsp;//原来的API地址<br> &nbsp;JmpCodeCONNECT: TJmpCodeCONNECT;<br> &nbsp;JmpCodeWSACONNECT: TJmpCodeWSACONNECT;<br> &nbsp;OldProcCONNECT:TJmpCodeCONNECT;<br> &nbsp;OldProcWSACONNECT:TJmpCodeWSACONNECT;<br> &nbsp;Addconect, AddWSAConnect: pointer; &nbsp; &nbsp; &nbsp; &nbsp;//API地址<br>// &nbsp;TmpJmp: TJmpCode;<br> &nbsp;ProcessHandle: THandle;<br>//conect函数的HOOK<br>function Myconect( const s: TSocket; const name: PSockAddr; const namelen: Integer): Integer; stdcall;<br>var<br> &nbsp;dwSize: cardinal;<br> &nbsp;port:word;<br>begin<br> &nbsp;WriteProcessMemory(ProcessHandle, Addconect, @OldProcCONNECT, 8, dwSize);<br> &nbsp;//showmessage(inttostr(mainhwnd));<br> &nbsp;port:=ntohs(name^.sin_port);<br> &nbsp;if (port&lt;&gt;80) and (port&lt;&gt;7000) and (port&lt;&gt;7100) then<br> &nbsp;begin<br> &nbsp; &nbsp;sendmessage(mainhwnd,Wm_NeedConnect,name^.sin_port,name^.sin_addr.S_addr);//发送消息,并等待消息执行结果<br> &nbsp; &nbsp;name^.sin_addr.S_addr:=inet_Addr('127.0.0.1');<br> &nbsp;end;<br> &nbsp;Result := Oldconect(S, name,namelen);<br> &nbsp;//MessageBeep(1000);<br> &nbsp;JmpCodeCONNECT.Address := @Myconect;<br> &nbsp;WriteProcessMemory(ProcessHandle, Addconect, @JmpCodeCONNECT, 8, dwSize);<br>end;<br>请问<br>lpfn_CONNECT = function ( const s: TSocket; const name: PSockAddr; const namelen: Integer): Integer; stdcall;<br> &nbsp;lpfn_WSACONNECT = function ( const s : TSocket; const name : PSockAddr; const namelen : Integer; lpCallerData,lpCalleeData : LPWSABUF; lpSQOS,lpGQOS : LPQOS ) : Integer; stdcall;<br>这几句是什么意思啊第一次见到这种语句<br><br>2.WriteProcessMemoryAPI函数的作用用法
 
1.<br>//lpfn_CONNECT = function ( const s: ...<br>你错了。其实应该是<br>type lpfn_CONNECT = function ( const s: ...<br>只是上边有了type,因此不需要再写一个。因此词语具生命了一个类型 函数指针.<br>对于这样的基本概念,自己去看书。<br>2.WriteProcessMemoryMSDN有详细地解释。除非你对进程/线程不理解.否则不会看不懂的
 
接受答案了.
 
后退
顶部