Function at 0x1004a85
Capabilities:
Get file size
Read file on windows

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x10
or dword [ebp - 0xc], 0xffffffff
push ebx
push esi
mov esi, dword [ebp + 8]
xor ebx, ebx
push edi
mov dword [ebp - 4], ebx
mov dword [ebp - 8], ebx
cmp esi, ebx
je 0x1004c95
mov edi, dword [ebp + 0xc]
cmp edi, ebx
je 0x1004c95
push 0x60c
push ebx
push esi
call sub.msvcrt.dll_memset
add esp, 0xc
push ebx
push 0x80
push 3
push ebx
push 1
push 0x80000000
push edi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0xc], eax
cmp eax, 0xffffffff
jne 0x1004afc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push edi
push 2
push 0x68
mov dword [ebp - 4], eax
call fcn.010042a0
add esp, 0x10
jmp 0x1004cb2
lea ecx, [ebp - 8]
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov dword [ebp + 8], eax
mov ecx, 0x4000000
cmp dword [ebp - 8], ebx
ja 0x1004c7e
cmp eax, ecx
ja 0x1004c7e
lea edi, [eax + 0x1fff]
shr edi, 0xd
shl edi, 0xd
cmp edi, eax
jae 0x1004b32
mov edi, eax
push edi
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov ebx, dword [sym.imp.KERNEL32.dll_HeapAlloc]
push eax
call ebx
mov dword [esi], eax
test eax, eax
jne 0x1004b67
push 0x18a
push 2
push 0x66
call fcn.010042a0
add esp, 0xc
mov dword [ebp - 4], 0xe
jmp 0x1004c9c
push 0
lea ecx, [ebp - 8]
push ecx
push dword [ebp + 8]
push eax
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x1004b9c
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push dword [ebp + 0xc]
mov dword [ebp - 4], eax
push 2
push 0x6a
call fcn.010042a0
add esp, 0x10
jmp 0x1004c9c
lea eax, [ebp - 0x10]
push eax
push dword [ebp - 8]
mov dword [ebp - 0x10], 0x1000
push dword [esi]
call dword [sym.imp.ADVAPI32.dll_IsTextUnicode]
test eax, eax
jne 0x1004c79
mov eax, dword [esi]
mov dword [ebp + 0xc], eax
push 2
mov eax, edi
pop ecx
mul ecx
mov edi, eax
mov eax, edx
sar eax, 0x1f
test edx, edx
jbe 0x1004bed
and dword [esi], 0
push 0x1a0
push ecx
push 0x66
call fcn.010042a0
add esp, 0xc
mov dword [ebp - 4], 0x216
jmp 0x1004c65
push edi
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call ebx
mov dword [esi], eax
test eax, eax
jne 0x1004c19
push 0x1a6
push 2
push 0x66
call fcn.010042a0
add esp, 0xc
mov dword [ebp - 4], 0xe
jmp 0x1004c65
shr edi, 1
push edi
push eax
push dword [ebp - 8]
push dword [ebp + 0xc]
push 0
push 0
call dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
mov dword [ebp - 8], eax
cmp eax, 0x459
jne 0x1004c40
mov dword [ebp - 4], 0xd
jmp 0x1004c51
test eax, eax
jne 0x1004c65
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 4], eax
test eax, eax
je 0x1004c65
push dword [ebp - 4]
push 0x1b3
push 2
push 0x6b
call fcn.010042a0
add esp, 0x10
push dword [ebp + 0xc]
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
jmp 0x1004c9c
shr dword [ebp - 8], 1
jmp 0x1004c9c
push ecx
push edi
push 1
push 0x69
call fcn.010042a0
add esp, 0x10
mov dword [ebp - 4], 0x216
jmp 0x1004c9c
mov dword [ebp - 4], 0x57
xor ebx, ebx
cmp dword [ebp - 0xc], ebx
je 0x1004cb2
cmp dword [ebp - 0xc], 0xffffffff
je 0x1004cb2
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [ebp - 4], ebx
jne 0x1004cca
mov eax, dword [esi]
mov ecx, dword [ebp - 8]
lea ecx, [eax + ecx*2]
mov dword [esi + 4], ecx
mov dword [esi + 0xc], eax
mov dword [esi + 0x14], eax
jmp 0x1004cd0
push esi
call fcn.01004a48
mov eax, dword [ebp - 4]
pop edi
pop esi
pop ebx
leave
ret 8