i am still now on this project
i have changed the code,now any error occur but when i send halo
the server or receiver's application doens't receive halo
but any others string are received successfully
did you why ?
what's happen ?
nildo i have also tried that but i obtain yje same result
here is my code
Code: Select all
library ws2hook;
uses
windows,madcodehook,winsock,madstrings;
{$R *.res}
var
sendNextHook: function(s: TSocket; var Buf; len, flags: Integer): Integer; stdcall;
function sendHookProc(s: TSocket; var Buf; len, flags: Integer): Integer; stdcall;
var
i1 : integer;
s1 : string;
begin
result:=0;
i1 := 0;
while true do
begin
i1 := PosPchar('halo', @Buf, 4, len, true, i1);
if i1 >= 0 then
begin
SetString(s1, pchar(@Buf), len);
ReplaceStr(s1, 'hello', 'reallycool');
Move(pchar(string(s1))^,(pchar(@buf))^,sizeof(@buf));
len:=sizeof(buf);
end
else
break;
end;
Result := sendNextHook(s, Buf, len, flags);
end;
begin
hookapi('ws2_32.dll','send', @sendHookProc, @sendNextHook);
hookapi('wsock32.dll','send', @sendHookProc, @sendNextHook);
end.