Function at 0x406980
Capabilities:
Enumerate pe sections
Get system information on windows
Parse pe header

Disassembly:
mov ecx, dword [esp + 8]
sub esp, 0x24
push ebp
xor ebp, ebp
cmp ecx, 0x40
jae 0x40699e
push 0xd
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
pop ebp
add esp, 0x24
ret
mov eax, dword [esp + 0x2c]
mov edx, 0x5a4d
cmp word [eax], dx
je 0x4069be
push 0xc1
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
pop ebp
add esp, 0x24
ret
push ebx
mov ebx, dword [eax + 0x3c]
lea edx, [ebx + 0xf8]
cmp ecx, edx
jae 0x4069dc
push 0xd
call dword [sym.imp.KERNEL32.dll_SetLastError]
pop ebx
xor eax, eax
pop ebp
add esp, 0x24
ret
add ebx, eax
cmp dword [ebx], 0x4550
jne 0x4069f9
mov eax, 0x14c
cmp word [ebx + 4], ax
jne 0x4069f9
mov edx, dword [ebx + 0x38]
test dl, 1
je 0x406a0c
push 0xc1
call dword [sym.imp.KERNEL32.dll_SetLastError]
pop ebx
xor eax, eax
pop ebp
add esp, 0x24
ret
movzx eax, word [ebx + 6]
movzx ecx, word [ebx + 0x14]
push esi
push edi
lea ecx, [ecx + ebx + 0x18]
test eax, eax
jbe 0x406a40
lea esi, [ecx + 0xc]
mov edi, eax
mov ecx, dword [esi + 4]
mov eax, dword [esi]
test ecx, ecx
jne 0x406a30
add eax, edx
jmp 0x406a32
add eax, ecx
cmp eax, ebp
jbe 0x406a38
mov ebp, eax
add esi, 0x28
sub edi, 1
jne 0x406a23
lea edx, [esp + 0x10]
push edx
call dword [sym.imp.KERNEL32.dll_GetNativeSystemInfo]
mov ecx, dword [esp + 0x14]
mov edx, dword [ebx + 0x50]
lea eax, [ecx - 1]
lea esi, [edx + ecx - 1]
not eax
lea ecx, [ecx + ebp - 1]
and esi, eax
and ecx, eax
cmp esi, ecx
je 0x406a7c
push 0xc1
call dword [sym.imp.KERNEL32.dll_SetLastError]
pop edi
pop esi
pop ebx
xor eax, eax
pop ebp
add esp, 0x24
ret
mov edi, dword [esp + 0x54]
mov edx, dword [ebx + 0x34]
push edi
push 4
push 0x3000
push esi
push edx
call dword [esp + 0x54]
mov ebp, eax
add esp, 0x14
test ebp, ebp
jne 0x406ab1
push edi
push 4
push 0x3000
push esi
push eax
call dword [esp + 0x54]
mov ebp, eax
add esp, 0x14
test ebp, ebp
je 0x406ad7
push 0x40
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov esi, eax
test esi, esi
jne 0x406ae9
push edi
push 0x8000
push eax
push ebp
call dword [esp + 0x54]
add esp, 0x10
push 0xe
call dword [sym.imp.KERNEL32.dll_SetLastError]
pop edi
pop esi
pop ebx
xor eax, eax
pop ebp
add esp, 0x24
ret
mov ecx, dword [esp + 0x40]
mov edx, dword [esp + 0x44]
mov dword [esi + 4], ebp
movzx eax, word [ebx + 0x16]
shr eax, 0xd
and eax, 1
mov dword [esi + 0x14], eax
mov eax, dword [esp + 0x48]
mov dword [esi + 0x1c], ecx
mov ecx, dword [esp + 0x4c]
mov dword [esi + 0x20], edx
mov edx, dword [esp + 0x50]
mov dword [esi + 0x24], eax
mov dword [esi + 0x28], ecx
mov dword [esi + 0x2c], edx
mov dword [esi + 0x34], edi
mov eax, dword [esp + 0x14]
mov dword [esi + 0x3c], eax
mov ecx, dword [ebx + 0x54]
mov eax, dword [esp + 0x3c]
push ecx
call fcn.00406180
add esp, 4
test eax, eax
je 0x406bec
mov edx, dword [ebx + 0x54]
push edi
push 4
push 0x1000
push edx
push ebp
call dword [esp + 0x54]
mov ecx, dword [esp + 0x4c]
mov edi, eax
mov eax, dword [ebx + 0x54]
push eax
push ecx
push edi
call fcn.0040a8d0
mov eax, dword [esp + 0x58]
mov edx, dword [eax + 0x3c]
mov ecx, dword [esp + 0x5c]
add edi, edx
push ebx
mov dword [esi], edi
push ecx
mov dword [edi + 0x34], ebp
push eax
mov edi, esi
call fcn.004061a0
add esp, 0x2c
test eax, eax
je 0x406bec
mov edx, dword [esi]
mov eax, dword [edx + 0x34]
sub eax, dword [ebx + 0x34]
je 0x406b9d
push eax
mov eax, esi
call fcn.004064d0
add esp, 4
mov dword [esi + 0x18], eax
jmp 0x406ba4
mov dword [esi + 0x18], 1
call fcn.00406560
test eax, eax
je 0x406bec
push esi
call fcn.00406340
add esp, 4
test eax, eax
je 0x406bec
mov eax, esi
call fcn.00406490
test eax, eax
je 0x406bec
mov eax, dword [esi]
mov eax, dword [eax + 0x28]
test eax, eax
je 0x406c1d
add eax, ebp
cmp dword [esi + 0x14], 0
je 0x406c10
push 0
push 1
push ebp
call eax
test eax, eax
jne 0x406bff
push 0x45a
call dword [sym.imp.KERNEL32.dll_SetLastError]
push esi
call fcn.004068e0
add esp, 4
pop edi
pop esi
pop ebx
xor eax, eax
pop ebp
add esp, 0x24
ret
pop edi
mov dword [esi + 0x10], 1
mov eax, esi
pop esi
pop ebx
pop ebp
add esp, 0x24
ret
pop edi
mov dword [esi + 0x38], eax
mov eax, esi
pop esi
pop ebx
pop ebp
add esp, 0x24
ret
pop edi
mov dword [esi + 0x38], 0
mov eax, esi
pop esi
pop ebx
pop ebp
add esp, 0x24
ret