哪位高手能翻译一下下面的代码 c to delphi ( 积分: 29 )

  • 主题发起人 主题发起人 like_ask
  • 开始时间 开始时间
L

like_ask

Unregistered / Unconfirmed
GUEST, unregistred user!
int Mir2EnCode(BYTE *pInBuff,DWORD dwInLen,BYTE *pOut,DWORD dwOutLen)
{
DWORD var_20 = 0;
BYTE var_1B = 0;
BYTE var_1A = 0;
BYTE var_19 = 0;
DWORD var_18 = 0;
DWORD var_14 = 0;
DWORD var_10 = 0;
DWORD var_C = 0;
DWORD var_8 = 0;
DWORD var_4 = 0;

BYTE bAL = 0;
BYTE bCL = 0;
DWORD dwEAX;
DWORD dwEDX;
DWORD dwECX;

var_20 = dwInLen ;
while(var_20 >0)
{
dwEDX = var_10 ;
bAL = pInBuff[dwEDX];
var_1A = bAL ;
dwECX = var_14 ;
dwECX = dwECX +2;
bAL = var_1A;
dwEAX = bAL ;
dwEAX = dwEAX >> dwECX ;
bAL = dwEAX ;
bAL = bAL | var_1B;

bAL = bAL & 0x3F;
var_19 = bAL;

dwEAX = var_14 ;
dwEAX = dwEAX +2;
dwECX = 8;
dwECX = dwECX - dwEAX ;
bAL = var_1A;
dwEAX = bAL ;
dwEAX = dwEAX << dwECX ;
dwEAX = dwEAX >> 2;
bAL = dwEAX ;
bAL = bAL & 0x3F ;
var_1B = bAL ;
var_14 = var_14 +2;
if(var_14<6)
{
dwEDX = var_18;
bCL = var_19;
bCL = bCL + 0x3C ;
pOut[dwEDX] = bCL ;
var_18 = var_18 +1;
}
else
{
dwEDX = var_18;
bCL = var_19;
bCL = bCL + 0x3C ;
pOut[dwEDX] = bCL ;
dwEDX = var_18 ;
bCL = var_1B ;
bCL = bCL + 0x3C;
pOut[dwEDX+1] = bCL ;
var_18 = var_18 + 2;
dwEAX = 0;
var_14 = 0;
var_1B = 0;
}
var_10 = var_10 +1;
var_20 = var_20 -1;
}

if(var_14 > 0)
{
dwEDX = var_18;
bCL = var_1B;
bCL = bCL + 0x3C ;
pOut[dwEDX] = bCL ;
var_18 = var_18 +1;
}
dwOutLen = var_18;
pOut[var_18]='/0';
return 1;
}
int Mir2DeCode(BYTE *pInBuff,DWORD dwInLen,BYTE *pOut,DWORD dwOutLen)
{
BYTE byte_4A2CBE[]={0x40,0x00,0xFC,0xF8,0xF0,0xE0,0xC0,0x8D,0x40};
DWORD var_28 = 0;
BYTE var_23 = 0;
BYTE var_22 = 0;
BYTE var_21 = 0;
DWORD var_20 = 0;
DWORD var_1C = 0;
DWORD var_18 = 0;
DWORD var_14 = 0;
DWORD var_10 = 0;
DWORD var_C = 0;
DWORD var_8 = 0;
DWORD var_4 = 0;

DWORD dwEAX = 0;
DWORD dwEDX = 0;
DWORD dwECX = 0;
BYTE bAL = 0;
BYTE bCL = 0;
var_14 = dwInLen;
var_18 = 2;
dwEAX = 0;
var_1C = dwEAX ;
dwEAX = 0;
var_20 = dwEAX ;
var_22 = 0;

dwEAX = var_14 ;
var_28 = dwEAX ;
var_10 = 1;
dwEDX = var_10 ;
while(var_28>0)
{
dwEAX = pInBuff[dwEDX-1];
dwEAX = dwEAX -0x3C;
if(dwEAX >= 0)
{
dwEDX = var_10 ;
bAL = pInBuff[dwEDX-1];
bAL = bAL -0x3C;
var_21 = bAL;
}
else
{
dwEAX = 0;
var_20 = dwEAX ;
}
dwEAX = var_20 ;
dwEAX = var_1C ;
dwEAX = dwEAX + 0x06;
if(dwEAX >= 8)
{
dwECX = 6;
dwECX = dwECX - var_18;
bAL = var_21;
bAL = bAL & 0x3F;
dwEAX = bAL ;
dwEAX = dwEAX >> dwECX;
bAL = dwEAX ;
bAL = bAL | var_22;
var_23 = bAL ;
dwEDX = var_20 ;
bCL = var_23;
pOut[dwEDX] = bCL;
var_20 = var_20 +1;
dwEAX = 0;
var_1C = dwEAX ;
if(var_18 >=6)
{
var_18 = 2;
var_10 = var_10 +1;
var_28 = var_28 -1;
}
else
{
var_18 = var_18 +2;
dwECX = var_18;
bAL = var_21;
bAL = bAL << dwECX ;
dwEDX = var_18;
bAL = bAL & byte_4A2CBE[dwEDX];
var_22 = bAL ;

dwEAX = bAL =8;
dwEAX = dwEAX -var_18;
var_1C = var_1C + dwEAX;

var_10 = var_10 +1;
var_28 = var_28 -1;
}
}
else
{
dwECX = var_18;
bAL = var_21;
bAL = bAL << dwECX ;
dwEDX = var_18;
bAL = bAL & byte_4A2CBE[dwEDX];
var_22 = bAL ;

dwEAX = bAL =8;
dwEAX = dwEAX -var_18;
var_1C = var_1C + dwEAX;

var_10 = var_10 +1;
var_28 = var_28 -1;
}
}
dwOutLen = var_20;
return 1;
}
 
分太少懒得翻,用CBC编译一下obj给D调用就是了。
 
没有分了,分多少就决定各位的兴趣吗?
 
没分没动力打一大堆字 [8D]
 
没分没动力打一大堆字 [8D]
 
谁能翻译,麻烦帮帮忙,分我可以再想办法再整点,如何?
 
现在没有白干活人啊.
 
不是告诉你一个更简便的方法了吗,为什么不试试。
 
现在的人都是那么的现实~!
 
不会的吧,

白河愁说用BCB写,我不会用BCB,能具体指点或帮助编一下吗?

楼上的,如果都这么现实,大富翁存在的意义何在?建议版主,站长考虑关门大吉吧。
 
白河愁,麻烦您帮忙编译一下,谢谢,
EMAIL:shellapi@126.com
兄弟我没有安装BCB,而且不熟悉。
 
逆向工程是大活儿,不是这么说说就搞的。
 
给分吧
function Mir2EnCode(const pInBuff :PChar; const dwInLen: DWORD;
const pOut:PChar; const dwOutLen: DWORD):Integer;
var
var_1B, var_1A, var_19, var_18, var_14, var_10,
var_C, var_8, var_4, bAL, bCL : BYTE;
var_20, dwEAX, dwEDX, dwECX: DWORD;
begin
var_20 := 0;
var_1B := 0;
var_1A := 0;
var_19 := 0;
var_18 := 0;
var_14 := 0;
var_10 := 0;
var_C := 0;
var_8 := 0;
var_4 := 0;


bAL := 0;
bCL := 0;
dwEAX:= 0;
dwEDX:= 0;
dwECX:= 0;

while (var_20 >0) do
begin
dwEDX := var_10 ;
bAL := Byte(pInBuff[dwEDX]);
var_1A := bAL ;
dwECX := var_14 ;
dwECX := dwECX +2;
bAL := var_1A;
dwEAX := bAL ;
dwEAX := dwEAX shr dwECX ;
bAL := dwEAX ;
bAL := bAL or var_1B;

bAL := bAL and $3F;
var_19 := bAL;

dwEAX := var_14 ;
dwEAX := dwEAX +2;
dwECX := 8;
dwECX := dwECX - dwEAX ;
bAL := var_1A;
dwEAX := bAL ;
dwEAX := dwEAX shl dwECX ;
dwEAX := dwEAX shr 2;
bAL := dwEAX ;
bAL := bAL and $3F ;
var_1B := bAL ;
var_14 := var_14 +2;
if (var_14<6) then
begin
dwEDX := var_18;
bCL := var_19;
bCL := bCL + $3C ;
pOut[dwEDX] := Char(bCL);
var_18 := var_18 +1;
end
else begin
dwEDX := var_18;
bCL := var_19;
bCL := bCL + $3C ;
pOut[dwEDX] := Char(bCL);
dwEDX := var_18 ;
bCL := var_1B ;
bCL := bCL + $3C;
pOut[dwEDX+1] := Char(bCL) ;
var_18 := var_18 + 2;
dwEAX := 0;
var_14 := 0;
var_1B := 0;
end;
var_10 := var_10 +1;
var_20 := var_20 -1;
end;

if (var_14 > 0) then
begin
dwEDX := var_18;
bCL := var_1B;
bCL := bCL + $3C ;
pOut[dwEDX] := Char(bCL);
var_18 := var_18 +1;
end;
pOut[var_18] := #0;
Result := 1;
end;

function Mir2DeCode(const pInBuff: PChar; const dwInLen:DWORD;
const pOut: PChar; const dwOutLen:DWORD ):Integer;
const
byte_4A2CBE : array [0..8] of Byte = ($40,$00,$FC,$F8,$F0,$E0,$C0,$8D,$40);
var
var_28, var_20, var_1C, var_18, var_14, var_10,
var_C, var_8, var_4, dwEAX, dwEDX, dwECX: DWORD ;
var_23, var_22, var_21, bAL, bCL: BYTE ;
begin
var_28 := 0;
var_23 := 0;
var_22 := 0;
var_21 := 0;
var_20 := 0;
var_1C := 0;
var_18 := 0;
var_14 := 0;
var_10 := 0;
var_C := 0;
var_8 := 0;
var_4 := 0;

dwEAX := 0;
dwEDX := 0;
dwECX := 0;
bAL := 0;
bCL := 0;
var_14 := dwInLen;
var_18 := 2;
dwEAX := 0;
var_1C := dwEAX ;
dwEAX := 0;
var_20 := dwEAX ;
var_22 := 0;

dwEAX := var_14 ;
var_28 := dwEAX ;
var_10 := 1;
dwEDX := var_10 ;
while (var_28>0) do
begin
dwEAX := Byte(pInBuff[dwEDX-1]);
dwEAX := dwEAX - $3C;
if (dwEAX >= 0) then
begin
dwEDX := var_10 ;
bAL := Byte(pInBuff[dwEDX-1]);
bAL := bAL - $3C;
var_21 := bAL;
end
else begin
dwEAX := 0;
var_20 := dwEAX ;
end;
dwEAX := var_20 ;
dwEAX := var_1C ;
dwEAX := dwEAX + $06;
if (dwEAX >= 8) then
begin
dwECX := 6;
dwECX := dwECX - var_18;
bAL := var_21;
bAL := bAL and $3F;
dwEAX := bAL ;
dwEAX := dwEAX shr dwECX;
bAL := dwEAX ;
bAL := bAL or var_22;
var_23 := bAL ;
dwEDX := var_20 ;
bCL := var_23;
pOut[dwEDX] := Char(bCL);
var_20 := var_20 +1;
dwEAX := 0;
var_1C := dwEAX ;
if (var_18 >=6) then
begin
var_18 := 2;
var_10 := var_10 +1;
var_28 := var_28 -1;
end
else begin
var_18 := var_18 +2;
dwECX := var_18;
bAL := var_21;
bAL := bAL shl dwECX ;
dwEDX := var_18;
bAL := bAL and byte_4A2CBE[dwEDX];
var_22 := bAL ;

dwEAX := 8;
bAL := 8;
dwEAX := dwEAX -var_18;
var_1C := var_1C + dwEAX;
var_10 := var_10 +1;
var_28 := var_28 -1;
end;
end
else begin
dwECX := var_18;
bAL := var_21;
bAL := bAL shl dwECX ;
dwEDX := var_18;
bAL := bAL and byte_4A2CBE[dwEDX];
var_22 := bAL ;

dwEAX := 8;
bAL := 8;
dwEAX := dwEAX - var_18;
var_1C := var_1C + dwEAX;

var_10 := var_10 +1;
var_28 := var_28 -1;
end;
end;
Result := 1;
end;
 
不过分确实太少了 还是我看错了才翻译的,我看成100分了。。后来才发现。,,。
 
不管能不能用,谢谢你的直爽,谢谢。
 
后退
顶部