Function at 0x403791
Capabilities:
Check if file exists
Get common file path
Get disk information
Get disk size
Query or enumerate registry value
Set environment variable

Disassembly:
push ebp
lea ebp, [esp - 0x1a0]
sub esp, 0x220
mov eax, dword [0x410eec]
push ebx
push esi
push edi
push 0x104
xor ebx, ebx
push ebx
mov esi, 0x411c40
push esi
mov dword [ebp + 0x19c], eax
mov dword [ebp - 0x80], 1
call fcn.00404500
add esp, 0xc
lea eax, [ebp - 0x7c]
push eax
push 0x2001f
push ebx
push str.SoftwareThunder_NetworkGameDCF_DL
push 0x80000002
mov dword [ebp - 0x7c], ebx
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
test eax, eax
jne 0x403836
mov word [ebp - 0x6c], bx
mov ecx, 0x81
lea edi, [ebp - 0x6a]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
lea eax, [ebp - 0x74]
push eax
lea eax, [ebp - 0x6c]
push eax
lea eax, [ebp - 0x70]
push eax
push ebx
push str.InstDir
push dword [ebp - 0x7c]
mov dword [ebp - 0x74], 0x104
mov dword [ebp - 0x70], ebx
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExW]
test eax, eax
jne 0x403836
cmp dword [ebp - 0x70], 1
jne 0x403836
lea eax, [ebp - 0x6c]
push eax
push esi
call fcn.00404725
pop ecx
pop ecx
cmp dword [ebp - 0x7c], ebx
je 0x403844
push dword [ebp - 0x7c]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
cmp word [0x411c40], bx
jne 0x403964
mov eax, dword [0x40cbc0]
mov dword [ebp - 0x6c], eax
mov eax, dword [0x40cbc4]
mov dword [ebp - 0x68], eax
xor eax, eax
mov ecx, 0x80
lea edi, [ebp - 0x64]
push ebx
rep stosd dword es:[edi], eax
mov edi, dword [sym.imp.KERNEL32.dll_GetSystemDirectoryW]
push ebx
call edi
cmp eax, ebx
mov dword [ebp - 0x74], eax
jbe 0x4038ad
lea eax, [eax + eax + 4]
push eax
call fcn.004048e1
pop ecx
push dword [ebp - 0x74]
mov dword [ebp - 0x70], eax
push eax
call edi
push dword [ebp - 0x70]
lea eax, [ebp - 0x6c]
push eax
call fcn.00404725
push dword [ebp - 0x70]
call fcn.004047ba
add esp, 0xc
mov word [ebp - 0x66], bx
mov edi, dword [sym.imp.KERNEL32.dll_GetLogicalDriveStringsW]
push ebx
push ebx
call edi
mov dword [ebp - 0x74], eax
lea eax, [eax + eax + 2]
push eax
call fcn.004048e1
pop ecx
push eax
push dword [ebp - 0x74]
mov dword [ebp - 0x70], eax
call edi
test eax, eax
jbe 0x40392d
mov edi, dword [ebp - 0x70]
cmp edi, ebx
je 0x40392d
lea eax, [ebp - 0x6c]
push edi
push eax
call fcn.0040483d
test eax, eax
pop ecx
pop ecx
je 0x40391c
push edi
call dword [sym.imp.KERNEL32.dll_GetDriveTypeW]
cmp eax, 3
jne 0x40391c
push ebx
push ebx
lea eax, [ebp - 0x78]
push eax
push edi
mov dword [ebp - 0x78], ebx
mov dword [ebp - 0x74], ebx
call dword [sym.imp.KERNEL32.dll_GetDiskFreeSpaceExW]
test eax, eax
je 0x40391c
cmp dword [ebp - 0x74], ebx
jg 0x403949
jl 0x40391c
cmp dword [ebp - 0x78], 0x6400000
ja 0x403949
push dword [ebp - 0x70]
call dword [sym.imp.KERNEL32.dll_lstrlenW]
lea edi, [edi + eax*2 + 2]
cmp edi, ebx
jne 0x4038d9
lea eax, [ebp - 0x6c]
push eax
push esi
call fcn.00404725
pop ecx
pop ecx
call fcn.0040190c
test al, al
je 0x40394c
push str.Program_Files__x86__
jmp 0x403951
push edi
jmp 0x403931
push str.Program_Files_
push esi
call fcn.004046fb
pop ecx
pop ecx
push dword [ebp - 0x70]
call fcn.004047ba
pop ecx
jmp 0x40396b
mov byte [0x411620], 1
mov edi, 0x40cb4c
push edi
call fcn.00403469
test eax, eax
pop ecx
je 0x40399b
push esi
push edi
call fcn.004035d0
push esi
call fcn.004046e5
lea eax, [eax*2 + 0x411c3e]
add esp, 0xc
cmp word [eax], 0x5c
jne 0x40399b
mov word [eax], bx
push esi
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x4039b5
push esi
push ebx
call dword [sym.imp.SHELL32.dll_SHCreateDirectory]
test eax, eax
je 0x4039b5
mov dword [ebp - 0x80], ebx
push esi
push 0x40c2f4
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
mov ecx, dword [ebp + 0x19c]
mov eax, dword [ebp - 0x80]
pop edi
pop esi
pop ebx
call fcn.00403dff
add ebp, 0x1a0
leave
ret