Function at 0x510270
Capabilities:
Enumerate pe sections
Parse pe header

Disassembly:
push ebp
mov ebp, esp
sub esp, 8
push ebx
mov ebx, dword [ebp + 8]
push esi
push edi
cmp word [ebx], 0x5a4d
je 0x510297
push 0xc1
call dword [sym.imp.KERNEL32.dll_SetLastError]
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebx + 0x3c]
mov esi, ebx
add esi, ecx
mov dword [ebp - 8], esi
cmp dword [esi], 0x4550
je 0x5102bd
push 0xc1
call dword [sym.imp.KERNEL32.dll_SetLastError]
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [esi + 0x50]
mov ecx, dword [esi + 0x34]
push 4
push 0x3000
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov edi, eax
test edi, edi
mov dword [ebp - 4], edi
jne 0x510308
mov edx, dword [esi + 0x50]
push 4
push 0x3000
push edx
push eax
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
test eax, eax
mov dword [ebp - 4], eax
jne 0x510305
push 0xe
call dword [sym.imp.KERNEL32.dll_SetLastError]
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
mov edi, dword [ebp - 4]
push 0x24
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov esi, eax
xor eax, eax
cmp esi, eax
jne 0x510340
push 0xe
call dword [sym.imp.KERNEL32.dll_SetLastError]
push 0x8000
push 0
push edi
call dword [sym.imp.KERNEL32.dll_VirtualFree]
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp + 0x10]
mov edx, dword [ebp + 0x14]
mov dword [esi + 0xc], eax
mov dword [esi + 8], eax
mov dword [esi + 0x10], eax
mov eax, dword [ebp + 0xc]
mov dword [esi + 0x14], eax
mov eax, dword [ebp + 0x18]
mov dword [esi + 0x18], ecx
mov ecx, dword [ebp - 8]
mov dword [esi + 4], edi
mov dword [esi + 0x1c], edx
mov dword [esi + 0x20], eax
mov edx, dword [ecx + 0x54]
push 4
push 0x1000
push edx
push edi
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov ecx, dword [ebp - 8]
mov dword [ebp + 0xc], eax
mov edx, dword [ecx + 0x54]
mov ecx, dword [ebx + 0x3c]
add edx, ecx
push edx
push ebx
push eax
call fcn.0050ae90
mov eax, dword [ebx + 0x3c]
mov ecx, dword [ebp + 0xc]
add eax, ecx
xor ecx, ecx
mov dword [esi], eax
add esp, 0xc
mov dword [eax + 0x34], edi
mov eax, dword [esi]
mov edx, dword [esi + 4]
mov dword [ebp + 0x10], 0
mov cx, word [eax + 0x14]
cmp word [eax + 6], 0
mov dword [ebp + 0xc], edx
lea ecx, [ecx + eax + 0x18]
jbe 0x510417
lea edi, [ecx + 0x10]
cmp dword [edi], 0
jne 0x510497
mov edx, dword [ebp - 8]
mov ebx, dword [edx + 0x38]
test ebx, ebx
jle 0x5103fb
mov eax, dword [edi - 4]
mov ecx, dword [ebp + 0xc]
push 4
push 0x1000
add eax, ecx
push ebx
push eax
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
push ebx
push 0
push eax
mov dword [edi - 8], eax
call fcn.0050aec0
add esp, 0xc
mov ebx, dword [ebp + 8]
mov ecx, dword [esi]
mov eax, dword [ebp + 0x10]
xor edx, edx
inc eax
mov dx, word [ecx + 6]
add edi, 0x28
cmp eax, edx
mov dword [ebp + 0x10], eax
jl 0x5103c2
mov edi, dword [ebp - 4]
mov ecx, dword [ebp - 8]
mov eax, edi
sub eax, dword [ecx + 0x34]
mov dword [ebp + 8], eax
je 0x510503
mov eax, dword [esi]
mov ecx, dword [esi + 4]
add eax, 0xa0
mov dword [ebp + 0x10], ecx
mov edx, dword [eax + 4]
test edx, edx
jbe 0x510503
mov edi, dword [eax]
add edi, ecx
mov edx, dword [edi]
test edx, edx
jbe 0x510500
mov eax, dword [edi + 4]
add edx, ecx
sub eax, 8
lea ebx, [edi + 8]
test eax, 0xfffffffe
mov dword [ebp + 0xc], 0
jbe 0x5104f3
xor ecx, ecx
mov cx, word [ebx]
mov eax, ecx
shr ecx, 0xc
and eax, 0xfff
cmp ecx, 3
je 0x5104d0
cmp ecx, 0xa
jne 0x5104d6
mov ecx, dword [ebp + 8]
add dword [eax + edx], ecx
mov ecx, dword [eax + edx + 4]
adc ecx, 0
mov dword [eax + edx + 4], ecx
jmp 0x5104d6
mov ecx, dword [edi]
mov edx, dword [edi - 4]
push 4
push 0x1000
push ecx
mov ecx, dword [ebp + 0xc]
add edx, ecx
push edx
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov edx, dword [edi + 4]
mov ecx, dword [edi]
add edx, ebx
push ecx
push edx
push eax
mov dword [ebp + 0x14], eax
call fcn.0050ae90
mov eax, dword [ebp + 0x14]
add esp, 0xc
mov dword [edi - 8], eax
jmp 0x5103fe
mov ecx, dword [ebp + 8]
add dword [eax + edx], ecx
mov ecx, dword [edi + 4]
mov eax, dword [ebp + 0xc]
sub ecx, 8
inc eax
shr ecx, 1
add ebx, 2
cmp eax, ecx
mov dword [ebp + 0xc], eax
jb 0x51046b
mov ecx, dword [ebp + 0x10]
add edi, dword [edi + 4]
mov edx, dword [edi]
test edx, edx
ja 0x51044e
mov edi, dword [ebp - 4]
mov eax, dword [esi]
mov ebx, dword [esi + 4]
add eax, 0x80
mov dword [ebp + 8], ebx
mov ecx, dword [eax + 4]
test ecx, ecx
jbe 0x510662
mov ecx, dword [eax]
push 0x14
add ebx, ecx
push ebx
mov dword [ebp + 0xc], ebx
call dword [sym.imp.KERNEL32.dll_IsBadReadPtr]
test eax, eax
jne 0x510662
mov eax, dword [ebx + 0xc]
test eax, eax
je 0x510662
mov ecx, dword [ebp + 8]
mov edx, dword [esi + 0x20]
add eax, ecx
push edx
push eax
call dword [esi + 0x14]
mov edi, eax
add esp, 8
test edi, edi
mov dword [ebp + 0x10], edi
je 0x51064f
mov eax, dword [esi + 8]
test eax, eax
jne 0x51057e
mov edx, dword [esi + 0xc]
lea eax, [edx*4 + 4]
push eax
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
jmp 0x510599
mov ecx, dword [esi + 0xc]
lea edx, [ecx*4 + 4]
push edx
push eax
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapReAlloc]
test eax, eax
je 0x510653
mov ecx, dword [esi + 0xc]
mov dword [esi + 8], eax
mov dword [eax + ecx*4], edi
mov edx, dword [esi + 0xc]
inc edx
mov dword [esi + 0xc], edx
mov eax, dword [ebx]
test eax, eax
je 0x5105c9
mov edx, dword [ebp + 8]
lea ebx, [eax + edx]
mov eax, dword [ebp + 0xc]
mov edi, dword [eax + 0x10]
mov eax, edx
add edi, eax
jmp 0x5105d4
mov ecx, dword [ebx + 0x10]
mov edx, dword [ebp + 8]
lea ebx, [ecx + edx]
mov edi, ebx
mov eax, dword [ebx]
test eax, eax
je 0x510616
mov ecx, dword [esi + 0x20]
test eax, 0x80000000
push ecx
je 0x5105f1
mov edx, dword [ebp + 0x10]
and eax, 0xffff
push eax
push edx
jmp 0x5105fd
mov edx, dword [ebp + 8]
mov ecx, dword [ebp + 0x10]
lea eax, [eax + edx + 2]
push eax
push ecx
call dword [esi + 0x18]
add esp, 0xc
mov dword [edi], eax
test eax, eax
je 0x510637
mov eax, dword [ebx + 4]
add ebx, 4
add edi, 4
test eax, eax
jne 0x5105da
mov eax, dword [ebp + 0xc]
push 0x14
add eax, 0x14
push eax
mov dword [ebp + 0xc], eax
call dword [sym.imp.KERNEL32.dll_IsBadReadPtr]
mov edi, dword [ebp - 4]
test eax, eax
jne 0x510662
mov ebx, dword [ebp + 0xc]
jmp 0x510533
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov eax, dword [esi + 0x20]
mov ecx, dword [ebp + 0x10]
push eax
push ecx
call dword [esi + 0x1c]
add esp, 8
push 0x7f
jmp 0x510686
push 0x7e
jmp 0x510686
mov edx, dword [esi + 0x20]
push edx
push edi
call dword [esi + 0x1c]
add esp, 8
push 0xe
jmp 0x510686
push esi
call fcn.005106b0
mov edx, dword [esi]
add esp, 4
mov eax, dword [edx + 0x28]
test eax, eax
je 0x5106a5
push 0
push 1
add eax, edi
push edi
call eax
test eax, eax
jne 0x51069e
push 0x45a
call dword [sym.imp.KERNEL32.dll_SetLastError]
push esi
call fcn.00510830
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov dword [esi + 0x10], 1
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret