souz
July 31st, 2004, 08:02
Hi all!
Can anyone help me with this portions of code to explain whiat this code do?
The code:
.text:00010A4D Sub_001 proc near ;
.text:00010A4D
.text:00010A4D var_4 = dword ptr -4
.text:00010A4D arg_0 = dword ptr 8
.text:00010A4D
.text:00010A4D push ebp
.text:00010A4E mov ebp, esp
.text:00010A50 push ecx
.text:00010A51 sub edx, 10h
.text:00010A54 push ebx
.text:00010A55 neg edx
.text:00010A57 push esi
.text:00010A58 mov esi, ecx
.text:00010A5A sbb edx, edx
.text:00010A5C lea eax, [esi+8]
.text:00010A5F not edx
.text:00010A61 and edx, eax
.text:00010A63 cmp byte_15B72, 0
.text:00010A6A mov eax, [esi+4]
.text:00010A6D push edi
.text:00010A6E mov ebx, edx
.text:00010A70 mov [ebp+var_4], eax
.text:00010A73 mov edi, eax
.text:00010A75 lea ecx, [ebp+var_4]
.text:00010A78 jnz loc_10B26
.text:00010A7E mov edx, [ebp+arg_0]
.text:00010A81 add edx, 238h
.text:00010A87 call sub_10837
.text:00010A8C test ebx, ebx
.text:00010A8E mov eax, [ebp+var_4]
.text:00010A91 jz short loc_10A95
.text:00010A93 mov [ebx], eax
.text:00010A95
.text:00010A95 loc_10A95: ; CODE XREF: Sub_001+44j
.text:00010A95 ; Sub_001+E8j
.text:00010A95 mov ecx, [esi]
.text:00010A97 xor ecx, eax
.text:00010A99 mov [esi+4], ecx
.text:00010A9C mov [esi], edi
.text:00010A9E xor ecx, ecx
.text:00010AA0
.text:00010AA0 loc_10AA0: ; CODE XREF: Sub_001+76j
.text:00010AA0 ; Sub_001+11Ej
.text:00010AA0 mov eax, dword_1597A
.text:00010AA5 mov edx, [esi+4]
.text:00010AA8 xor eax, 25807724h
.text:00010AAD ror eax, 7
.text:00010AB0 xor eax, edx
.text:00010AB2 rol eax, cl
.text:00010AB4 xor eax, [esi]
.text:00010AB6 inc ecx
.text:00010AB7 inc ecx
.text:00010AB8 cmp ecx, 0Ch
.text:00010ABB mov [ebp+var_4], eax
.text:00010ABE mov [esi+4], eax
.text:00010AC1 mov [esi], edx
.text:00010AC3 jb short loc_10AA0
.text:00010AC5 cmp byte_15B72, 0
.text:00010ACC mov edi, eax
.text:00010ACE lea ecx, [ebp+var_4]
.text:00010AD1 jnz loc_10BA0
.text:00010AD7 mov edx, [ebp+arg_0]
.text:00010ADA add edx, 238h
.text:00010AE0 call sub_10837
.text:00010AE5 test ebx, ebx
.text:00010AE7 mov eax, [ebp+var_4]
.text:00010AEA jz short loc_10AEF
.text:00010AEC mov [ebx+4], eax
.text:00010AEF
.text:00010AEF loc_10AEF: ; CODE XREF: Sub_001+9Dj
.text:00010AEF ; Sub_001+145j ...
.text:00010AEF mov ecx, [esi]
.text:00010AF1 xor ecx, eax
.text:00010AF3 mov [esi+4], ecx
.text:00010AF6 mov [esi], edi
.text:00010AF8 xor ecx, ecx
.text:00010AFA
.text:00010AFA loc_10AFA: ; CODE XREF: Sub_001+D0j
.text:00010AFA mov edx, dword_1597E
.text:00010B00 mov eax, [esi+4]
.text:00010B03 xor edx, 36459714h
.text:00010B09 rol edx, 9
.text:00010B0C xor edx, eax
.text:00010B0E rol edx, cl
.text:00010B10 add ecx, 5
.text:00010B13 xor edx, [esi]
.text:00010B15 cmp ecx, 1Eh
.text:00010B18 mov [esi+4], edx
.text:00010B1B mov [esi], eax
.text:00010B1D jb short loc_10AFA
.text:00010B1F pop edi
.text:00010B20 pop esi
.text:00010B21 pop ebx
.text:00010B22 leave
.text:00010B23 retn 4
.text:00010B26 ; ---------------------------------------------------------------------------
.text:00010B26
.text:00010B26 loc_10B26: ; CODE XREF: Sub_001+2Bj
.text:00010B26 mov edx, offset unk_1598A
.text:00010B2B call sub_10837
.text:00010B30 test ebx, ebx
.text:00010B32 mov eax, [ebp+var_4]
.text:00010B35 jz loc_10A95
.text:00010B3B mov [ebx], eax
.text:00010B3D mov ecx, [esi]
.text:00010B3F xor ecx, eax
.text:00010B41 mov [esi+4], ecx
.text:00010B44 mov [esi], edi
.text:00010B46 xor ecx, ecx
.text:00010B48 mov eax, dword_1597A
.text:00010B4D mov edx, [esi+4]
.text:00010B50 xor eax, 25807724h
.text:00010B55 ror eax, 7
.text:00010B58 xor eax, edx
.text:00010B5A rol eax, cl
.text:00010B5C xor eax, [esi]
.text:00010B5E inc ecx
.text:00010B5F inc ecx
.text:00010B60 cmp ecx, 0Ch
.text:00010B63 mov [ebp+var_4], eax
.text:00010B66 mov [esi+4], eax
.text:00010B69 mov [esi], edx
.text:00010B6B jb loc_10AA0
.text:00010B71 cmp byte_15B72, 0
.text:00010B78 mov edi, eax
.text:00010B7A lea ecx, [ebp+var_4]
.text:00010B7D jnz short loc_10BA0
.text:00010B7F mov edx, [ebp+arg_0]
.text:00010B82 add edx, 238h
.text:00010B88 call sub_10837
.text:00010B8D test ebx, ebx
.text:00010B8F mov eax, [ebp+var_4]
.text:00010B92 jz loc_10AEF
.text:00010B98 mov [ebx+4], eax
.text:00010B9B jmp loc_10AEF
.text:00010BA0 ; ---------------------------------------------------------------------------
.text:00010BA0
.text:00010BA0 loc_10BA0: ; CODE XREF: Sub_001+84j
.text:00010BA0 ; Sub_001+130j
.text:00010BA0 mov edx, offset unk_1598A
.text:00010BA5 call sub_10837
.text:00010BAA test ebx, ebx
.text:00010BAC mov eax, [ebp+var_4]
.text:00010BAF jz loc_10AEF
.text:00010BB5 mov [ebx+4], eax
.text:00010BB8 jmp loc_10AEF
.text:00010BB8 Sub_001 endp
Thanks!
Can anyone help me with this portions of code to explain whiat this code do?
The code:
.text:00010A4D Sub_001 proc near ;
.text:00010A4D
.text:00010A4D var_4 = dword ptr -4
.text:00010A4D arg_0 = dword ptr 8
.text:00010A4D
.text:00010A4D push ebp
.text:00010A4E mov ebp, esp
.text:00010A50 push ecx
.text:00010A51 sub edx, 10h
.text:00010A54 push ebx
.text:00010A55 neg edx
.text:00010A57 push esi
.text:00010A58 mov esi, ecx
.text:00010A5A sbb edx, edx
.text:00010A5C lea eax, [esi+8]
.text:00010A5F not edx
.text:00010A61 and edx, eax
.text:00010A63 cmp byte_15B72, 0
.text:00010A6A mov eax, [esi+4]
.text:00010A6D push edi
.text:00010A6E mov ebx, edx
.text:00010A70 mov [ebp+var_4], eax
.text:00010A73 mov edi, eax
.text:00010A75 lea ecx, [ebp+var_4]
.text:00010A78 jnz loc_10B26
.text:00010A7E mov edx, [ebp+arg_0]
.text:00010A81 add edx, 238h
.text:00010A87 call sub_10837
.text:00010A8C test ebx, ebx
.text:00010A8E mov eax, [ebp+var_4]
.text:00010A91 jz short loc_10A95
.text:00010A93 mov [ebx], eax
.text:00010A95
.text:00010A95 loc_10A95: ; CODE XREF: Sub_001+44j
.text:00010A95 ; Sub_001+E8j
.text:00010A95 mov ecx, [esi]
.text:00010A97 xor ecx, eax
.text:00010A99 mov [esi+4], ecx
.text:00010A9C mov [esi], edi
.text:00010A9E xor ecx, ecx
.text:00010AA0
.text:00010AA0 loc_10AA0: ; CODE XREF: Sub_001+76j
.text:00010AA0 ; Sub_001+11Ej
.text:00010AA0 mov eax, dword_1597A
.text:00010AA5 mov edx, [esi+4]
.text:00010AA8 xor eax, 25807724h
.text:00010AAD ror eax, 7
.text:00010AB0 xor eax, edx
.text:00010AB2 rol eax, cl
.text:00010AB4 xor eax, [esi]
.text:00010AB6 inc ecx
.text:00010AB7 inc ecx
.text:00010AB8 cmp ecx, 0Ch
.text:00010ABB mov [ebp+var_4], eax
.text:00010ABE mov [esi+4], eax
.text:00010AC1 mov [esi], edx
.text:00010AC3 jb short loc_10AA0
.text:00010AC5 cmp byte_15B72, 0
.text:00010ACC mov edi, eax
.text:00010ACE lea ecx, [ebp+var_4]
.text:00010AD1 jnz loc_10BA0
.text:00010AD7 mov edx, [ebp+arg_0]
.text:00010ADA add edx, 238h
.text:00010AE0 call sub_10837
.text:00010AE5 test ebx, ebx
.text:00010AE7 mov eax, [ebp+var_4]
.text:00010AEA jz short loc_10AEF
.text:00010AEC mov [ebx+4], eax
.text:00010AEF
.text:00010AEF loc_10AEF: ; CODE XREF: Sub_001+9Dj
.text:00010AEF ; Sub_001+145j ...
.text:00010AEF mov ecx, [esi]
.text:00010AF1 xor ecx, eax
.text:00010AF3 mov [esi+4], ecx
.text:00010AF6 mov [esi], edi
.text:00010AF8 xor ecx, ecx
.text:00010AFA
.text:00010AFA loc_10AFA: ; CODE XREF: Sub_001+D0j
.text:00010AFA mov edx, dword_1597E
.text:00010B00 mov eax, [esi+4]
.text:00010B03 xor edx, 36459714h
.text:00010B09 rol edx, 9
.text:00010B0C xor edx, eax
.text:00010B0E rol edx, cl
.text:00010B10 add ecx, 5
.text:00010B13 xor edx, [esi]
.text:00010B15 cmp ecx, 1Eh
.text:00010B18 mov [esi+4], edx
.text:00010B1B mov [esi], eax
.text:00010B1D jb short loc_10AFA
.text:00010B1F pop edi
.text:00010B20 pop esi
.text:00010B21 pop ebx
.text:00010B22 leave
.text:00010B23 retn 4
.text:00010B26 ; ---------------------------------------------------------------------------
.text:00010B26
.text:00010B26 loc_10B26: ; CODE XREF: Sub_001+2Bj
.text:00010B26 mov edx, offset unk_1598A
.text:00010B2B call sub_10837
.text:00010B30 test ebx, ebx
.text:00010B32 mov eax, [ebp+var_4]
.text:00010B35 jz loc_10A95
.text:00010B3B mov [ebx], eax
.text:00010B3D mov ecx, [esi]
.text:00010B3F xor ecx, eax
.text:00010B41 mov [esi+4], ecx
.text:00010B44 mov [esi], edi
.text:00010B46 xor ecx, ecx
.text:00010B48 mov eax, dword_1597A
.text:00010B4D mov edx, [esi+4]
.text:00010B50 xor eax, 25807724h
.text:00010B55 ror eax, 7
.text:00010B58 xor eax, edx
.text:00010B5A rol eax, cl
.text:00010B5C xor eax, [esi]
.text:00010B5E inc ecx
.text:00010B5F inc ecx
.text:00010B60 cmp ecx, 0Ch
.text:00010B63 mov [ebp+var_4], eax
.text:00010B66 mov [esi+4], eax
.text:00010B69 mov [esi], edx
.text:00010B6B jb loc_10AA0
.text:00010B71 cmp byte_15B72, 0
.text:00010B78 mov edi, eax
.text:00010B7A lea ecx, [ebp+var_4]
.text:00010B7D jnz short loc_10BA0
.text:00010B7F mov edx, [ebp+arg_0]
.text:00010B82 add edx, 238h
.text:00010B88 call sub_10837
.text:00010B8D test ebx, ebx
.text:00010B8F mov eax, [ebp+var_4]
.text:00010B92 jz loc_10AEF
.text:00010B98 mov [ebx+4], eax
.text:00010B9B jmp loc_10AEF
.text:00010BA0 ; ---------------------------------------------------------------------------
.text:00010BA0
.text:00010BA0 loc_10BA0: ; CODE XREF: Sub_001+84j
.text:00010BA0 ; Sub_001+130j
.text:00010BA0 mov edx, offset unk_1598A
.text:00010BA5 call sub_10837
.text:00010BAA test ebx, ebx
.text:00010BAC mov eax, [ebp+var_4]
.text:00010BAF jz loc_10AEF
.text:00010BB5 mov [ebx+4], eax
.text:00010BB8 jmp loc_10AEF
.text:00010BB8 Sub_001 endp
Thanks!