完美国际发包call优化版(delphi)

来源:互联网 发布:知乎 提拉紧致精华 编辑:程序博客网 时间:2024/05/17 07:27

http://www.ghoffice.com/bbs/simple/t60471.html

 

uses
  StrUtils;

//=========================反写函数=========================
function Anti_writeFun(aa:Integer;len:Integer): string;
var
  bb:string;
  i:Integer;
begin
  bb:=RightStr('0000000'+ string(IntToHex(aa,len)),len);
  for i:= 1 to Len div 2 do
  begin
    result := result + MidStr(bb,len + 1 - 2 * i,2);
  end;
end;

type  //==========定义参数指针================
  PackStructure = packed record //封包结构
  Len:dword;//包长
  buf:array[0..63]of byte;
  end;

//=========================发包Call=========================
procedure callsendPack(packContents:string);stdcall;
var
  address:Pointer;
  bb:PackStructure;
  len,tt:dword;
  i,j:integer;
begin
  bb.len:=round(length(packContents)/2);
  for i:= 1 to bb.len do
  begin
    j:= i * 2 - 1;
    bb.buf[i - 1]:=strtoint('$' + packContents[j] + packContents[j + 1]);
  end;
  address:=Pointer($0059F330);
  len:=pdword(@bb)^;
  tt:=dword(@bb)+ 4;
  asm
    pushad
    mov eax,dword ptr DS:[$94C754]
    mov ecx,dword ptr DS:[eax+$20]
    push len //封包长度
    push tt //发包内容地址
    call address
    popad
  end
end;

调用例子:
procedure TForm1.btn13Click(Sender: TObject);
begin
  //28 00 00 01 15 00 C7 21 00 00 (28 00 00 01 Pos Id)//发包吃药
  callsendPack('28000001'+ Anti_writeFun(1,4) + Anti_writeFun(8617,8));
end;