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

Disassembly:
push ebp
mov ebp, esp
mov edx, dword [ebp + 0xc]
sub esp, 0x2c
push ebx
push esi
xor esi, esi
push edi
cmp edx, 0x40
jb 0x401571
mov ecx, dword [ebp + 8]
mov eax, 0x5a4d
cmp word [ecx], ax
jne 0x4019ad
mov edi, dword [ecx + 0x3c]
lea eax, [edi + 0xf8]
cmp edx, eax
jae 0x401584
push 0xd
call dword [sym.imp.KERNEL32.dll_SetLastError]
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret 0x20
cmp dword [edi + ecx], 0x4550
lea ebx, [edi + ecx]
jne 0x4019ad
mov eax, 0x14c
cmp word [ebx + 4], ax
jne 0x4019ad
mov ecx, dword [ebx + 0x38]
test cl, 1
jne 0x4019ad
movzx edx, word [ebx + 0x14]
movzx edi, word [ebx + 6]
add edx, 0x24
test edi, edi
je 0x4015dd
add edx, ebx
mov eax, dword [edx + 4]
lea edx, [edx + 0x28]
test eax, eax
cmovne ecx, eax
add ecx, dword [edx - 0x28]
cmp ecx, esi
cmovbe ecx, esi
mov esi, ecx
mov ecx, dword [ebx + 0x38]
sub edi, 1
jne 0x4015c0
lea eax, [ebp - 0x2c]
push eax
call dword [sym.imp.KERNEL32.dll_GetNativeSystemInfo]
mov ecx, dword [ebp - 0x28]
lea edx, [ecx - 1]
lea edi, [ecx - 1]
not edx
add edi, dword [ebx + 0x50]
lea eax, [ecx - 1]
add eax, esi
and edi, edx
and eax, edx
cmp edi, eax
jne 0x4019ad
mov esi, dword [ebp + 0x24]
push esi
push 4
push 0x3000
push edi
push dword [ebx + 0x34]
call dword [ebp + 0x10]
mov dword [ebp + 0x24], eax
test eax, eax
jne 0x401633
push esi
push 4
push 0x3000
push edi
push eax
call dword [ebp + 0x10]
mov dword [ebp + 0x24], eax
test eax, eax
je 0x40165f
mov eax, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push 0x40
push 8
mov dword [ebp - 8], eax
call eax
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ecx, dword [ebp + 0x24]
mov edi, eax
mov dword [ebp - 4], edi
test edi, edi
jne 0x401672
push esi
push 0x8000
push eax
push ecx
call dword [ebp + 0x14]
push 0xe
call dword [sym.imp.KERNEL32.dll_SetLastError]
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret 0x20
mov dword [edi + 4], ecx
movzx eax, word [ebx + 0x16]
shr eax, 0xd
and eax, 1
mov dword [edi + 0x34], esi
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 - 0x28]
mov dword [edi + 0x3c], eax
push dword [ebx + 0x54]
push dword [ebp + 0xc]
call fcn.00401320
test eax, eax
je 0x4018f7
push esi
push 4
push 0x1000
push dword [ebx + 0x54]
push dword [ebp + 0x24]
call dword [ebp + 0x10]
push dword [ebx + 0x54]
mov esi, eax
push dword [ebp + 8]
push esi
call fcn.0044b7f0
mov eax, dword [ebp + 8]
add esp, 0xc
mov ecx, dword [ebp + 0x24]
mov dword [ebp + 0x10], 0
mov eax, dword [eax + 0x3c]
add eax, esi
mov dword [edi], eax
mov dword [eax + 0x34], ecx
xor eax, eax
mov ecx, dword [edi]
movzx esi, word [ecx + 0x14]
add esi, 0x28
cmp ax, word [ecx + 6]
jae 0x401758
add esi, ecx
mov eax, dword [esi + 4]
mov edx, dword [esi]
add eax, edx
mov ecx, dword [edi + 0x3c]
cmp dword [ebp + 0xc], eax
jb 0x4018f7
mov eax, dword [esi - 8]
dec eax
add eax, ecx
neg ecx
and eax, ecx
cmp edx, eax
ja 0x4018f7
mov eax, dword [esi + 4]
add eax, dword [ebp + 8]
push edx
push eax
mov eax, dword [esi - 4]
add eax, dword [edi + 4]
push eax
call fcn.0044b7f0
mov ecx, dword [edi]
add esp, 0xc
mov edx, dword [ebp + 0x10]
add esi, 0x28
inc edx
mov dword [ebp + 0x10], edx
movzx eax, word [ecx + 6]
cmp edx, eax
jl 0x401708
mov eax, dword [ecx + 0x34]
sub eax, dword [ebx + 0x34]
mov dword [ebp + 8], eax
je 0x4017dd
cmp dword [ecx + 0xa4], 0
jne 0x401770
xor eax, eax
jmp 0x4017e2
mov edx, dword [edi + 4]
mov ebx, dword [ecx + 0xa0]
add ebx, edx
mov dword [ebp + 0xc], edx
mov eax, dword [ebx]
test eax, eax
je 0x4017dd
mov ecx, dword [ebx + 4]
add eax, edx
mov dword [ebp + 0x10], eax
lea edx, [ebx + 8]
xor esi, esi
lea eax, [ecx - 8]
test eax, 0xfffffffe
jbe 0x4017ce
mov edi, dword [ebp + 0x10]
nop
movzx eax, word [edx]
mov ecx, eax
and ecx, 0xf000
cmp ecx, 0x3000
jne 0x4017be
mov ecx, dword [ebp + 8]
and eax, 0xfff
add dword [eax + edi], ecx
mov ecx, dword [ebx + 4]
inc esi
add edx, 2
lea eax, [ecx - 8]
shr eax, 1
cmp esi, eax
jb 0x4017a0
mov eax, dword [ebx + ecx]
add ebx, ecx
mov edx, dword [ebp + 0xc]
test eax, eax
jne 0x401784
mov edi, dword [ebp - 4]
mov eax, 1
push edi
mov dword [edi + 0x18], eax
call fcn.004011c0
test eax, eax
je 0x4018f7
mov eax, dword [edi]
xor ecx, ecx
xor edx, edx
mov dword [ebp + 0x10], ecx
movzx esi, word [eax + 0x14]
add esi, 0x3c
cmp dx, word [eax + 6]
jae 0x40188f
add esi, eax
nop
cmp dword [esi - 0x1c], 0
je 0x401872
mov ebx, dword [esi]
mov eax, ebx
mov ecx, ebx
shr eax, 0x1d
shr ecx, 0x1e
mov edx, ebx
and eax, 1
shr edx, 0x1f
and ecx, 1
test bl, 0x20
je 0x401839
mov eax, 1
mov ecx, eax
lea eax, [ecx + eax*2]
lea eax, [edx + eax*2]
mov edx, dword [esi - 0x18]
mov ecx, dword [eax*4 + 0x77d614]
lea eax, [ebp + 8]
add edx, dword [edi + 4]
push eax
mov eax, ecx
or eax, 0x200
and ebx, 0x4000000
cmove eax, ecx
push eax
push dword [esi - 0x1c]
push edx
call dword [sym.imp.KERNEL32.dll_VirtualProtect]
test eax, eax
je 0x401885
mov ecx, dword [ebp + 0x10]
mov eax, dword [edi]
inc ecx
add esi, 0x28
mov dword [ebp + 0x10], ecx
movzx eax, word [eax + 6]
cmp ecx, eax
jl 0x401810
jmp 0x40188f
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x4018f7
mov edx, dword [edi]
mov ecx, edx
mov esi, dword [edx + 0xc0]
test esi, esi
je 0x4018c3
mov ebx, dword [edi + 4]
mov esi, dword [ebx + esi + 0xc]
test esi, esi
je 0x4018c3
mov eax, dword [esi]
test eax, eax
je 0x4018c3
nop
push 0
push 1
push ebx
call eax
mov eax, dword [esi + 4]
lea esi, [esi + 4]
test eax, eax
jne 0x4018b0
mov ecx, dword [edi]
mov eax, dword [ecx + 0x28]
test eax, eax
je 0x40199b
mov ecx, dword [ebp + 0x24]
add eax, ecx
cmp dword [edi + 0x14], 0
je 0x40198d
push 0
push 1
push ecx
call eax
test eax, eax
jne 0x40197b
push 0x45a
call dword [sym.imp.KERNEL32.dll_SetLastError]
cmp dword [edi + 0x10], 0
je 0x40190e
mov eax, dword [edi]
mov ecx, dword [edi + 4]
push 0
push 0
mov eax, dword [eax + 0x28]
push ecx
add eax, ecx
call eax
push dword [edi + 0x30]
call fcn.0044dde5
mov eax, dword [edi + 8]
add esp, 4
test eax, eax
je 0x40194c
xor esi, esi
cmp dword [edi + 0xc], esi
jle 0x401943
mov eax, dword [edi + 8]
mov ecx, dword [eax + esi*4]
test ecx, ecx
je 0x40193d
push dword [edi + 0x34]
mov eax, dword [edi + 0x2c]
push ecx
call eax
mov eax, dword [edi + 8]
inc esi
cmp esi, dword [edi + 0xc]
jl 0x401927
push eax
call fcn.0044dde5
add esp, 4
mov eax, dword [edi + 4]
test eax, eax
je 0x401963
push dword [edi + 0x34]
push 0x8000
push 0
push eax
mov eax, dword [edi + 0x20]
call eax
push edi
push 0
call dword [ebp - 8]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret 0x20
mov dword [edi + 0x10], 1
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0x20
mov dword [edi + 0x38], eax
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0x20
mov dword [edi + 0x38], 0
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0x20
push 0xc1
call dword [sym.imp.KERNEL32.dll_SetLastError]
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret 0x20