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

Disassembly:
sub esp, 0x10
push ebx
push ebp
push esi
push edi
mov edi, dword [esp + 0x28]
test edi, edi
jne 0x50c119
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x10
ret
push edi
call fcn.0050f600
add esp, 4
test eax, eax
jne 0x50c12e
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret
mov ebx, dword [esp + 0x34]
test ebx, ebx
jg 0x50c140
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x10
ret
mov eax, dword [edi]
mov dword [esp + 0x10], 0
cmp eax, 1
jne 0x50c21e
mov edi, dword [edi + 4]
push eax
push 0
push 0
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ebp, eax
cmp ebp, 0xffffffff
mov dword [esp + 0x28], ebp
jne 0x50c177
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x10
ret
push 0
push edi
mov dword [esp + 0x18], 1
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov esi, eax
sub esi, ebx
sub esi, ebp
test esi, esi
jle 0x50c20b
push esi
call sub.MSVCRT.dll_void____cdecl_operator_new_unsigned_int_
add esp, 4
mov ebp, eax
push 1
push 0
push ebx
mov ebx, dword [sym.imp.KERNEL32.dll_SetFilePointer]
push edi
call ebx
lea eax, [esp + 0x18]
push 0
push eax
push esi
push ebp
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x50c1d2
push ebp
call sub.MSVCRT.dll_void___cdecl_operator_delete_void__
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret
mov ecx, dword [esp + 0x28]
push 0
push 0
push ecx
push edi
call ebx
lea edx, [esp + 0x18]
push 0
push edx
push esi
push ebp
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x50c1f6
mov dword [esp + 0x10], eax
push ebp
call sub.MSVCRT.dll_void___cdecl_operator_delete_void__
mov eax, dword [esp + 0x14]
add esp, 4
test eax, eax
je 0x50c3cf
push edi
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
mov eax, dword [esp + 0x10]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret
cmp eax, 2
jne 0x50c29f
mov esi, dword [edi + 4]
mov ecx, esi
mov eax, dword [esi]
call dword [eax + 0x14]
mov ecx, esi
mov ebp, eax
call fcn.0050f450
mov edi, eax
mov dword [esp + 0x10], 1
sub edi, ebx
sub edi, ebp
test edi, edi
jle 0x50c28b
mov edx, dword [esi]
push 1
push ebx
mov ecx, esi
call dword [edx + 0x18]
push edi
call sub.MSVCRT.dll_void____cdecl_operator_new_unsigned_int_
add esp, 4
mov ebx, eax
mov eax, dword [esi]
mov ecx, esi
push edi
push ebx
call dword [eax + 0x20]
mov edx, dword [esi]
push 0
push ebp
mov ecx, esi
call dword [edx + 0x18]
mov eax, dword [esi]
push edi
push ebx
mov ecx, esi
call dword [eax + 0x24]
mov edx, dword [esi]
mov ecx, esi
call dword [edx + 0x14]
push ebx
mov ebp, eax
call sub.MSVCRT.dll_void___cdecl_operator_delete_void__
add esp, 4
mov eax, dword [esi]
push ebp
mov ecx, esi
call dword [eax + 0x1c]
mov eax, dword [esp + 0x10]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret
cmp eax, 3
jne 0x50c3cf
mov esi, dword [edi + 4]
push 1
push 0
push 0
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
mov dword [esp + 0x14], eax
jne 0x50c2cb
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x10
ret
push 0
push esi
mov dword [esp + 0x18], 1
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov ecx, dword [esp + 0x14]
mov ebp, eax
sub ebp, ebx
sub ebp, ecx
test ebp, ebp
jle 0x50c3c8
push ebp
call sub.MSVCRT.dll_void____cdecl_operator_new_unsigned_int_
mov ecx, dword [esp + 0x38]
add esp, 4
mov ebx, eax
push 1
push 0
push ecx
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 1
push 0
push 0
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
lea edx, [esp + 0x18]
push 0
push edx
push ebp
push ebx
push esi
mov dword [esp + 0x3c], eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x50c341
push ebx
call sub.MSVCRT.dll_void___cdecl_operator_delete_void__
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret
mov ebp, dword [esp + 0x18]
lea eax, [edi + 0xc]
push eax
mov eax, dword [edi + 0x130]
lea ecx, [edi + 0x2c]
push eax
mov dword [esp + 0x24], ecx
push ecx
mov ecx, dword [esp + 0x34]
push ebp
push ebx
push ecx
call fcn.0050e160
mov edx, dword [esp + 0x2c]
add esp, 0x18
push 0
push 0
push edx
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 1
push 0
push 0
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edx, dword [esp + 0x1c]
lea ecx, [edi + 0xc]
push ecx
mov ecx, dword [edi + 0x130]
push ecx
push edx
push ebp
push ebx
push eax
call fcn.0050e160
add esp, 0x18
lea eax, [esp + 0x18]
push 0
push eax
push ebp
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x50c3b7
mov dword [esp + 0x10], eax
push ebx
call sub.MSVCRT.dll_void___cdecl_operator_delete_void__
mov eax, dword [esp + 0x14]
add esp, 4
test eax, eax
je 0x50c3cf
push esi
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
mov eax, dword [esp + 0x10]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret