📄
字号:
求delphi制作外挂的教程或示范源代码!!!!
放上侦探的传奇脱机代码的VC++=====>delphi的编解码部分,调试通过
呵呵 不想放上全部代码,免得便宜了不劳而获者
unit MirCore;
interface
uses
windows,sysutils;
type
int=integer;
function ucase(c:char):char;
function hex2int( c:char ):int;
function int2hex(v:int ):char;
function UnNameCode(sIn:pchar;sOut:pchar ):int;
Function UnGameCode(p:pchar;pOut:pbyte):int;
function UnGateCode( sIn:pchar;sOut:pchar):int;
function CodeGateCode(sIn:pchar;sOut:pchar):int;
Function CodeGameCode(pIn:pbyte;size:int;pOut:pbyte):int;
const
hextable:string='0123456789ABCDEF';
implementation
uses DefBin, MirGame, Test, MirMsg;
function UCase(c:char):char;
begin
// char cres = '\0';
if ( c >= 'a') and (c <= 'z' ) then
begin
c:=chr(ord(c)+ ord('A') - ord('a'));
result:= c;
exit;
end;
result:=c;
end;
function hex2int( c:char ):int;
begin
if( c >= 'A') and (c <= 'F' ) then
begin
result:= int(ord(c) - ord('A') + 10 );
exit;
end
else if( c >= '0') and ( c <= '9' ) then
begin
result:= int( ord(c) - ord('0') );
exit;
end;
result:= 0;
end;
function int2hex(v:int):char;
begin
v:=v and $f;
result:= hextable[v+1];
end;
function UnNameCode(sIn:pchar;sOut:pchar):int;
var
i:int;
begin
i:=0;
//int size = strlen( in );
while(sIn[i]<>#0) do
begin
sOut[i]:= chr((ord(sIn[i]) and $3f ) shl 2);
sOut[i]:= chr(ord(sOut[i]) or (byte(ord(sIn[i + 1]) and $c0 ) shr 6));
inc(i);
end;
sOut[i]:=#0;
result:= 1;
end;
function CodeGateCode(sIn:pchar;sOut:pchar):int;
var
lcnt:int;
icode:int;
tcode:int;
hbyte:int;
lbyte:int;
i:integer;
_edi:int;
begin
lcnt := strlen(sIn);
i := 0;
icode := 0;
tcode := 0;
hbyte := 0;
lbyte := 0;
_edi := $f667;
for i := 0 to lcnt-1 do
begin
icode := (int(sIn[i])) and $ff;
//////////tcode := icode;
//////////icode := ((int)sOut[i]) and $ff;
tcode := icode;
tcode :=tcode xor ((_edi and $ffff) shr 8);
hbyte := (tcode and $f0 ) shr 4;
lbyte := (tcode and $f );
sOut[i * 2] := int2hex(hbyte);
sOut[i * 2]:= int2hex(hbyte);
sOut[i * 2 + 1] :=int2hex(lbyte);
_edi := (((_edi + tcode ) * $ce6d ) and $ffff ) + $58bf;
end;
//sOut[i * 2] := 0;
result:= 1;
end;
function UnGateCode( sIn:pchar;sOut:pchar):int;
var
lcnt:int;
i:int;
icode:int;
_edi:int;
begin
if( strlen(@sIn) = 0 ) then
begin
result:= 0;
exit;
end;
lcnt:= (strlen(sIn) shr 1);
if lcnt = 0 then begin
result:= 0;
exit;
end;
if sIn[0]=#0 then begin
result:= 0;
exit;
end;
i := 0;
icode := 0;
_edi := $f667;
for i := 0 to lcnt-1 do
begin
sOut[i] := chr((hex2int(UCase(sIn[i * 2])) and $f ) shl 4);
sOut[i] := chr(ord(sOut[i])+hex2int(UCase(sIn[i * 2 + 1])) and $f);
icode := (int(sOut[i])) and $ff;
sOut[i] :=chr(ord(sOut[i]) xor ((_edi and $ffff) shr 8));
_edi := (((_edi + icode ) * $ce6d ) and $ffff ) + $58bf;
end;
sOut[lcnt] := #0;//'\0';
result:= 1;
end;
Function UnGameCode(p:pchar; pOut:pbyte):int;
var
i:int;
ilen,olen:integer;
iptr,optr:int;
b1,b2,b3,b4:byte;
sOut:array[0..4095] of byte;
begin
ilen :=strlen(p);
if( ilen <= 0 ) then
begin
result:= 0;
exit;
end;
iptr:=0;
optr:=0;
If ((p =nil) or (pout=nil)) then
begin
result:= 0;
exit;
end;
(pdword(@p[ilen]))^:= $3c3c3c;
olen:= (ilen * 6) div 8;
for i:=0 to (ilen + 3) div 4-1 do
begin
b1:= (ord(p[iptr]) -$3c) and $3f;
inc(iptr);
b2:= (ord(p[iptr]) -$3c) and $3f;
inc(iptr);
b3:= (ord(p[iptr]) -$3c) and $3f;
inc(iptr);
b4:= (ord(p[iptr]) -$3c) and $3f;
inc(iptr);
sOut[optr]:=(( b1 and b00111111) shl 2 )or ((b2 and b00110000) shr 4);
inc(optr);
sOut[optr]:=(( b2 and b00001111) shl 4 )or ((b3 and b00111100) shr 2);
inc(optr);
sOut[optr]:=(( b3 and b00000011) shl 6 )or b4;
inc(optr);
end;
sOut[olen]:=0;
copymemory(pout,@sout,olen+1);
result:= olen;
end;
Function CodeGameCode(pIn:pbyte;size:int;pOut:pbyte):int;
var
i,ilen:int;
idxout:int;
idxin:int;
reallen:int;
b1,b2,b3:byte;
sOut:array[0..4096] of byte;
Sin:array[0..4096] of byte;
begin
zeromemory(@sout,4096);
zeromemory(@sIn,4096);
copymemory(@sIn,pIn,size);
i:= 0;
ilen:= 0;
idxOut:= 0;
idxin:= 0;
//int icode:= 0;
reallen:= 0;
ilen:= size;
ilen:= (size + 2) div 3;
reallen:= (size * 8 + 5) div 6;
Pdword(@sIn[size])^:=0;
//ileft:= size % 3;
for i:= 0 to ilen-1 do
begin
b1:= ord(sIn[idxin]);
inc(idxin);
b2:= ord(sIn[idxin]);
inc(idxin);
b3:= ord(sIn[idxin]);
inc(idxin);
sOut[idxOut]:= ((b1 and b11111100) shr 2)+ord('<');
inc(idxout);
sOut[idxOut]:= (((b1 and b00000011) shl 4)or((b2 and b11110000) shr 4))+ord('<');
inc(idxout);
sOut[idxOut]:= (((b2 and b00001111) shl 2)or((b3 and b11000000) shr 6))+ord('<');
inc(idxout);
sOut[idxOut]:= (b3 and b00111111)+ord('<');
inc(idxout);
end;
sOut[reallen]:=0;
copymemory(pout,@sout,reallen+1);
result:= 1;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -