问题描述
我明白了:
int __cdecl update_FILES(const char *a1,const char *a2,int a3)
{
int result; // eax
int v4; // esi
int v5; // eax
FILE *v6; // [esp+20h] [ebp-98h]
FILE *v7; // [esp+24h] [ebp-94h]
FILE *v8; // [esp+28h] [ebp-90h]
char Str1[9]; // [esp+38h] [ebp-80h] BYREF
char v10; // [esp+41h] [ebp-77h]
float v11; // [esp+44h] [ebp-74h]
char Destination[50]; // [esp+4Ah] [ebp-6Eh] BYREF
char Buffer[56]; // [esp+7Ch] [ebp-3Ch] BYREF
float v14; // [esp+B4h] [ebp-4h]
_BYTE v15[336]; // [esp+B8h] [ebp+0h] BYREF
crear_cola_res(v15);
v6 = fopen(a1,"r+b");
result = 1;
if ( v6 )
{
v7 = fopen(a2,"rt");
if ( v7 )
{
strcpy(Destination,a2);
strcpy(strrchr(Destination,46),"_myFile.txt");
v8 = fopen(Destination,"wb");
if ( v8 )
{
fread(Buffer,0x3Cu,1u,v6);
v4 = read_movements(Str1,v7,a3);
LABEL_5:
if ( !feof(v6) )
{
while ( v4 )
{
v5 = strcmp(Str1,Buffer);
if ( v5 < 0 )
{
v4 = read_movements(Str1,a3);
goto LABEL_5;
}
if ( !v5 )
{
do
{
if ( v10 == 68 )
{
v14 = v14 - v11;
}
else if ( v10 == 67 )
{
v14 = v14 + v11;
}
put_in_FIFO(v15,Str1,16);
v4 = read_movements(Str1,a3);
}
while ( v4 && !strcmp(Str1,Buffer) );
fseek(v6,-60,1);
fwrite(Buffer,v6);
fseek(v6,1);
if ( v14 < 0.0 )
{
while ( remove_from_FIFO(v15,16) )
fprintf(v8,"%s,%c,%.2f\n",v10,v11);
}
else
{
erase_FIFO(v15);
}
}
fread(Buffer,v6);
if ( feof(v6) )
break;
}
}
fclose(v6);
fclose(v7);
fclose(v8);
result = 0;
}
else
{
fclose(v6);
fclose(v7);
result = 3;
}
}
else
{
fclose(v6);
result = 2;
}
}
return result;
}
我想知道从上面显示的伪代码中获取纯 C 代码的最佳方式是什么。显示的代码对我来说没有多大意义
有什么办法吗?你会怎么做?。
我有点困惑。
编辑:
抱歉,我是反编译过程的新手。
我原来的函数有这个原型:
update_FILES("../File/accounts.dat","../Files/movements.txt",key);
为什么参数彼此不同?。没看懂
解决方法
我仍然完全不确定你对什么感到困惑...... ...但这个伪代码可能会有所帮助:
来电者:
update_FILES("../File/accounts.dat","../Files/movements.txt",key);
P 代码:
int __cdecl update_FILES(const char *a1,const char *a2,int a3)
{
<<Declare some local variables (result,v4,v5,v6,...)>>
v6 = fopen("../File/accounts.dat")
if (v6 <> 0) // If "fopen()" succeed...
v7 = fopen("../Files/movements.txt")
if (v7 <> 0)
Destination = a2
...