Function at 0x4051f2
Capabilities:
Access peb ldr_data
Check os version
Parse pe header
Resolve function by parsing pe exports

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x54
push esi
push edi
mov ecx, dword fs:[0x30]
mov ecx, dword [ecx + 0xc]
mov ecx, dword [ecx + 0x14]
mov dword [ebp - 0x20], ecx
mov edx, dword [ebp - 0x20]
mov edi, edx
test edi, edi
je 0x405297
mov ecx, edi
mov eax, dword [ecx + 0x28]
movzx esi, word [eax]
cmp esi, 0x4b
je 0x4052a9
cmp esi, 0x6b
jne 0x405234
cmp word [eax + 2], 0x45
je 0x4052a9
cmp word [eax + 2], 0x65
jne 0x405242
cmp word [eax + 4], 0x52
je 0x4052a9
cmp word [eax + 4], 0x72
jne 0x405250
cmp word [eax + 6], 0x4e
je 0x4052a9
cmp word [eax + 6], 0x6e
jne 0x40525e
cmp word [eax + 8], 0x45
je 0x4052a9
cmp word [eax + 8], 0x65
jne 0x40526c
cmp word [eax + 0xa], 0x6c
je 0x4052a9
cmp word [eax + 0xa], 0x4c
jne 0x405288
cmp word [eax + 0xc], 0x33
jne 0x405288
cmp word [eax + 0xe], 0x32
jne 0x405288
cmp word [eax + 0x10], 0x2e
je 0x4052a9
mov edx, dword [edx]
mov ecx, edx
mov dword [ebp - 0x20], edx
cmp edi, ecx
je 0x405297
test ecx, ecx
jne 0x405219
mov edi, dword [ebp + 0xc]
test edi, edi
jne 0x4052ae
pop edi
or eax, 0xffffffff
pop esi
mov esp, ebp
pop ebp
ret 0xc
mov edi, dword [ecx + 0x10]
jmp 0x40529a
mov eax, dword [edi + 0x3c]
xor esi, esi
push ebx
mov eax, dword [eax + edi + 0x78]
mov ebx, dword [eax + edi + 0x1c]
mov edx, dword [eax + edi + 0x20]
add ebx, edi
mov ecx, dword [eax + edi + 0x24]
add edx, edi
mov eax, dword [eax + edi + 0x18]
add ecx, edi
mov dword [ebp - 0x2c], edx
mov dword [ebp - 0x34], ecx
mov dword [ebp - 0x30], eax
test eax, eax
jle 0x405440
mov dword [ebp - 0x38], 3
mov eax, dword [edx + esi*4]
or ecx, 0xffffffff
mov edx, dword [eax + edi]
add eax, edi
cmp edx, 0x64616f4c
jne 0x405324
cmp dword [eax + 4], 0x7262694c
jne 0x405433
cmp dword [eax + 8], 0x41797261
jne 0x405433
cmp byte [eax + 0xc], 0
jne 0x405433
xor ecx, ecx
jmp 0x405423
cmp edx, 0x50746547
jne 0x405369
cmp dword [eax + 4], 0x41636f72
jne 0x405433
cmp dword [eax + 8], 0x65726464
jne 0x405433
mov ecx, 0x7373
cmp word [eax + 0xc], cx
jne 0x405433
cmp byte [eax + 0xe], 0
jne 0x405433
mov ecx, 1
jmp 0x405423
cmp edx, 0x4d6c7452
jne 0x4053a0
cmp dword [eax + 4], 0x4d65766f
jne 0x405433
cmp dword [eax + 8], 0x726f6d65
jne 0x405433
cmp word [eax + 0xc], 0x79
jne 0x405433
mov ecx, 2
jmp 0x405423
cmp edx, 0x74726956
jne 0x4053e3
mov edx, dword [eax + 4]
cmp edx, 0x416c6175
jne 0x4053c4
cmp dword [eax + 8], 0x636f6c6c
jne 0x4053c4
cmp byte [eax + 0xc], 0
cmove ecx, dword [ebp - 0x38]
cmp edx, 0x466c6175
jne 0x4053dc
cmp dword [eax + 8], 0x656572
jne 0x4053dc
mov ecx, 4
jmp 0x405423
cmp ecx, 0xffffffff
je 0x405433
jmp 0x405423
cmp edx, 0x4d746547
jne 0x405433
cmp dword [eax + 4], 0x6c75646f
jne 0x405433
cmp dword [eax + 8], 0x6c694665
jne 0x405433
cmp dword [eax + 0xc], 0x6d614e65
jne 0x405433
cmp byte [eax + 0x10], 0x65
jne 0x405433
mov al, byte [eax + 0x11]
cmp al, 0x41
jne 0x40541a
mov ecx, 5
jmp 0x405423
cmp al, 0x57
jne 0x405433
mov ecx, 6
mov eax, dword [ebp - 0x34]
movzx eax, word [eax + esi*2]
mov eax, dword [ebx + eax*4]
add eax, edi
mov dword [ebp + ecx*4 - 0x54], eax
mov edx, dword [ebp - 0x2c]
inc esi
cmp esi, dword [ebp - 0x30]
jl 0x4052e6
mov eax, dword [ebp - 0x48]
push 0x40
push 0x1000
push 8
push 0
mov dword [ebp - 0xc], eax
call eax
mov esi, eax
mov eax, dword [ebp - 0x54]
push esi
mov dword [ebp - 0x28], eax
mov dword [esi], 0x4c44544e
mov dword [esi + 4], 0x4c
call eax
mov ebx, dword [ebp - 0x44]
mov edi, eax
push 0x8000
push 8
push esi
mov dword [ebp - 0x1c], ebx
call ebx
test edi, edi
je 0x40594e
cmp dword [ebp - 0x28], 0
je 0x40594e
mov ecx, dword [ebp - 0x50]
mov dword [ebp - 0x2c], ecx
test ecx, ecx
je 0x40594e
mov esi, dword [ebp - 0x4c]
mov dword [ebp - 0x10], esi
test esi, esi
je 0x40594e
mov edx, dword [ebp - 0xc]
test edx, edx
je 0x40594e
test ebx, ebx
je 0x40594e
mov eax, dword [ebp - 0x40]
mov dword [ebp - 0x34], eax
test eax, eax
je 0x40594e
mov eax, dword [ebp - 0x3c]
mov dword [ebp - 0x38], eax
test eax, eax
je 0x40594e
movzx eax, word [esi]
mov ebx, 0x544e
cmp ax, bx
je 0x4054f1
mov ebx, 0x746e
cmp ax, bx
jne 0x405508
lea eax, [esi + 6]
push eax
push edi
call ecx
mov esi, eax
mov dword [ebp - 0x10], esi
test esi, esi
je 0x40594e
mov edx, dword [ebp - 0xc]
mov ebx, dword [ebp + 8]
mov eax, 0x5a4d
cmp word [ebx], ax
jne 0x405943
mov edi, dword [ebx + 0x3c]
add edi, ebx
cmp dword [edi], 0x4550
jne 0x405943
test byte [edi + 0x38], 1
jne 0x405943
cmp dword [ebp + 0xc], 3
jne 0x405567
mov eax, dword [edi + 0x28]
push 0
push 0
add eax, ebx
push ebx
call eax
test eax, eax
je 0x405943
push 0x8000
push 0
push ebx
call dword [ebp - 0x1c]
pop ebx
pop edi
mov eax, 1
pop esi
mov esp, ebp
pop ebp
ret 0xc
mov eax, dword [edi + 0x50]
add eax, 0xfff
push 0x40
and eax, 0xfffff000
add eax, 0x1000
push 0x1000
push eax
push dword [edi + 0x34]
mov dword [ebp - 0x18], eax
call edx
mov ecx, eax
mov dword [ebp - 4], ecx
test ecx, ecx
jne 0x4055ad
push 0x40
push 0x1000
push dword [ebp - 0x18]
push eax
call dword [ebp - 0xc]
mov ecx, eax
mov dword [ebp - 4], eax
test ecx, ecx
je 0x405943
xor eax, eax
xor edx, edx
cmp dword [ebp + 0xc], 1
mov dword [ebp - 0x30], eax
mov dword [ebp - 0x14], edx
jne 0x40568f
mov eax, dword [ebp - 0x18]
mov esi, dword [ebp - 0x34]
add eax, 0xfffff000
add eax, ecx
lea edx, [eax + 0x44]
mov dword [ebp - 0x30], eax
mov dword [ebp - 0x14], edx
mov dword [eax], 0xb8
mov dword [eax + 4], 0x247c8100
mov dword [eax + 8], 4
mov dword [eax + 0xc], 0xff1c7500
mov dword [eax + 0x10], 0xff0c2474
mov dword [eax + 0x14], 0x6a0c2474
mov dword [eax + 0x18], 0x8bd0ff00
mov dword [eax + 0x1c], 0xc708244c
mov dword [eax + 0x20], 0x2e01
mov dword [eax + 0x24], 0x1c08300
mov dword [eax + 0x28], 0xff000cc2
mov dword [eax + 0x2c], 0x909090e0
mov dword [edx], 0xb8
mov dword [edx + 4], 0x247c8100
mov dword [edx + 8], 4
mov dword [edx + 0xc], 0xff1c7500
mov dword [edx + 0x10], 0xff0c2474
mov dword [edx + 0x14], 0x6a0c2474
mov dword [edx + 0x18], 0x8bd0ff00
mov dword [edx + 0x1c], 0xc708244c
mov dword [edx + 0x20], 0x2e01
mov dword [edx + 0x24], 0x1c08300
mov dword [edx + 0x28], 0xff000cc2
mov dword [edx + 0x2c], 0x909090e0
mov dword [eax + 1], esi
mov esi, dword [ebp - 0x10]
mov dword [eax + 9], ecx
mov eax, dword [ebp - 0x38]
mov dword [edx + 1], eax
mov dword [edx + 9], ecx
push 0x1000
push ebx
push ecx
call esi
mov ecx, dword [ebp - 4]
xor ebx, ebx
xor edx, edx
mov eax, ecx
mov dword [ebp - 0x24], edx
mov esi, dword [ecx + 0x3c]
add esi, ecx
mov dword [ebp - 8], esi
mov dword [esi + 0x34], ecx
cmp bx, word [esi + 6]
mov ebx, dword [ebp + 8]
jae 0x40572c
xor esi, esi
nop dword [eax + eax]
mov eax, dword [ebp - 8]
mov ecx, dword [eax + esi + 0x104]
add ecx, dword [ebp - 4]
mov eax, dword [eax + esi + 0x108]
mov dword [ebp + 8], ecx
test eax, eax
jne 0x4056ef
cmp dword [edi + 0x38], 0
mov eax, dword [ebp - 8]
jbe 0x405714
mov dword [eax + esi + 0x100], ecx
jmp 0x405714
push eax
mov eax, dword [ebp - 8]
mov eax, dword [eax + esi + 0x10c]
add eax, ebx
push eax
push ecx
call dword [ebp - 0x10]
mov edx, dword [ebp - 8]
mov eax, dword [ebp + 8]
mov dword [edx + esi + 0x100], eax
mov edx, dword [ebp - 0x24]
mov eax, dword [ebp - 8]
movzx eax, word [eax + 6]
inc edx
add esi, 0x28
mov dword [ebp - 0x24], edx
cmp edx, eax
jb 0x4056c2
mov esi, dword [ebp - 8]
mov ecx, dword [ebp - 4]
mov eax, dword [esi + 0x34]
sub eax, dword [edi + 0x34]
mov dword [ebp + 8], eax
je 0x4057de
mov eax, dword [esi + 0xa0]
test eax, eax
je 0x4057bd
cmp dword [esi + 0xa4], 0
je 0x4057bd
lea ebx, [eax + ecx]
mov eax, dword [ebx]
test eax, eax
je 0x4057b6
mov edx, dword [ebx + 4]
lea esi, [ebx + 8]
add eax, ecx
xor edi, edi
mov dword [ebp - 0x24], eax
lea eax, [edx - 8]
test eax, 0xfffffffe
jbe 0x4057aa
nop dword [eax]
movzx ecx, word [esi]
mov ax, cx
and ecx, 0xfff
add ecx, dword [ebp - 0x24]
shr ax, 0xc
movzx eax, ax
cmp eax, 3
je 0x405792
cmp eax, 0xa
jne 0x4057a7
mov eax, dword [ebp + 8]
inc edi
add dword [ecx], eax
add esi, 2
mov edx, dword [ebx + 4]
lea eax, [edx - 8]
shr eax, 1
cmp edi, eax
jb 0x405772
mov ecx, dword [ebp - 4]
mov eax, dword [ebx + edx]
add ebx, edx
test eax, eax
jne 0x405754
mov esi, dword [ebp - 8]
xor edx, edx
mov dword [ebp + 8], edx
jmp 0x4057e1
mov dword [ebp + 8], 0xfffffffd
push 0x8000
push dword [ebp - 0x18]
push dword [ebp - 4]
call dword [ebp - 0x1c]
mov eax, dword [ebp + 8]
pop ebx
pop edi
pop esi
mov esp, ebp
pop ebp
ret 0xc
mov edx, dword [ebp + 8]
cmp dword [esi + 0x84], 0
je 0x405915
mov edi, dword [esi + 0x80]
add edi, ecx
mov dword [ebp - 0x24], edi
mov eax, dword [edi + 0xc]
test eax, eax
je 0x405915
mov ebx, dword [ebp + 0x10]
add eax, ecx
push eax
call dword [ebp - 0x28]
mov edx, eax
mov dword [ebp + 0x10], edx
test edx, edx
je 0x405909
mov ecx, dword [edi + 0x10]
mov esi, dword [ebp - 4]
mov edi, dword [edi]
add esi, ecx
test edi, edi
cmove edi, ecx
mov ecx, dword [ebp - 4]
add edi, ecx
mov eax, dword [edi]
test eax, eax
je 0x405889
jns 0x40583b
movzx eax, ax
jmp 0x405840
add ecx, 2
add eax, ecx
push eax
push edx
call dword [ebp - 0x2c]
mov dword [esi], eax
test eax, eax
je 0x405909
test ebx, ebx
je 0x405856
push esi
call ebx
mov ecx, dword [ebp - 0x30]
mov edx, dword [ebp - 0x14]
test ecx, ecx
jne 0x405864
test edx, edx
je 0x405876
mov eax, dword [esi]
cmp eax, dword [ebp - 0x34]
jne 0x40586f
mov dword [esi], ecx
mov eax, ecx
cmp eax, dword [ebp - 0x38]
jne 0x405876
mov dword [esi], edx
mov eax, dword [edi + 4]
add edi, 4
mov edx, dword [ebp + 0x10]
add esi, 4
mov ecx, dword [ebp - 4]
test eax, eax
jne 0x405834
cmp dword [ebp + 8], 0
jne 0x4057c4
mov edi, dword [ebp - 0x24]
add edi, 0x14
mov dword [ebp - 0x24], edi
mov eax, dword [edi + 0xc]
test eax, eax
jne 0x405807
mov esi, dword [ebp - 8]
mov esi, dword [esi + 0xc0]
test esi, esi
je 0x4058d6
mov esi, dword [esi + ecx + 0xc]
test esi, esi
je 0x4058d6
mov eax, dword [esi]
test eax, eax
je 0x4058d6
push 0
push 1
push ecx
call eax
mov eax, dword [esi + 4]
lea esi, [esi + 4]
mov ecx, dword [ebp - 4]
test eax, eax
jne 0x4058c2
push 0x40
push 0x1000
push 0xff
push 0
call dword [ebp - 0xc]
push 0x8000
push 0xff
push eax
call dword [ebp - 0x1c]
mov ecx, dword [ebp + 0xc]
cmp ecx, 2
jne 0x40591f
mov eax, dword [ebp - 4]
pop ebx
pop edi
pop esi
mov esp, ebp
pop ebp
ret 0xc
mov dword [ebp + 8], 0xfffffffc
jmp 0x4057c4
test edx, edx
jne 0x4057c4
jmp 0x4058aa
mov ebx, dword [ebp - 4]
xor eax, eax
push 0
test ecx, ecx
push 1
cmovne eax, ebx
push eax
mov eax, dword [ebp - 8]
mov eax, dword [eax + 0x28]
add eax, ebx
call eax
mov eax, ebx
pop ebx
pop edi
pop esi
mov esp, ebp
pop ebp
ret 0xc
pop ebx
pop edi
xor eax, eax
pop esi
mov esp, ebp
pop ebp
ret 0xc
pop ebx
pop edi
mov eax, 0xfffffffe
pop esi
mov esp, ebp
pop ebp
ret 0xc