Function at 0x404240
Capabilities:
Check if file exists
Check os version
Get common file path
Get file attributes
Get system information on windows

Disassembly:
sub esp, 0x1bc
push ebx
push edi
xor ebx, ebx
mov ecx, 0x24
xor eax, eax
lea edi, [esp + 0x30]
mov dword [esp + 0x2c], ebx
rep stosd dword es:[edi], eax
cmp dword [esp + 0x1c8], ebx
je 0x40471c
push ebp
lea eax, [esp + 0x30]
push esi
push eax
mov dword [esp + 0x38], 0x94
call dword [sym.imp.KERNEL32.dll_GetVersionExA]
mov edx, dword [esp + 0x40]
mov eax, dword [esp + 0x3c]
lea ecx, [esp + 0x48]
push ecx
mov ecx, dword [esp + 0x3c]
push edx
mov edx, dword [esp + 0x1dc]
push eax
push ecx
push str._d._d._4d__s
push edx
call fcn.0040cce6
mov al, byte [0x421d68]
mov ecx, 0x40
mov byte [esp + 0xe0], al
xor eax, eax
lea edi, [esp + 0xe1]
add esp, 0x18
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
lea ecx, [esp + 0xc8]
push 0x104
push ecx
stosb byte es:[edi], al
call dword [sym.imp.KERNEL32.dll_GetWindowsDirectoryA]
mov edi, str.SYSWOW64
or ecx, 0xffffffff
xor eax, eax
lea edx, [esp + 0xc8]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov ebp, ecx
mov edi, edx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, ebp
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, ebp
mov ebp, dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
and ecx, 3
lea eax, [esp + 0xc8]
rep movsb byte es:[edi], byte [esi]
push eax
call ebp
cmp eax, 0xffffffff
je 0x404372
test al, 0x10
je 0x404372
mov edi, str.Program_Files__x86_
or ecx, 0xffffffff
xor eax, eax
lea edx, [esp + 0xc8]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov byte [esp + 0xcb], bl
mov esi, edi
mov edi, edx
mov edx, ecx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, edx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
lea eax, [esp + 0xc8]
and ecx, 3
push eax
rep movsb byte es:[edi], byte [esi]
call ebp
cmp eax, 0xffffffff
je 0x404372
test al, 0x10
je 0x404372
mov ebx, 1
mov eax, dword [esp + 0x38]
pop esi
cmp eax, 4
pop ebp
jne 0x404429
mov eax, dword [esp + 0x34]
test eax, eax
jne 0x4043db
mov eax, dword [esp + 0x3c]
cmp eax, 1
jne 0x4043b2
mov ecx, dword [esp + 0x1c8]
push str.Windows_95
push ecx
call fcn.0040cce6
add esp, 8
mov al, 4
pop edi
pop ebx
add esp, 0x1bc
ret
cmp eax, 2
jne 0x40471c
mov edx, dword [esp + 0x1c8]
push str.Windows_NT4.0
push edx
call fcn.0040cce6
add esp, 8
mov al, 3
pop edi
pop ebx
add esp, 0x1bc
ret
cmp eax, 0xa
jne 0x404400
mov eax, dword [esp + 0x1c8]
push str.Windows_98
push eax
call fcn.0040cce6
add esp, 8
mov al, 1
pop edi
pop ebx
add esp, 0x1bc
ret
cmp eax, 0x5a
jne 0x40471c
mov ecx, dword [esp + 0x1c8]
push str.Windows_ME
push ecx
call fcn.0040cce6
add esp, 8
mov al, 2
pop edi
pop ebx
add esp, 0x1bc
ret
cmp eax, 5
jne 0x404541
mov eax, dword [esp + 0x34]
test eax, eax
jne 0x40445a
mov edx, dword [esp + 0x1c8]
push str.Windows_2000
push edx
call fcn.0040cce6
add esp, 8
mov al, 5
pop edi
pop ebx
add esp, 0x1bc
ret
cmp eax, 1
jne 0x40447f
mov eax, dword [esp + 0x1c8]
push str.32bit_windows_XP
push eax
call fcn.0040cce6
add esp, 8
mov al, 6
pop edi
pop ebx
add esp, 0x1bc
ret
cmp eax, 2
jne 0x40471c
mov ecx, 0x26
xor eax, eax
lea edi, [esp + 0xc4]
mov dword [esp + 8], eax
rep stosd dword es:[edi], eax
mov ecx, 8
lea edi, [esp + 0xc]
rep stosd dword es:[edi], eax
lea ecx, [esp + 0xc0]
mov dword [esp + 0xc0], 0x9c
push ecx
call dword [sym.imp.KERNEL32.dll_GetVersionExA]
lea edx, [esp + 8]
push edx
call dword [sym.imp.KERNEL32.dll_GetSystemInfo]
cmp byte [esp + 0x15a], 1
jne 0x4044fd
cmp word [esp + 8], 9
jne 0x4044fd
mov eax, dword [esp + 0x1c8]
push str.64bit_windows_XP
push eax
call fcn.0040cce6
add esp, 8
mov al, 0xb
pop edi
pop ebx
add esp, 0x1bc
ret
test ebx, ebx
jne 0x404521
mov ecx, dword [esp + 0x1c8]
push str.32bit_windows_SERVER2003
push ecx
call fcn.0040cce6
add esp, 8
mov al, 8
pop edi
pop ebx
add esp, 0x1bc
ret
mov edx, dword [esp + 0x1c8]
push str.64bit_windows_SERVER2003
push edx
call fcn.0040cce6
add esp, 8
mov al, 0xd
pop edi
pop ebx
add esp, 0x1bc
ret
cmp eax, 6
jne 0x40471c
mov eax, dword [esp + 0x34]
test eax, eax
jne 0x40460f
mov ecx, 0x26
lea edi, [esp + 0xc4]
rep stosd dword es:[edi], eax
lea eax, [esp + 0xc0]
mov dword [esp + 0xc0], 0x9c
push eax
call dword [sym.imp.KERNEL32.dll_GetVersionExA]
cmp byte [esp + 0x15a], 1
je 0x4045cb
test ebx, ebx
jne 0x4045ab
mov ecx, dword [esp + 0x1c8]
push str.32bit_windows_SERVER2008
push ecx
call fcn.0040cce6
add esp, 8
mov al, 9
pop edi
pop ebx
add esp, 0x1bc
ret
mov edx, dword [esp + 0x1c8]
push str.64bit_windows_SERVER2008
push edx
call fcn.0040cce6
add esp, 8
mov al, 0xe
pop edi
pop ebx
add esp, 0x1bc
ret
test ebx, ebx
jne 0x4045ef
mov eax, dword [esp + 0x1c8]
push str.32bit_windows_vista
push eax
call fcn.0040cce6
add esp, 8
mov al, 7
pop edi
pop ebx
add esp, 0x1bc
ret
mov ecx, dword [esp + 0x1c8]
push str.64bit_windows_vista
push ecx
call fcn.0040cce6
add esp, 8
mov al, 0xc
pop edi
pop ebx
add esp, 0x1bc
ret
cmp eax, 1
jne 0x4046d3
mov ecx, 0x26
xor eax, eax
lea edi, [esp + 0xc4]
lea edx, [esp + 0xc0]
rep stosd dword es:[edi], eax
push edx
mov dword [esp + 0xc4], 0x9c
call dword [sym.imp.KERNEL32.dll_GetVersionExA]
cmp byte [esp + 0x15a], 1
je 0x40468f
test ebx, ebx
jne 0x40466f
mov eax, dword [esp + 0x1c8]
push str.32bit_windows_SERVER2008
push eax
call fcn.0040cce6
add esp, 8
mov al, 9
pop edi
pop ebx
add esp, 0x1bc
ret
mov ecx, dword [esp + 0x1c8]
push str.64bit_windows_SERVER2008
push ecx
call fcn.0040cce6
add esp, 8
mov al, 0xe
pop edi
pop ebx
add esp, 0x1bc
ret
test ebx, ebx
jne 0x4046b3
mov edx, dword [esp + 0x1c8]
push str.32bit_windows_7
push edx
call fcn.0040cce6
add esp, 8
mov al, 0xa
pop edi
pop ebx
add esp, 0x1bc
ret
mov eax, dword [esp + 0x1c8]
push str.64bit_windows_7
push eax
call fcn.0040cce6
add esp, 8
mov al, 0xf
pop edi
pop ebx
add esp, 0x1bc
ret
cmp eax, 2
jne 0x40471c
test ebx, ebx
jne 0x4046fc
mov ecx, dword [esp + 0x1c8]
push str.32bit_windows_8
push ecx
call fcn.0040cce6
add esp, 8
mov al, 0x10
pop edi
pop ebx
add esp, 0x1bc
ret
mov edx, dword [esp + 0x1c8]
push str.64bit_windows_8
push edx
call fcn.0040cce6
add esp, 8
mov al, 0x11
pop edi
pop ebx
add esp, 0x1bc
ret
pop edi
xor al, al
pop ebx
add esp, 0x1bc
ret