Function at 0x401586
Capabilities:
Get system information on windows
Parse pe header

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x2c
push ebx
push esi
push edi
push 0x40
push dword [ebp + 0xc]
xor edi, edi
call fcn.0040121e
test eax, eax
je 0x4017f8
mov esi, dword [ebp + 8]
mov eax, 0x5a4d
cmp word [esi], ax
jne 0x4017ed
mov eax, dword [esi + 0x3c]
add eax, 0xf8
push eax
push dword [ebp + 0xc]
call fcn.0040121e
test eax, eax
je 0x4017f8
mov ebx, dword [esi + 0x3c]
add ebx, esi
cmp dword [ebx], 0x4550
jne 0x4017ed
mov eax, 0x14c
cmp word [ebx + 4], ax
jne 0x4017ed
test byte [ebx + 0x38], 1
jne 0x4017ed
movzx eax, word [ebx + 0x14]
movzx edx, word [ebx + 6]
add eax, 0x24
test edx, edx
je 0x401625
lea ecx, [eax + ebx]
cmp dword [ecx + 4], 0
mov eax, dword [ebx + 0x38]
cmovne eax, dword [ecx + 4]
add eax, dword [ecx]
lea ecx, [ecx + 0x28]
cmp eax, edi
cmovbe eax, edi
mov edi, eax
sub edx, 1
jne 0x401609
lea eax, [ebp - 0x2c]
push eax
call dword [sym.imp.KERNEL32.dll_GetNativeSystemInfo]
mov ecx, dword [ebp - 0x28]
lea edx, [ecx - 1]
lea esi, [ecx - 1]
not edx
add esi, dword [ebx + 0x50]
lea eax, [ecx - 1]
add eax, edi
and esi, edx
and eax, edx
mov dword [ebp - 8], esi
cmp esi, eax
jne 0x4017ed
mov edi, dword [ebp + 0x24]
push edi
push 4
push 0x3000
push esi
push dword [ebx + 0x34]
call dword [ebp + 0x10]
mov esi, eax
mov dword [ebp - 4], esi
test esi, esi
jne 0x40168b
push edi
push 4
push 0x3000
push dword [ebp - 8]
push eax
call dword [ebp + 0x10]
mov esi, eax
mov dword [ebp - 4], eax
test esi, esi
jne 0x40168b
push 0xe
jmp 0x4017f2
push 0x40
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov edi, eax
test edi, edi
jne 0x4016b2
mov eax, dword [ebp + 0x24]
push eax
push 0x8000
push edi
push esi
call dword [ebp + 0x14]
jmp 0x401684
mov dword [edi + 4], esi
movzx eax, word [ebx + 0x16]
shr eax, 0xd
and eax, 1
mov dword [edi + 0x14], eax
mov eax, dword [ebp + 0x10]
mov dword [edi + 0x1c], eax
mov eax, dword [ebp + 0x14]
mov dword [edi + 0x20], eax
mov eax, dword [ebp + 0x18]
mov dword [edi + 0x24], eax
mov eax, dword [ebp + 0x1c]
mov dword [edi + 0x28], eax
mov eax, dword [ebp + 0x20]
mov dword [edi + 0x2c], eax
mov eax, dword [ebp + 0x24]
mov dword [edi + 0x34], eax
mov eax, dword [ebp - 0x28]
mov dword [edi + 0x3c], eax
push dword [ebx + 0x54]
push dword [ebp + 0xc]
call fcn.0040121e
test eax, eax
je 0x4017d3
push dword [ebp + 0x24]
push 4
push 0x1000
push dword [ebx + 0x54]
push esi
call dword [ebp + 0x10]
push dword [ebx + 0x54]
mov esi, eax
push dword [ebp + 8]
push esi
call fcn.0043d920
mov edx, dword [ebp + 8]
add esp, 0xc
mov eax, dword [edx + 0x3c]
add eax, esi
mov esi, dword [ebp - 4]
push edi
push dword [ebp + 0xc]
mov dword [edi], eax
push edx
mov dword [eax + 0x34], esi
call fcn.0040123c
test eax, eax
jne 0x4017d3
mov eax, dword [edi]
mov eax, dword [eax + 0x34]
sub eax, dword [ebx + 0x34]
je 0x401756
push eax
push edi
call fcn.00401801
jmp 0x401759
xor eax, eax
inc eax
push edi
mov dword [edi + 0x18], eax
call fcn.004010f0
test eax, eax
je 0x4017d3
push edi
call fcn.004012ad
test eax, eax
jne 0x4017d3
mov ecx, dword [edi]
mov eax, ecx
mov ebx, dword [ecx + 0xc0]
test ebx, ebx
je 0x4017ac
mov eax, dword [edi + 4]
mov dword [ebp + 0x24], eax
mov ebx, dword [ebx + eax + 0xc]
mov eax, ecx
test ebx, ebx
je 0x4017ac
mov edx, dword [ebx]
test edx, edx
je 0x4017ac
mov esi, dword [ebp + 0x24]
push 0
push 1
push esi
call edx
lea ebx, [ebx + 4]
mov edx, dword [ebx]
test edx, edx
jne 0x401797
mov eax, dword [edi]
mov esi, dword [ebp - 4]
mov eax, dword [eax + 0x28]
test eax, eax
je 0x4017e5
add eax, esi
cmp dword [edi + 0x14], 0
je 0x4017e0
push 0
xor ebx, ebx
inc ebx
push ebx
push esi
call eax
test eax, eax
jne 0x4017db
push 0x45a
call dword [sym.imp.KERNEL32.dll_SetLastError]
push edi
call fcn.004013b1
jmp 0x4017f8
mov dword [edi + 0x10], ebx
jmp 0x4017e9
mov dword [edi + 0x38], eax
jmp 0x4017e9
and dword [edi + 0x38], 0
mov eax, edi
jmp 0x4017fa
push 0xc1
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
pop edi
pop esi
pop ebx
leave
ret 0x20