Function at 0x401480
Capabilities:
Check if file exists
Get file attributes
Get file size
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x224
mov eax, dword [0x421040]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
push edi
push 0x208
lea eax, [ebp - 0x210]
mov edi, edx
push 0
push eax
mov esi, ecx
call fcn.00406450
add esp, 0xc
lea eax, [ebp - 0x210]
push edi
push esi
push str._s_s
push 0xffffffffffffffff
push 0x104
push eax
call fcn.00401030
add esp, 0x18
cmp eax, 0xffffffff
jne 0x4014e5
push 0x10
push 0x41cc5c
push str.Failed_to_get_the_exe_path__4GB_patch__
jmp 0x401905
lea eax, [ebp - 0x210]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x4018f9
nop dword [eax + eax]
test al, 1
jne 0x4018f9
push 0
push 0x80
push 3
push 0
push 0
push 0xc0000000
lea eax, [ebp - 0x210]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
cmp edi, 0xffffffff
je 0x40190d
lea eax, [ebp - 0x218]
mov dword [ebp - 0x218], 0
push eax
push edi
mov dword [ebp - 0x214], 0
call dword [sym.imp.KERNEL32.dll_GetFileSizeEx]
test eax, eax
je 0x4018d9
cmp dword [ebp - 0x214], 0
jne 0x4018d9
mov esi, dword [ebp - 0x218]
cmp esi, 0x4e0
jb 0x4018d9
push esi
call fcn.00404a0f
add esp, 4
mov ebx, eax
push esi
push 0
push ebx
call fcn.00406450
add esp, 0xc
mov dword [ebp - 0x21c], 0
lea eax, [ebp - 0x21c]
push 0
push eax
push dword [ebp - 0x218]
push ebx
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x4015fb
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0x218]
mov eax, ebx
test ecx, ecx
je 0x401845
mov byte [eax], 0
inc eax
sub ecx, 1
jne 0x4015d6
push ebx
call fcn.0040477b
add esp, 4
xor al, al
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040476d
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp - 0x218]
cmp dword [ebp - 0x21c], eax
je 0x40164d
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword ds:[ebp - 0x218]
mov eax, ebx
test ecx, ecx
je 0x401845
mov byte [eax], 0
inc eax
sub ecx, 1
jne 0x401628
push ebx
call fcn.0040477b
add esp, 4
xor al, al
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040476d
mov esp, ebp
pop ebp
ret
mov esi, dword [0x422468]
lea ecx, [ebp - 0x224]
push ecx
push 0
push eax
push ebx
push 0
mov ecx, esi
mov dword [ebp - 0x224], 0
call dword [0x4171a8]
call esi
test eax, eax
je 0x4016b5
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0x218]
mov eax, ebx
test ecx, ecx
je 0x401845
nop
mov byte [eax], 0
inc eax
sub ecx, 1
jne 0x401690
push ebx
call fcn.0040477b
add esp, 4
xor al, al
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040476d
mov esp, ebp
pop ebp
ret
mov edx, dword [ebp - 0x224]
mov eax, 0x14c
cmp word [edx + 4], ax
je 0x401709
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0x218]
mov eax, ebx
test ecx, ecx
je 0x401845
nop dword [eax]
mov byte [eax], 0
inc eax
sub ecx, 1
jne 0x4016e0
push ebx
call fcn.0040477b
add esp, 4
xor al, al
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040476d
mov esp, ebp
pop ebp
ret
movzx eax, word [edx + 0x16]
mov ecx, eax
test al, 2
jne 0x401755
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0x218]
mov eax, ebx
test ecx, ecx
je 0x401845
nop word [eax + eax]
mov byte [eax], 0
inc eax
sub ecx, 1
jne 0x401730
push ebx
call fcn.0040477b
add esp, 4
xor al, al
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040476d
mov esp, ebp
pop ebp
ret
test ecx, 0x2000
je 0x40179b
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0x218]
mov eax, ebx
test ecx, ecx
je 0x401845
mov byte [eax], 0
inc eax
sub ecx, 1
jne 0x401776
push ebx
call fcn.0040477b
add esp, 4
xor al, al
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040476d
mov esp, ebp
pop ebp
ret
nop dword [eax + eax]
test cl, 0x20
je 0x4017e9
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0x218]
mov eax, ebx
test ecx, ecx
je 0x4017cb
nop dword [eax + eax]
mov byte [eax], 0
lea eax, [eax + 1]
sub ecx, 1
jne 0x4017c0
push ebx
call fcn.0040477b
add esp, 4
mov al, 1
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040476d
mov esp, ebp
pop ebp
ret
or ecx, 0x20
mov word [edx + 0x16], cx
push dword [ebp - 0x218]
push ebx
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.KERNEL32.dll_FlushInstructionCache]
push 0
push 0
push 0
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x401861
call dword [sym.imp.KERNEL32.dll_GetLastError]
nop
test eax, eax
je 0x401861
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0x218]
mov eax, ebx
test ecx, ecx
je 0x401845
mov byte ds:[eax], 0
inc eax
sub ecx, 1
jne 0x401837
push ebx
call fcn.0040477b
add esp, 4
xor al, al
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040476d
mov esp, ebp
pop ebp
ret
push 0
lea eax, [ebp - 0x220]
mov dword [ebp - 0x220], 0
push eax
push dword [ebp - 0x218]
push ebx
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
push edi
mov esi, eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov edx, dword [ebp - 0x218]
mov ecx, ebx
test edx, edx
je 0x4018ab
nop dword [eax + eax]
mov byte [ecx], 0
lea ecx, [ecx + 1]
sub edx, 1
jne 0x4018a0
push ebx
call fcn.0040477b
add esp, 4
cmp esi, 1
jne 0x40190d
mov eax, dword [ebp - 0x220]
cmp eax, dword [ebp - 0x218]
sete al
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040476d
mov esp, ebp
pop ebp
ret
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor al, al
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040476d
mov esp, ebp
pop ebp
ret
push 0x10
push 0x41cc5c
push str.Failed_to_patch_file__incorrect_attributes__4GB_patch__
push 0
call dword [sym.imp.USER32.dll_MessageBoxW]
mov ecx, dword [ebp - 4]
xor al, al
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0040476d
mov esp, ebp
pop ebp
ret