Function at 0x405490
Capabilities:
Get file size
Write file on windows

Disassembly:
push ebp
mov ebp, esp
add esp, 0xffffffbc
push ebx
xor ebx, ebx
mov dword [ebp - 0x30], ebx
mov dword [ebp - 0xc], ecx
mov dword [ebp - 8], edx
mov dword [ebp - 4], eax
mov eax, dword [ebp - 4]
call fcn.0040358c
xor eax, eax
push ebp
push 0x4057bc
push dword fs:[eax]
mov dword fs:[eax], esp
push 0
push 0x80
push 3
push 0
push 0
push 0x40000000
mov eax, dword [ebp - 4]
call fcn.0040359c
push eax
call sub.kernel32.dll_CreateFileA
mov dword [ebp - 0x14], eax
cmp dword [ebp - 0x14], 0xffffffff
je 0x405798
mov eax, 0x7ffffffe
call fcn.00402808
mov dword [ebp - 0x40], eax
fild dword [ebp - 0x40]
call fcn.00402748
add eax, 0x200800
adc edx, 0
jno 0x40550c
call fcn.00402a08
push edx
push eax
mov eax, 0x38b14001
call fcn.00402808
mov dword [ebp - 0x44], eax
fild dword [ebp - 0x44]
call fcn.00402748
add eax, dword [esp]
adc edx, dword [esp + 4]
jno 0x405531
call fcn.00402a08
add esp, 8
test edx, edx
je 0x40553d
call fcn.00402a00
mov dword [ebp - 0x1c], eax
mov eax, 0x47a7c
call fcn.00402808
mov dword [ebp - 0x40], eax
fild dword [ebp - 0x40]
call fcn.00402748
add eax, 0x1bf53d2
adc edx, 0
jno 0x405564
call fcn.00402a08
test edx, edx
je 0x40556d
call fcn.00402a00
mov dword [ebp - 0x18], eax
mov eax, 0x7ffffffe
call fcn.00402808
mov dword [ebp - 0x40], eax
fild dword [ebp - 0x40]
call fcn.00402748
add eax, 0x200800
adc edx, 0
jno 0x405594
call fcn.00402a08
push edx
push eax
mov eax, 0x38b14001
call fcn.00402808
mov dword [ebp - 0x44], eax
fild dword [ebp - 0x44]
call fcn.00402748
add eax, dword [esp]
adc edx, dword [esp + 4]
jno 0x4055b9
call fcn.00402a08
add esp, 8
test edx, edx
je 0x4055c5
call fcn.00402a00
mov dword [ebp - 0x24], eax
mov eax, 0x47a7c
call fcn.00402808
mov dword [ebp - 0x40], eax
fild dword [ebp - 0x40]
call fcn.00402748
add eax, 0x1bf53d2
adc edx, 0
jno 0x4055ec
call fcn.00402a08
test edx, edx
je 0x4055f5
call fcn.00402a00
mov dword [ebp - 0x20], eax
mov eax, 0x7ffffffe
call fcn.00402808
mov dword [ebp - 0x40], eax
fild dword [ebp - 0x40]
call fcn.00402748
add eax, 0x200800
adc edx, 0
jno 0x40561c
call fcn.00402a08
push edx
push eax
mov eax, 0x38b14001
call fcn.00402808
mov dword [ebp - 0x44], eax
fild dword [ebp - 0x44]
call fcn.00402748
add eax, dword [esp]
adc edx, dword [esp + 4]
jno 0x405641
call fcn.00402a08
add esp, 8
test edx, edx
je 0x40564d
call fcn.00402a00
mov dword [ebp - 0x2c], eax
mov eax, 0x47a7c
call fcn.00402808
mov dword [ebp - 0x40], eax
fild dword [ebp - 0x40]
call fcn.00402748
add eax, 0x1bf53d2
adc edx, 0
jno 0x405674
call fcn.00402a08
test edx, edx
je 0x40567d
call fcn.00402a00
mov dword [ebp - 0x28], eax
lea eax, [ebp - 0x2c]
push eax
lea eax, [ebp - 0x24]
push eax
lea eax, [ebp - 0x1c]
push eax
mov eax, dword [ebp - 0x14]
push eax
call sub.kernel32.dll_SetFileTime
mov eax, dword [ebp - 8]
call fcn.00402808
mov dword [ebp - 0x40], eax
fild dword [ebp - 0x40]
call fcn.00402748
test edx, edx
je 0x4056b1
call fcn.00402a00
mov dword [ebp - 8], eax
lea eax, [ebp - 0x38]
push eax
mov eax, dword [ebp - 0x14]
push eax
call sub.kernel32.dll_GetFileSize
cmp dword [ebp - 8], 0
jbe 0x40578f
mov eax, dword [ebp - 0x38]
cmp eax, dword [ebp - 0xc]
jae 0x40578f
mov eax, dword [ebp - 8]
push eax
lea eax, [ebp - 0x30]
mov ecx, 1
mov edx, dword [0x405474]
call fcn.00403d10
add esp, 4
mov eax, dword [ebp - 8]
sub eax, 1
jae 0x4056fe
call fcn.00402a08
test eax, eax
jns 0x405707
call fcn.00402a00
test eax, eax
jl 0x40574b
inc eax
mov dword [ebp - 0x3c], eax
mov dword [ebp - 0x34], 0
mov eax, pe_nt_image_headers32
call fcn.00402808
cmp eax, 0xff
jbe 0x40572c
call fcn.00402a00
mov edx, dword [ebp - 0x34]
mov ecx, dword [ebp - 0x30]
test ecx, ecx
je 0x40573b
cmp edx, dword [ecx - 4]
jb 0x405740
call fcn.00402a00
mov byte [ecx + edx], al
inc dword [ebp - 0x34]
dec dword [ebp - 0x3c]
jne 0x405716
push 2
push 0
push 0
mov eax, dword [ebp - 0x14]
push eax
call sub.kernel32.dll_SetFilePointer
push 0
lea eax, [ebp - 0x10]
push eax
mov eax, dword [ebp - 8]
push eax
xor eax, eax
mov edx, dword [ebp - 0x30]
test edx, edx
je 0x405772
cmp eax, dword [edx - 4]
jb 0x405777
call fcn.00402a00
lea eax, [edx + eax]
push eax
mov eax, dword [ebp - 0x14]
push eax
call sub.kernel32.dll_WriteFile_1
test eax, eax
jne 0x40578f
mov dword [ebp - 0x10], 0xffffffff
mov eax, dword [ebp - 0x14]
push eax
call sub.kernel32.dll_CloseHandle
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x4057c3
lea eax, [ebp - 0x30]
mov edx, dword [0x405474]
call fcn.00403d1c
lea eax, [ebp - 4]
call fcn.00403218
ret