Function at 0x409190
Capabilities:
Get file size
Read file on windows
Write file on windows

Disassembly:
sub esp, 0x470
mov eax, dword [esp + 0x474]
push ebx
push ebp
push esi
xor ebp, ebp
push edi
mov edi, dword [sym.imp.KERNEL32.DLL_CreateFileA]
push ebp
push 0x80
push 3
push ebp
push 3
push connect
push eax
call edi
mov esi, eax
cmp esi, 0xffffffff
je 0x409467
cmp esi, ebp
je 0x409467
mov ecx, dword [esp + 0x488]
push ebp
push 0x80
push 2
push ebp
push 3
push 0x40000000
push ecx
call edi
mov ebx, eax
cmp ebx, 0xffffffff
je 0x409450
cmp ebx, ebp
je 0x409450
mov ecx, 7
xor eax, eax
lea edi, [esp + 0x2c]
xor edx, edx
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
mov ecx, 0xb
xor eax, eax
lea edi, [esp + 0x4c]
mov dword [esp + 0x14], edx
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
mov dword [esp + 0x18], edx
mov eax, 0xa
mov dword [esp + 0x1c], edx
mov word [esp + 0x30], ax
mov word [esp + 0x52], ax
mov dword [esp + 0x20], edx
lea eax, [esp + 0x38]
lea ecx, [esp + 0x36]
mov dword [esp + 0x24], edx
push eax
push ecx
mov word [esp + 0x30], dx
mov dword [esp + 0x34], 0x4034b50
mov word [esp + 0x3a], bp
mov word [esp + 0x5c], bp
mov word [esp + 0x3c], bp
mov word [esp + 0x5e], bp
call fcn.00409480
mov dx, word [esp + 0x3e]
mov ax, word [esp + 0x40]
push esi
mov word [esp + 0x64], dx
mov word [esp + 0x66], ax
call fcn.00409520
mov edi, dword [sym.imp.KERNEL32.DLL_GetFileSize]
add esp, 0xc
mov dword [esp + 0x3a], eax
mov dword [esp + 0x5c], eax
push ebp
push esi
call edi
push ebp
push esi
mov dword [esp + 0x46], eax
mov dword [esp + 0x68], eax
call edi
mov edi, dword [esp + 0x48c]
mov dword [esp + 0x42], eax
push edi
mov dword [esp + 0x68], eax
call dword [sym.imp.KERNEL32.DLL_lstrlenA]
lea ecx, [esp + 0x10]
push ebp
push ecx
lea edx, [esp + 0x34]
push 0x1e
push edx
push ebx
mov word [esp + 0x5a], ax
mov word [esp + 0x7c], ax
mov word [esp + 0x5c], bp
mov word [esp + 0x7e], bp
mov dword [esp + 0x8a], ebp
call dword [sym.imp.KERNEL32.DLL_WriteFile]
lea eax, [esp + 0x10]
push ebp
push eax
push edi
call dword [sym.imp.KERNEL32.DLL_lstrlenA]
push eax
push edi
push ebx
call dword [sym.imp.KERNEL32.DLL_WriteFile]
push edi
call dword [sym.imp.KERNEL32.DLL_lstrlenA]
mov edi, eax
push ebp
add edi, 0x1e
push ebp
push ebp
push esi
call dword [sym.imp.KERNEL32.DLL_SetFilePointer]
lea ecx, [esp + 0x10]
push ebp
push ecx
lea edx, [esp + 0x88]
push 0x400
push edx
push esi
mov dword [esp + 0x24], ebp
call dword [sym.imp.KERNEL32.DLL_ReadFile]
test eax, eax
je 0x409383
mov eax, dword [esp + 0x10]
cmp eax, ebp
je 0x409383
lea ecx, [esp + 0x7c]
push ebp
push ecx
lea edx, [esp + 0x88]
push eax
push edx
push ebx
call dword [sym.imp.KERNEL32.DLL_WriteFile]
mov ecx, dword [esp + 0x10]
lea eax, [esp + 0x10]
add edi, ecx
push ebp
push eax
lea ecx, [esp + 0x88]
push 0x400
push ecx
push esi
mov dword [esp + 0x24], ebp
call dword [sym.imp.KERNEL32.DLL_ReadFile]
test eax, eax
jne 0x40933d
lea edx, [esp + 0x10]
push ebp
push edx
lea eax, [esp + 0x54]
push 0x2e
push eax
push ebx
mov dword [esp + 0x38], edi
mov dword [esp + 0x60], 0x2014b50
mov word [esp + 0x64], 0x14
mov word [esp + 0x84], bp
mov dword [esp + 0x86], 0x20
call dword [sym.imp.KERNEL32.DLL_WriteFile]
mov edx, dword [esp + 0x48c]
lea ecx, [esp + 0x10]
push ebp
push ecx
push edx
call dword [sym.imp.KERNEL32.DLL_lstrlenA]
push eax
mov eax, dword [esp + 0x498]
push eax
push ebx
call dword [sym.imp.KERNEL32.DLL_WriteFile]
mov ecx, dword [esp + 0x48c]
push ecx
call dword [sym.imp.KERNEL32.DLL_lstrlenA]
mov edx, dword [esp + 0x24]
lea eax, [edi + eax + 0x2e]
sub eax, edx
lea edx, [esp + 0x10]
mov dword [esp + 0x20], eax
push ebp
push edx
lea eax, [esp + 0x1c]
push 0x16
mov ecx, 1
push eax
push ebx
mov dword [esp + 0x28], 0x6054b50
mov word [esp + 0x2c], bp
mov word [esp + 0x2e], bp
mov word [esp + 0x30], cx
mov word [esp + 0x32], cx
mov word [esp + 0x3c], bp
call dword [sym.imp.KERNEL32.DLL_WriteFile]
mov edi, dword [sym.imp.KERNEL32.DLL_CloseHandle]
push ebx
call edi
push esi
call edi
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x470
ret
push esi
call dword [sym.imp.KERNEL32.DLL_CloseHandle]
pop edi
pop esi
pop ebp
mov eax, 2
pop ebx
add esp, 0x470
ret
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x470
ret