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

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x418f3c
mov eax, dword fs:[0]
push eax
mov eax, 0x40268
call fcn.0040db40
mov eax, dword [0x422040]
xor eax, ebp
mov dword [ebp - 0x10], eax
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov dword [ebp - 0x4026c], edx
mov esi, ecx
mov dword [ebp - 0x40268], esi
mov eax, dword fs:[0x2c]
mov dword [ebp - 0x40264], 0
mov ecx, dword [eax]
mov eax, dword [0x4239c0]
cmp eax, dword [ecx + 4]
jle 0x4013da
push 0x4239c0
call fcn.0040d222
add esp, 4
cmp dword [0x4239c0], 0xffffffff
jne 0x4013da
mov dword [ebp - 4], 0
mov dword [0x4239d4], 0
mov dword [0x4239d0], 0
mov dword [0x4239cc], 0
mov dword [0x4239c4], 0
mov byte [ebp - 4], 1
call fcn.00404710
push 0x4194a0
call fcn.0040d053
push 0x4239c0
mov dword [ebp - 4], 0xffffffff
call fcn.0040d1d1
add esp, 8
push 0x104
lea eax, [ebp - 0x218]
push eax
push dword [0x4239b4]
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
test eax, eax
je 0x401688
push eax
lea eax, [ebp - 0x218]
mov dword [ebp - 0x40220], 0
xorps xmm0, xmm0
mov dword [ebp - 0x4021c], 0
push eax
lea ecx, [ebp - 0x40230]
movups xmmword [ebp - 0x40230], xmm0
call fcn.00403250
cmp dword [ebp - 0x4021c], 7
lea eax, [ebp - 0x40230]
push 0
cmova eax, dword [ebp - 0x40230]
push 0x80
push 4
push 0
push 1
push 0x80000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
mov dword [ebp - 0x40274], edi
mov dword [ebp - 4], 2
mov ecx, dword [ebp - 0x4021c]
cmp ecx, 7
jbe 0x4014a7
mov edx, dword [ebp - 0x40230]
lea ecx, [ecx*2 + 2]
mov eax, edx
cmp ecx, 0x1000
jb 0x40149d
mov edx, dword [eax - 4]
add ecx, 0x23
sub eax, edx
add eax, 0xfffffffc
cmp eax, 0x1f
ja 0x4016ac
push ecx
push edx
call fcn.0040d068
add esp, 8
xor eax, eax
mov dword [ebp - 0x40220], 0
mov dword [ebp - 0x4021c], 7
mov word [ebp - 0x40230], ax
cmp edi, 0xffffffff
je 0x401688
cmp dword [esi + 0x14], 7
mov eax, esi
jbe 0x4014d7
mov eax, dword [esi]
push 0
push 0x80
push 2
push 0
push 0
push 0x40000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
mov dword [ebp - 0x40270], esi
mov byte [ebp - 4], 3
cmp esi, 0xffffffff
je 0x401688
push 0
lea eax, [ebp - 0x40264]
push eax
push 0x40000
lea eax, [ebp - 0x40218]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x401567
mov eax, dword [ebp - 0x40264]
test eax, eax
je 0x401567
push 0
lea ecx, [ebp - 0x40264]
push ecx
push eax
lea eax, [ebp - 0x40218]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
push 0
lea eax, [ebp - 0x40264]
push eax
push 0x40000
lea eax, [ebp - 0x40218]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x401525
push esi
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
push edi
mov dword [ebp - 4], 0xffffffff
call esi
mov eax, dword [ebp - 0x40268]
cmp dword [eax + 0x14], 7
jbe 0x401588
mov eax, dword [eax]
push 0
push eax
call dword [sym.imp.KERNEL32.dll_BeginUpdateResourceW]
mov dword [ebp - 0x40268], eax
test eax, eax
je 0x401688
mov eax, dword [ebp - 0x4026c]
cmp dword [eax + 0x14], 7
jbe 0x4015ad
mov eax, dword [eax]
push 0
push 0x80
push 4
push 0
push 1
push 0x80000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
mov dword [ebp - 0x40270], esi
mov dword [ebp - 4], 4
cmp esi, 0xffffffff
je 0x401688
push 0
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov edi, eax
push edi
call fcn.0040d198
add esp, 4
mov dword [ebp - 0x4026c], eax
lea ecx, [ebp - 0x40264]
push 0
push ecx
push edi
push eax
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x401644
cmp dword [ebp - 0x40264], edi
jne 0x401644
push edi
push dword [ebp - 0x4026c]
mov edi, dword [ebp - 0x40268]
push 0x400
push 0x65
push 0xa
push edi
call dword [sym.imp.KERNEL32.dll_UpdateResourceW]
test eax, eax
je 0x401688
push 0
push edi
call dword [sym.imp.KERNEL32.dll_EndUpdateResourceW]
test eax, eax
jne 0x401664
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, eax
lea ecx, [ebp - 0x40260]
call fcn.00405100
push 0x4214c4
lea eax, [ebp - 0x40260]
jmp 0x4016a6
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
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.0040cdb6
mov esp, ebp
pop ebp
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, eax
lea ecx, [ebp - 0x40248]
call fcn.00405100
push 0x4214c4
lea eax, [ebp - 0x40248]
push eax
call fcn.0040e15a
call fcn.0041012f
int3