Function at 0x40650b
Capabilities:
Check os version
Resolve function by parsing pe exports

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x18c
mov eax, dword [0x409034]
xor eax, esp
mov dword [esp + 0x188], eax
push ebx
mov ebx, ecx
mov dword [esp + 0xc], ebx
push esi
push edi
test ebx, ebx
je 0x406a67
xor eax, eax
lea edi, [esp + 0xb8]
push 6
pop esi
mov ecx, esi
mov edx, 0x1000
rep stosd dword es:[edi], eax
mov eax, dword fs:[0x30]
lea edi, [esp + 0xa0]
mov ecx, esi
mov dword [esp + 0xc4], edx
mov eax, dword [eax + 0x18]
mov dword [esp + 0xb8], eax
xor eax, eax
rep stosd dword es:[edi], eax
mov eax, dword fs:[0x30]
lea edi, [esp + 0x88]
mov ecx, esi
mov dword [esp + 0xac], edx
mov eax, dword [eax + 0x18]
mov dword [esp + 0xa0], eax
xor eax, eax
rep stosd dword es:[edi], eax
mov eax, dword fs:[0x30]
lea edi, [esp + 0x70]
mov ecx, esi
mov dword [esp + 0x94], edx
mov eax, dword [eax + 0x18]
mov dword [esp + 0x88], eax
xor eax, eax
rep stosd dword es:[edi], eax
mov eax, dword fs:[0x30]
lea edi, [esp + 0x58]
mov ecx, esi
mov dword [esp + 0x7c], edx
mov eax, dword [eax + 0x18]
mov dword [esp + 0x70], eax
xor eax, eax
rep stosd dword es:[edi], eax
mov eax, dword fs:[0x30]
lea edi, [esp + 0x40]
mov ecx, esi
mov dword [esp + 0x64], edx
mov eax, dword [eax + 0x18]
mov dword [esp + 0x58], eax
xor eax, eax
rep stosd dword es:[edi], eax
mov eax, dword fs:[0x30]
lea edi, [esp + 0x28]
mov ecx, esi
mov dword [esp + 0x4c], edx
mov eax, dword [eax + 0x18]
mov dword [esp + 0x40], eax
xor eax, eax
rep stosd dword es:[edi], eax
mov eax, dword fs:[0x30]
mov dword [esp + 0x34], edx
mov eax, dword [eax + 0x18]
mov dword [esp + 0x28], eax
lea eax, [ebx + 0x50]
push eax
call dword [sym.imp.ntdll.dll_RtlEnterCriticalSection]
mov ecx, dword [ebx + 0x70]
xor edi, edi
test ecx, ecx
je 0x40696c
mov eax, edi
lea ecx, [ebx + 0x68]
mov dword [esp + 0x10], eax
push eax
call fcn.00406f15
mov ecx, dword [ebx + 0x70]
mov esi, eax
dec ecx
mov eax, 0x402770
cmp dword [esp + 0x10], ecx
je 0x406654
mov eax, 0x402774
push eax
mov dword [esp + 0x10], eax
lea ecx, [esp + 0xbc]
mov eax, dword [esi]
push dword [eax*4 + 0x401030]
call fcn.00406099
test eax, eax
js 0x40696c
push dword [esi + 8]
push dword [esi + 4]
call fcn.004064c6
push dword [esp + 0xc]
lea ecx, [esp + 0x44]
push dword [esi + 8]
call fcn.00406099
test eax, eax
js 0x40696c
push dword [esi + 0x10]
push dword [esi + 0xc]
call fcn.004064c6
push dword [esp + 0xc]
lea ecx, [esp + 0xa4]
push dword [esi + 0x10]
call fcn.00406099
test eax, eax
js 0x40696c
push dword [esi + 0x24]
lea eax, [esp + 0x188]
push 0x402778
push 0x10
push eax
call dword [sym.imp.msvcrt.dll_sprintf_s]
add esp, 0x10
cmp eax, 0xffffffff
je 0x40696c
push dword [esp + 0xc]
lea eax, [esp + 0x188]
push eax
lea ecx, [esp + 0x90]
call fcn.00406099
test eax, eax
js 0x40696c
push dword [esi + 0x14]
lea eax, [esp + 0x188]
push 0x402778
push 0x10
push eax
call dword [sym.imp.msvcrt.dll_sprintf_s]
add esp, 0x10
cmp eax, 0xffffffff
je 0x40696c
push dword [esp + 0xc]
lea eax, [esp + 0x188]
push eax
lea ecx, [esp + 0x78]
call fcn.00406099
test eax, eax
js 0x40696c
push dword [esi + 0x1c]
push dword [esi + 0x18]
call fcn.004064c6
push dword [esp + 0xc]
lea ecx, [esp + 0x5c]
push dword [esi + 0x1c]
call fcn.00406099
test eax, eax
js 0x40696c
push dword [esi + 0x20]
lea eax, [esp + 0x188]
push 0x402778
push 0x10
push eax
call dword [sym.imp.msvcrt.dll_sprintf_s]
add esp, 0x10
cmp eax, 0xffffffff
je 0x40696c
push dword [esp + 0xc]
lea eax, [esp + 0x188]
push eax
lea ecx, [esp + 0x30]
call fcn.00406099
test eax, eax
js 0x40696c
lea ecx, [esi + 4]
call fcn.0040761c
lea ecx, [esi + 0xc]
call fcn.0040761c
lea ecx, [esi + 0x18]
call fcn.0040761c
mov eax, dword [esp + 0x10]
lea ecx, [ebx + 0x68]
inc eax
mov dword [esp + 0x10], eax
cmp eax, dword [ebx + 0x70]
jb 0x406638
cmp dword [section..data], 5
jbe 0x406964
mov ecx, dword [0x40900c]
mov esi, 0x2000
and ecx, esi
mov eax, edi
or eax, ecx
je 0x406964
mov ecx, dword [0x409014]
mov eax, ecx
and eax, esi
cmp edi, dword [0x409010]
jne 0x406964
cmp eax, ecx
jne 0x406964
lea eax, [ebx + 0x40]
mov dword [esp + 0xf4], edi
mov edx, ebx
mov dword [esp + 0xf0], eax
lea ecx, [esp + 0x100]
mov dword [esp + 0xf8], 8
mov dword [esp + 0xfc], edi
call fcn.0040303d
mov edx, dword [esp + 0x54]
lea ecx, [esp + 0x110]
call fcn.0040303d
mov edx, dword [esp + 0xcc]
lea ecx, [esp + 0x120]
call fcn.0040303d
mov edx, dword [esp + 0xb4]
lea ecx, [esp + 0x130]
call fcn.0040303d
mov edx, dword [esp + 0x9c]
lea ecx, [esp + 0x140]
call fcn.0040303d
mov edx, dword [esp + 0x84]
lea ecx, [esp + 0x150]
call fcn.0040303d
mov edx, dword [esp + 0x6c]
lea ecx, [esp + 0x160]
call fcn.0040303d
mov edx, dword [esp + 0x3c]
lea ecx, [esp + 0x170]
call fcn.0040303d
mov al, byte [0x402b28]
mov ecx, 0x402a21
movzx eax, word [0x402a22]
sub ecx, 0x402a10
mov dword [esp + 0x1c], eax
or ecx, 0xb000000
mov eax, dword [0x409004]
mov dword [esp + 0xd0], eax
mov dword [esp + 0x18], ecx
mov dword [esp + 0x20], edi
mov dword [esp + 0x24], esi
mov dword [esp + 0xd4], edi
movzx eax, word [eax]
mov dword [esp + 0xd8], eax
lea eax, [esp + 0xd0]
push eax
push 0xb
push edi
push edi
lea eax, [esp + 0x28]
mov dword [esp + 0xec], 2
push eax
push dword [0x40901c]
mov dword [esp + 0xf8], 0x402a2c
push dword [0x409018]
mov dword [esp + 0x100], edi
mov dword [esp + 0x104], 0x7e
mov dword [esp + 0x108], 1
call dword [sym.imp.ADVAPI32.dll_EventWriteTransfer]
lea ecx, [ebx + 0x68]
call fcn.004070b1
cmp dword [ebx + 0x70], edi
jbe 0x40699f
lea eax, [ebx + 0x68]
push edi
mov ecx, eax
call fcn.00406f15
mov esi, eax
lea ecx, [esi + 4]
call fcn.0040761c
lea ecx, [esi + 0xc]
call fcn.0040761c
lea ecx, [esi + 0x18]
call fcn.0040761c
inc edi
lea eax, [ebx + 0x68]
cmp edi, dword [ebx + 0x70]
jb 0x406974
lea ecx, [ebx + 0x68]
call fcn.004070b1
mov esi, dword [0x7ffe0004]
mov edx, 0x7ffe0324
mov edi, 0x7ffe0320
mov dword [esp + 0x10], esi
mov ecx, 0x7ffe0328
mov edx, dword [edx]
mov edi, dword [edi]
mov eax, dword [ecx]
cmp edx, eax
je 0x4069e9
lea esi, [ecx - 4]
lea ebx, [ecx - 8]
pause
mov edx, dword [esi]
mov edi, dword [ebx]
mov ecx, dword [ecx]
cmp edx, ecx
mov ecx, 0x7ffe0328
jne 0x4069d0
mov ebx, dword [esp + 0x14]
mov esi, dword [esp + 0x10]
mov eax, edx
mul esi
mov ecx, eax
mov esi, edx
mov eax, edi
mul dword [esp + 0x10]
shld esi, ecx, 8
shrd eax, edx, 0x18
shl ecx, 8
shr edx, 0x18
add ecx, eax
lea eax, [ebx + 0x50]
mov dword [ebx + 0x98], ecx
adc esi, edx
push eax
mov dword [ebx + 0x9c], esi
call dword [sym.imp.ntdll.dll_RtlLeaveCriticalSection]
lea ecx, [esp + 0x28]
call fcn.00406073
lea ecx, [esp + 0x40]
call fcn.00406073
lea ecx, [esp + 0x58]
call fcn.00406073
lea ecx, [esp + 0x70]
call fcn.00406073
lea ecx, [esp + 0x88]
call fcn.00406073
lea ecx, [esp + 0xa0]
call fcn.00406073
lea ecx, [esp + 0xb8]
call fcn.00406073
mov ecx, dword [esp + 0x194]
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.00407b50
mov esp, ebp
pop ebp
ret