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

Disassembly:
push 0xffffffffffffffff
push 0x46bbf8
mov eax, dword fs:[0]
push eax
sub esp, 0x24
push ebx
push ebp
push esi
push edi
mov eax, dword [0x4854a0]
xor eax, esp
push eax
lea eax, [esp + 0x38]
mov dword fs:[0], eax
mov ebp, dword [esp + 0x48]
or ebx, 0xffffffff
cmp dword [ebp + 0x30], ebx
je 0x40614d
mov eax, 8
jmp 0x406416
mov edi, ecx
mov esi, ebp
mov dword [ebp + 0x34], SysStringLen
call fcn.004060a0
mov esi, dword [esp + 0x4c]
xor edi, edi
mov eax, esi
mov dword [esp + 0x34], 0xf
mov dword [esp + 0x30], edi
mov byte [esp + 0x20], 0
lea edx, [eax + 1]
lea esp, [esp]
mov cl, byte [eax]
add eax, 1
test cl, cl
jne 0x406180
sub eax, edx
push eax
push esi
lea ecx, [esp + 0x24]
call fcn.00403a90
push ebx
push edi
lea eax, [esp + 0x24]
push eax
lea ecx, [ebp + 0x14]
mov dword [esp + 0x4c], edi
call fcn.00402f60
mov dword [esp + 0x40], ebx
cmp dword [esp + 0x34], 0x10
jb 0x4061c1
mov ecx, dword [esp + 0x20]
push ecx
call fcn.0041bf87
add esp, 4
push edi
push 0x80
push 3
push edi
push 1
push SysReAllocStringLen
push esi
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, ebx
mov dword [ebp + 0x30], eax
je 0x4063f8
push 0x18
call fcn.0041bf5c
add esp, 4
push edi
lea edx, [esp + 0x4c]
push edx
push 0x18
push eax
mov dword [ebp], eax
mov eax, dword [ebp + 0x30]
push eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x406218
mov eax, ebp
call fcn.00412a10
mov eax, 5
jmp 0x406416
cmp dword [esp + 0x48], 0x18
jne 0x406207
mov edx, dword [ebp]
cmp word [edx], 0x4b50
je 0x40623a
mov eax, ebp
call fcn.00412a10
mov eax, 3
jmp 0x406416
lea eax, [edx + 2]
mov edi, 0x4775d0
mov esi, eax
mov ecx, 4
xor ebx, ebx
repe cmpsb byte [esi], byte es:[edi]
jne 0x406258
mov dword [ebp + 0x38], 3
jmp 0x406290
mov edi, 0x4775d4
mov esi, eax
mov ecx, 4
xor ebx, ebx
repe cmpsb byte [esi], byte es:[edi]
jne 0x406273
mov dword [ebp + 0x38], 2
jmp 0x406290
mov esi, eax
mov edi, 0x4775d8
mov ecx, 4
xor eax, eax
repe cmpsb byte [esi], byte es:[edi]
jne 0x40640a
mov dword [ebp + 0x38], 1
mov al, byte [edx + 0x14]
cmp al, 0xbe
jne 0x4062b3
mov edi, ebp
call fcn.00407800
test eax, eax
jne 0x4062bb
mov eax, ebp
call fcn.00412a10
mov eax, 7
jmp 0x406416
cmp al, 0xed
jne 0x406229
mov ecx, dword [ebp + 0x30]
push 0
push ecx
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov edx, dword [ebp]
sub eax, dword [edx + 0x10]
cmp eax, 4
jb 0x406229
mov ecx, ebp
call fcn.00406750
test eax, eax
je 0x406207
lea eax, [ebp + 4]
call fcn.0040e1f0
push 0x18
mov ebx, eax
call fcn.0041bf5c
add esp, 4
test eax, eax
je 0x406317
mov dword [eax], 0
mov dword [eax + 4], 1
mov dword [eax + 8], 2
mov byte [eax + 0x14], 1
jmp 0x406319
xor eax, eax
mov ecx, 0x400
cmp ecx, ebx
sbb esi, esi
and esi, 0x300
add esi, 0x100
mov edi, eax
mov dword [ebp + 0x140], eax
call fcn.0040e400
xor edi, edi
test ebx, ebx
jbe 0x40636d
lea esi, [ebp + 4]
call fcn.0040e210
mov eax, dword [eax]
cmp dword [eax + 0x18], 0x10
jb 0x406356
mov eax, dword [eax + 4]
jmp 0x406359
add eax, 4
mov esi, dword [ebp + 0x140]
push edi
push eax
call fcn.0040e510
add edi, 1
cmp edi, ebx
jb 0x406341
mov edi, ebp
call fcn.004075f0
test eax, eax
jne 0x406389
mov eax, ebp
call fcn.00412a10
mov eax, 0x11
jmp 0x406416
mov edx, dword [ebp + 0x30]
push edx
mov dword [ebp + 0x34], 0x40000000
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esp + 0x4c]
push 0
push 0x80
push 3
push 0
push 0
push 0x40000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, 0xffffffff
mov dword [ebp + 0x30], eax
je 0x4063f8
mov ecx, dword [ebp]
push 0
push 0
mov byte [ecx + 0x14], 0xbe
mov edx, dword [ebp + 0x30]
push 0
push edx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ecx, dword [ebp]
mov edx, dword [ebp + 0x30]
push 0
lea eax, [esp + 0x1c]
push eax
push 0x18
push ecx
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x4063ff
mov eax, ebp
call fcn.00412a10
mov eax, 1
jmp 0x406416
cmp dword [esp + 0x18], 0x18
jne 0x4063f1
xor eax, eax
jmp 0x406416
mov eax, ebp
call fcn.00412a10
mov eax, 4
mov ecx, dword [esp + 0x38]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x30
ret 8