Function at 0x40f400
Capabilities:
Read file on windows

Disassembly:
sub esp, 0x18
push ebx
push ebp
push esi
push edi
mov edi, eax
cmp dword [edi + 0x144], 1
jne 0x40f421
mov esi, edi
call fcn.0040f910
test eax, eax
je 0x40f4f2
mov eax, dword [edi + 0x1d8]
mov ecx, dword [eax + 4]
lea ebp, [edi + 0x1d4]
push ecx
mov ecx, ebp
call fcn.00406af0
mov eax, dword [ebp + 4]
mov ebx, dword [esp + 0x2c]
mov dword [eax + 4], eax
mov eax, dword [ebp + 4]
mov dword [ebp + 8], 0
mov dword [eax], eax
mov eax, dword [ebp + 4]
push 0x487268
push ebx
mov dword [eax + 8], eax
call dword [sym.imp.KERNEL32.dll_FindFirstFileA]
cmp eax, 0xffffffff
je 0x40f4f2
push eax
call dword [sym.imp.KERNEL32.dll_FindClose]
mov edx, edi
mov eax, ebx
sub edx, ebx
mov cl, byte [eax]
mov byte [edx + eax], cl
add eax, 1
test cl, cl
jne 0x40f476
push 0
push 0x10000080
push 4
push 0
push 3
push 0xc0000000
push ebx
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, 0xffffffff
mov dword [edi + 0x148], eax
jne 0x40f4fe
mov esi, dword [edi + 0x1f4]
mov edx, dword [esi + 0x24]
push 0x10000
mov byte [edx], 0
mov eax, dword [esi + 0x28]
push eax
push 0xffffffffffffffff
push ebx
push 0
push 0
call dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
mov esi, dword [esi + 0x28]
mov ecx, dword [0x476eec]
push esi
mov ebx, str.OpenFileFailed
call fcn.004187b0
push eax
call fcn.004059c0
mov ecx, dword [edi + 0x148]
add esp, 8
push ecx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret 4
push 0x7c
lea esi, [edi + 0x150]
push 0
push esi
call fcn.00440c10
mov eax, dword [edi + 0x148]
add esp, 0xc
push 0
push 0x487004
push 0x7c
push esi
push eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
cmp dword [0x487004], 0x7c
mov dword [0x487008], eax
je 0x40f545
push str.CE_CANNOT_READ_DISC_FILE
call fcn.004059c0
add esp, 4
jmp 0x40f549
test eax, eax
jne 0x40f594
mov edi, dword [edi + 0x1f4]
mov edx, dword [edi + 0x24]
push 0x10000
mov byte [edx], 0
mov eax, dword [edi + 0x28]
push eax
push 0xffffffffffffffff
push ebx
push 0
push 0
call dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
mov edi, dword [edi + 0x28]
mov ecx, dword [0x476eec]
push edi
mov ebx, str.ReadCPKHeadFailed
call fcn.004187b0
push eax
call fcn.004059c0
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret 4
cmp dword [esi], 0x1a545352
je 0x40f5c4
mov ecx, dword [0x476eec]
mov ebx, str.UnknowCPKFormat
call fcn.004187b0
mov edx, dword [esp + 0x2c]
mov esi, dword [edi + 0x1f4]
mov ebx, eax
call fcn.0040df00
push eax
push ebx
jmp 0x40f4dd
mov edx, dword [edi + 0x1d0]
cmp edx, dword [edi + 0x170]
jae 0x40f6f8
mov eax, dword [edi + 0x1cc]
test eax, eax
je 0x40f5f3
push eax
call fcn.0041a866
add esp, 4
mov dword [edi + 0x1cc], 0
mov eax, dword [edi + 0x170]
xor ecx, ecx
mov edx, 0x1c
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.0041a861
mov ecx, dword [edi + 0x170]
lea edx, [ecx*8]
sub edx, ecx
add edx, edx
add esp, 4
add edx, edx
push edx
xor esi, esi
push esi
push eax
mov dword [edi + 0x1cc], eax
call fcn.00440c10
mov eax, dword [edi + 0x170]
mov dword [edi + 0x1d0], eax
mov eax, dword [edi + 0x1e0]
add esp, 0xc
cmp eax, esi
je 0x40f65d
push eax
call fcn.0041a866
add esp, 4
mov dword [edi + 0x1e0], esi
mov eax, dword [edi + 0x1e4]
cmp eax, esi
je 0x40f676
push eax
call fcn.0041a866
add esp, 4
mov dword [edi + 0x1e4], esi
mov eax, dword [edi + 0x1d0]
xor ecx, ecx
mov edx, 4
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.0041a861
mov dword [edi + 0x1e0], eax
mov eax, dword [edi + 0x1d0]
xor ecx, ecx
add esp, 4
mov edx, 4
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.0041a861
mov ecx, dword [edi + 0x1e0]
mov dword [edi + 0x1e4], eax
mov eax, dword [edi + 0x1d0]
add eax, eax
add esp, 4
add eax, eax
push eax
push 0xffffffffffffffff
push ecx
call fcn.00440c10
mov edx, dword [edi + 0x1d0]
mov eax, dword [edi + 0x1e4]
add edx, edx
add esp, 0xc
add edx, edx
push edx
push 0xffffffffffffffff
push eax
call fcn.00440c10
add esp, 0xc
mov eax, dword [edi + 0x158]
mov ecx, dword [edi + 0x148]
push 0
push 0
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
test eax, eax
jne 0x40f752
mov ecx, dword [0x476eec]
mov ebx, str.CPKSeekError
call fcn.004187b0
mov ecx, dword [edi + 0x158]
mov edx, dword [esp + 0x2c]
mov esi, dword [edi + 0x1f4]
push ecx
mov ebx, eax
call fcn.0040df00
push eax
push ebx
call fcn.004059c0
add esp, 0xc
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret 4
mov eax, dword [edi + 0x170]
mov ecx, dword [edi + 0x148]
lea esi, [eax*8]
sub esi, eax
mov eax, dword [edi + 0x1cc]
add esi, esi
add esi, esi
call fcn.00411030
test eax, eax
jne 0x40f7b1
mov ecx, dword [0x476eec]
mov ebx, str.ReadCPKTableFailed
call fcn.004187b0
mov edx, dword [esp + 0x2c]
mov esi, dword [edi + 0x1f4]
mov ebx, eax
call fcn.0040df00
push eax
push ebx
call fcn.004059c0
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret 4
xor esi, esi
cmp dword [edi + 0x170], esi
jbe 0x40f808
xor eax, eax
mov dword [esp + 0x10], eax
mov edx, dword [edi + 0x1cc]
mov ecx, dword [eax + edx + 4]
add eax, edx
test cl, 1
je 0x40f7f2
test cl, 0x10
jne 0x40f7f2
mov eax, dword [eax]
lea ecx, [esp + 0x14]
push ecx
lea edx, [esp + 0x20]
push edx
mov ebx, ebp
mov dword [esp + 0x1c], eax
mov dword [esp + 0x20], esi
call fcn.00407270
mov eax, dword [esp + 0x10]
add esi, 1
add eax, 0x1c
cmp esi, dword [edi + 0x170]
mov dword [esp + 0x10], eax
jb 0x40f7c1
mov edx, edi
call fcn.0040fbf0
mov eax, dword [edi + 0x148]
push 0
push 0
push 0
push 2
push 0
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
test eax, eax
mov dword [edi + 0x14c], eax
jne 0x40f87e
mov ecx, dword [0x476eec]
mov ebx, str.CreateFileMappingFailed
call fcn.004187b0
mov edx, dword [esp + 0x2c]
mov esi, dword [edi + 0x1f4]
mov ebx, eax
call fcn.0040df00
push eax
push ebx
call fcn.004059c0
mov eax, dword [edi + 0x148]
add esp, 8
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [edi + 0x148], 0xffffffff
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret 4
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xb7
jne 0x40f8ee
mov ecx, dword [0x476eec]
mov ebx, str.FileMappingAlreadyExist
call fcn.004187b0
mov edx, dword [esp + 0x2c]
mov esi, dword [edi + 0x1f4]
mov ebx, eax
call fcn.0040df00
push eax
push ebx
call fcn.004059c0
mov ecx, dword [edi + 0x14c]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
add esp, 8
push ecx
call esi
mov edx, dword [edi + 0x148]
push edx
mov dword [edi + 0x14c], 0
call esi
mov dword [edi + 0x148], 0xffffffff
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret 4
mov eax, 1
mov dword [edi + 0x144], eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret 4