一段未能看懂的代码

以下是一个函数的汇编代码:

.text:008919BC sub_8919BC proc near
.text:008919BC
.text:008919BC var_28= dword ptr -28h
.text:008919BC var_24= dword ptr -24h
.text:008919BC var_20= dword ptr -20h
.text:008919BC var_1C= dword ptr -1Ch
.text:008919BC var_18= dword ptr -18h
.text:008919BC var_14= dword ptr -14h
.text:008919BC arg_0= dword ptr  8
.text:008919BC arg_4= dword ptr  0Ch
.text:008919BC arg_8= dword ptr  10h
.text:008919BC
.text:008919BC push    ebp
.text:008919BD mov     ebp, esp
.text:008919BF push    edi
.text:008919C0 push    esi
.text:008919C1 push    ebx
.text:008919C2 sub     esp, 1Ch
.text:008919C5 mov     [ebp+var_14], ecx
.text:008919C8 mov     eax, [ebp+arg_0]
.text:008919CB mov     [ebp+var_18], eax
.text:008919CE mov     eax, [ebp+arg_4]
.text:008919D1 mov     edx, [ebp+arg_8]
.text:008919D4 mov     [ebp+var_20], eax
.text:008919D7 mov     [ebp+var_1C], edx
.text:008919DA mov     eax, [ecx-4]
.text:008919DD mov     eax, [eax-4]
.text:008919E0 mov     eax, [eax-4]
.text:008919E3 mov     eax, [eax-4]
.text:008919E6 mov     edi, [edx]
.text:008919E8 mov     eax, [edx+4]
.text:008919EB mov     [ebp+var_24], eax
.text:008919EE cmp     edi, eax
.text:008919F0 jg      short loc_891A1A
.text:008919F2 mov     esi, edi
.text:008919F4 mov     edx, [ebp+var_20]
.text:008919F7 mov     [ebp+var_28], edx
.text:008919FA
.text:008919FA loc_8919FA:
.text:008919FA mov     ebx, esi
.text:008919FC sub     ebx, edi
.text:008919FE sub     esp, 0Ch
.text:00891A01 push    [ebp+var_18]
.text:00891A04 call    _system__stream_attributes__i_c
.text:00891A09 mov     edx, [ebp+var_28]
.text:00891A0C mov     [edx+ebx], al
.text:00891A0F add     esp, 10h
.text:00891A12 cmp     [ebp+var_24], esi
.text:00891A15 jz      short loc_891A1A
.text:00891A17 inc     esi
.text:00891A18 jmp     short loc_8919FA
.text:00891A1A
.text:00891A1A loc_891A1A:
.text:00891A1A lea     esp, [ebp-0Ch]
.text:00891A1D pop     ebx
.text:00891A1E pop     esi
.text:00891A1F pop     edi
.text:00891A20 pop     ebp
.text:00891A21 retn

以下4行比较特殊:

.text:008919DA mov     eax, [ecx-4]
.text:008919DD mov     eax, [eax-4]
.text:008919E0 mov     eax, [eax-4]
.text:008919E3 mov     eax, [eax-4]

在该函数被调用之前,ecx已被赋值。

这样操作后eax的最终值没有被后续代码使用。

IDA把以上4行翻译为:

  v4 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)(*(_DWORD *)(v3 - 4) - 4) - 4) - 4);

可能由v4没有后续引用,IDA77没有翻译这4行。

看来这4行像是原始程序所用的编译器生成的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值