用IDA分析的结果差不多如下
[C] 纯文本查看 复制代码 int __cdecl main(int argc, const char **argv, const char **envp)
{
int v1; // eax
int v4; // eax
char v6; // [esp-28h] [ebp-80h]
int v7; // [esp-24h] [ebp-7Ch]
int v8; // [esp-20h] [ebp-78h]
int v9; // [esp-1Ch] [ebp-74h]
int v10; // [esp-18h] [ebp-70h]
char v11; // [esp-14h] [ebp-6Ch]
int v12; // [esp-10h] [ebp-68h]
int *v13; // [esp-Ch] [ebp-64h]
int v14; // [esp-8h] [ebp-60h]
int *v15; // [esp-4h] [ebp-5Ch]
int v16; // [esp+Ch] [ebp-4Ch]
__int16 v17; // [esp+14h] [ebp-44h]
int v18; // [esp+18h] [ebp-40h]
char v19; // [esp+21h] [ebp-37h]
int v20; // [esp+24h] [ebp-34h]
human boss; // [esp+30h] [ebp-28h]
human me; // [esp+44h] [ebp-14h]
strcpy((char *)&v18, "真密码:");
strcpy((char *)&v16, "52pojie");
boss.name[0] = 's';
boss.name[3] = 's';
v1 = 0xA;
v19 = 0;
v17 = 0;
strcpy(&v20, "123456789");
boss.name[0] = 'b';
boss.name[1] = 'o';
boss.name[4] = 0;
boss.attack = 3;
boss.hp = 0xA;
me.name[0] = 'm';
me.name[1] = 'e';
me.name[2] = 0;
me.attack = 1;
me.hp = 0xA;
do
{
if ( me.hp <= 0 )
break;
qmemcpy(&v11, &me, 0x14u);
qmemcpy(&v6, &boss, 0x14u);
v4 = printresult(v6, v7, v8, v9, v10, v11, v12, (int)v13, v14, (int)v15);
if ( attack(&boss, &me, v4) <= 0 )
printf(invaild);
v1 = boss.hp;
}
while ( boss.hp > 0 );
if ( v1 < 0 || v1 > 0 )
MessageBoxA(0u, failed, failed, 0x30u);
if ( me.attack != 1 || boss.attack != 3 )
MessageBoxA(0u, failed, failed, 0x30u);
if ( me.hp <= 0 )
{
MessageBoxA(0u, failed, failed, 0x30u);
}
else
{
v15 = &v18;
printf(aS_0, &v18);
LOWORD(v16) = v20;
v13 = &v16;
BYTE2(v16) = BYTE2(v20);
printf(aS, &v16);
system(aPause);
}
return 0;
}
虽然有部分错误,但是能看懂就行。
我猜测的human struct定义如下
虽然有判断了me和boss的攻击力,但是没有判断初始化的血量,所以把boss血量改1就能秒了。
一刀劈死无鸭梨。
|