I study an analysis paper about a trojan and there are the following assembly lines:
.text:004010D0 Get_PE_section_address proc near
.text:004010D0
.text:004010D0 arg_0 = dword ptr 4
.text:004010D0
.text:004010D0 mov ecx, [esp+arg_0]
.text:004010D4 mov eax, [ecx+3Ch]
.text:004010D7 movzx edx, word ptr [eax+ecx+14h]
.text:004010DC add eax, ecx
.text:004010DE movzx ecx, word ptr [eax+6]
.text:004010E2 push ebx
.text:004010E3 add edx, eax
.text:004010E5 push esi
.text:004010E6 lea esi, [ecx+ecx*4]
.text:004010E9 lea eax, [edx+esi*8-38h]
.text:004010ED xor edx, edx
.text:004010EF test ecx, ecx
.text:004010F1 jbe short loc_401102
.text:004010F3
.text:004010F3 loc_4010F3:
.text:004010F3 mov bl, [eax+5]
.text:004010F6 test bl, bl
.text:004010F8 jz short loc_401104
.text:004010FA inc edx
.text:004010FB sub eax, 28h
.text:004010FE cmp edx, ecx
.text:00401100 jb short loc_4010F3
.text:00401102
.text:00401102 loc_401102:
.text:00401102 xor eax, eax
.text:00401104
.text:00401104 loc_401104:
.text:00401104 pop esi
.text:00401105 pop ebx
.text:00401106 retn
.text:00401106 Get_PE_section_address endp
As you can see, the owner of the paper renamed the function as Get_PE_section_address. I spent a lot of time to understand why he/she calls in that way because I could not understand why this piece of code retrieves the the PE section address.
So, my question would be if there is anyone who can tell me which lines tells us that this is something about PE section address.
PS: I tried to work with the offsets but with a low success rate. The only thing I can say is that ebx = pointer to the malicious executable and arg_0 = 0 After searching a while PE file format papers, i have found out that the second line
mov eax, [ecx+3Ch]
gives me the file address of the exe header.
best regards,