Function at 0x405180
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x4894b5
mov eax, dword fs:[0]
push eax
sub esp, 0x74
mov eax, dword [0x4d9754]
xor eax, ebp
mov dword [ebp - 0x10], eax
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov edi, 0x4b65d4
mov dword [ebp - 0x40], 0x4b6748
test ecx, ecx
mov dword [ebp - 0x18], 0x4b6750
mov esi, edi
cmovne esi, ecx
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0x14], eax
test esi, esi
mov dword [ebp - 4], 0
xorps xmm0, xmm0
mov dword [ebp - 0x2c], 0
cmovne edi, esi
mov dword [ebp - 0x28], 0
mov ecx, edi
movups xmmword [ebp - 0x3c], xmm0
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x4051f3
sub ecx, edx
sar ecx, 1
push ecx
push edi
lea ecx, [ebp - 0x3c]
call fcn.004091c0
mov eax, dword [ebp - 0x18]
mov dword [ebp - 0x24], 0
mov dword [ebp - 0x20], 0
mov dword [ebp - 0x1c], 0
mov eax, dword [eax + 4]
push dword [ebp + eax - 0x18]
call dword [sym.imp.KERNEL32.dll_SetLastError]
lea ecx, [ebp - 0x70]
mov dword [ebp - 4], 1
call fcn.00404d20
add eax, 4
cmp dword [eax + 0x14], 8
jb 0x40524b
mov eax, dword [eax]
push 0
push 0x80
push 4
push 0
push 1
push 0xc0000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
lea edi, [ebp - 0x48]
mov eax, dword [ebp - 0x48]
add edi, dword [eax + 4]
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [edi], eax
push dword [ebp - 0x54]
call fcn.004598bc
add esp, 4
push dword [ebp - 0x4c]
call dword [sym.imp.OLEAUT32.dll_SysStringLen]
cmp dword [ebp - 0x58], 8
jb 0x40529a
push dword [ebp - 0x6c]
call dword [sym.imp.OLEAUT32.dll_SysStringLen]
xor eax, eax
mov dword [ebp - 0x5c], 0
mov word [ebp - 0x6c], ax
mov eax, dword [ebp - 0x70]
mov dword [ebp - 0x58], 7
mov eax, dword [eax + 4]
push dword [ebp + eax - 0x70]
call dword [sym.imp.KERNEL32.dll_SetLastError]
cmp byte [0x4df7bd], 0
jne 0x405331
xor eax, eax
push eax
push eax
push eax
push esi
mov word [ebp - 0x74], ax
mov dword [ebp - 0x7c], eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 0x7c]
push eax
push 2
lea eax, [ebp - 0x74]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov ecx, 0xfeff
test eax, eax
je 0x40530a
cmp dword [ebp - 0x7c], 2
jne 0x40530a
cmp word [ebp - 0x74], cx
sete al
mov byte [0x4df7bd], al
jmp 0x40530f
mov al, byte [0x4df7bd]
test al, al
jne 0x40532a
push 0
lea eax, [ebp - 0x80]
mov word [ebp - 0x78], cx
push eax
push 2
lea eax, [ebp - 0x78]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov byte [0x4df7bd], 1
push 2
push 0
push 0
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp dword [ebp - 0x28], 8
lea eax, [ebp - 0x80]
push 0
push eax
mov eax, dword [ebp - 0x2c]
lea ecx, [ebp - 0x3c]
cmovae ecx, dword [ebp - 0x3c]
add eax, eax
push eax
push ecx
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test esi, esi
je 0x405371
cmp dword [sym.imp.KERNEL32.dll_CloseHandle], 0
je 0x405371
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp - 0x18]
lea esi, [ebp - 0x18]
add esi, dword [eax + 4]
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esi], eax
push dword [ebp - 0x24]
call fcn.004598bc
add esp, 4
push dword [ebp - 0x1c]
call dword [sym.imp.OLEAUT32.dll_SysStringLen]
cmp dword [ebp - 0x28], 8
jb 0x4053a5
push dword [ebp - 0x3c]
call dword [sym.imp.OLEAUT32.dll_SysStringLen]
xor eax, eax
mov dword [ebp - 0x2c], 0
mov word [ebp - 0x3c], ax
mov eax, dword [ebp - 0x40]
mov dword [ebp - 0x28], 7
mov eax, dword [eax + 4]
push dword [ebp + eax - 0x40]
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.0045978b
mov esp, ebp
pop ebp
ret