Function at 0x409052
Capabilities:
Get common file path
Get file size
Read .ini file
Read file on windows
Write file on windows

Disassembly:
push ebp
lea ebp, [esp - 0x150c]
mov eax, 0x150c
call fcn.0040e760
push 0xffffffffffffffff
push 0x42f8b3
mov eax, dword fs:[0]
push eax
sub esp, 0x48
mov eax, dword [0x439360]
xor eax, ebp
mov dword [ebp + 0x1508], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov eax, dword [ebp + 0x1514]
mov dword [ebp - 0x28], eax
mov edi, 0x104
push edi
lea eax, [ebp + 0x10f8]
xor ebx, ebx
push eax
push ebx
mov dword [ebp - 0x2c], ecx
mov dword [ebp - 0x10], ebx
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
test eax, eax
jne 0x4090c4
mov dword [ebp - 0x10], 0x3ee
jmp 0x409440
push ebx
push ebx
push 3
push ebx
push 1
push 0x80000000
lea eax, [ebp + 0x10f8]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
mov dword [ebp - 0x14], esi
cmp esi, 0xffffffff
jne 0x4090f8
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0x10], eax
cmp eax, ebx
jne 0x40944f
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
push ebx
mov dword [ebp - 0x20], eax
push ebx
add eax, 0xffffff78
push eax
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push ebx
lea eax, [ebp - 0x38]
push eax
mov esi, 0x88
push esi
lea eax, [ebp]
push eax
push dword [ebp - 0x14]
call dword [sym.imp.KERNEL32.dll_ReadFile]
cmp dword [ebp - 0x38], esi
jne 0x409432
mov esi, dword [ebp - 0x2c]
lea eax, [ebp + 0x10]
push eax
lea ecx, [esi + 0x104]
call fcn.00402330
lea eax, [ebp + 0x4c]
push eax
lea ecx, [esi + 0x120]
call fcn.00402330
push esi
lea ecx, [ebp - 0x54]
call fcn.00401540
push str._Config_Client.ini
push eax
lea eax, [ebp + 0xdc]
push eax
mov dword [ebp - 4], ebx
call fcn.00408af6
or dword [ebp - 4], 0xffffffff
add esp, 0xc
push ebx
push 1
lea ecx, [ebp - 0x54]
call fcn.00402360
push 0x103
lea eax, [ebp + 0x1301]
push ebx
push eax
mov byte [ebp + 0x1300], bl
call fcn.0040c050
mov eax, dword [ebp + 0xe0]
add esp, 0xc
cmp dword [ebp + 0xf4], 0x10
jae 0x4091b4
lea eax, [ebp + 0xe0]
push eax
push edi
lea eax, [ebp + 0x1300]
push eax
push 0x432b36
push str.GameVersion
push str.Version
call dword [sym.imp.KERNEL32.dll_GetPrivateProfileStringA]
lea eax, [ebp + 0x1300]
push eax
mov ecx, esi
call fcn.004089a5
test al, al
jne 0x40920b
mov eax, dword [ebp - 0x28]
mov byte [eax], bl
mov dword [ebp - 0x10], 0x570
cmp byte [esi + 0x13c], bl
jne 0x40920b
push 0x30
push 0x4303f4
push 0x430740
push ebx
call dword [sym.imp.USER32.dll_MessageBoxA]
mov eax, dword [ebp - 0x20]
cmp dword [ebp + 0xc], eax
jne 0x40921c
cmp dword [ebp], 0x1e534359
je 0x409223
mov dword [ebp - 0x10], 0x570
xor esi, esi
push ebx
inc esi
push esi
lea ecx, [ebp + 0xdc]
call fcn.00402360
cmp dword [ebp - 0x10], ebx
jne 0x409440
mov eax, dword [ebp + 4]
mov dword [ebp - 0x18], eax
cmp dword [ebp + 8], ebx
jbe 0x409440
mov dword [ebp - 0x1c], esi
mov eax, dword [0x43ad2c]
cmp eax, ebx
je 0x40926a
push dword [ebp + 8]
push dword [ebp - 0x1c]
push 0x3e9
push dword [0x43ad30]
call eax
mov edi, dword [sym.imp.KERNEL32.dll_SetFilePointer]
push ebx
push ebx
push dword [ebp - 0x18]
push dword [ebp - 0x14]
call edi
mov esi, dword [sym.imp.KERNEL32.dll_ReadFile]
push ebx
lea eax, [ebp - 0x30]
push eax
push 0x54
lea eax, [ebp + 0x88]
push eax
push dword [ebp - 0x14]
call esi
cmp dword [ebp - 0x30], 0x54
jne 0x409432
lea eax, [ebp + 0x88]
push eax
call fcn.0040b750
pop ecx
test eax, eax
jne 0x4092c1
lea eax, [ebp + 0x88]
push str.toplevel.tpk
push eax
call fcn.0040e0d0
pop ecx
pop ecx
lea eax, [ebp + 0x11fc]
push eax
push 0x103
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
lea eax, [ebp + 0x88]
push eax
lea eax, [ebp + 0x11fc]
push eax
lea eax, [ebp + 0x1404]
push str._s_s
push eax
call fcn.0040c97f
lea eax, [ebp + 0x1404]
push eax
call fcn.0040881d
add esp, 0x14
push ebx
push ebx
push 2
push ebx
push 1
push 0xc0000000
lea eax, [ebp + 0x1404]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [ebp - 0x20], eax
cmp eax, 0xffffffff
je 0x409422
add dword [ebp - 0x18], 0x54
push ebx
push ebx
push dword [ebp - 0x18]
push dword [ebp - 0x14]
call edi
mov edi, dword [ebp + 0xd8]
jmp 0x4093a4
mov eax, 0x1000
mov ecx, edi
cmp edi, eax
jbe 0x409349
mov ecx, eax
push ebx
lea eax, [ebp - 0x24]
push eax
push ecx
lea eax, [ebp + 0xf8]
push eax
push dword [ebp - 0x14]
call esi
cmp eax, ebx
je 0x4093aa
cmp dword [ebp - 0x24], ebx
je 0x4093ba
sub edi, dword [ebp - 0x24]
push ebx
lea eax, [ebp - 0x34]
push eax
push dword [ebp - 0x24]
lea eax, [ebp + 0xf8]
push eax
push dword [ebp - 0x20]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [ebp - 0x34]
cmp eax, dword [ebp - 0x24]
jne 0x4093b3
mov eax, dword [0x43ad2c]
cmp eax, ebx
je 0x4093a4
push dword [ebp + 0xd8]
push edi
push 0x3ea
push dword [0x43ad30]
call eax
cmp edi, ebx
ja 0x40933c
jmp 0x4093ba
mov dword [ebp - 0x10], 0x570
jmp 0x4093ba
mov dword [ebp - 0x10], 0x27
push dword [ebp - 0x20]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [ebp - 0x10], ebx
jne 0x409440
mov eax, dword [0x43ad2c]
cmp eax, ebx
je 0x4093e4
push dword [ebp + 8]
push dword [ebp - 0x1c]
push 0x3eb
push dword [0x43ad30]
call eax
push dword [ebp + 8]
mov ecx, dword [ebp - 0x2c]
push dword [ebp - 0x1c]
lea eax, [ebp + 0x88]
push eax
lea eax, [ebp + 0x1404]
push eax
call fcn.00408d8d
mov dword [ebp - 0x10], eax
cmp eax, ebx
jne 0x40942d
mov eax, dword [ebp + 0xd8]
add dword [ebp - 0x18], eax
inc dword [ebp - 0x1c]
mov eax, dword [ebp - 0x1c]
dec eax
cmp eax, dword [ebp + 8]
jb 0x40924e
jmp 0x409440
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0x10], eax
jmp 0x409440
cmp eax, 0xffffffff
jne 0x40943b
mov dword [ebp - 0x10], 0x570
jmp 0x409440
mov eax, dword [ebp - 0x28]
mov byte [eax], bl
cmp dword [ebp - 0x14], 0xffffffff
je 0x40944f
push dword [ebp - 0x14]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
cmp dword [ebp - 0x10], ebx
sete al
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp + 0x1508]
xor ecx, ebp
call fcn.0040b3d8
add ebp, 0x150c
leave
ret 4