Function at 0x401910
Capabilities:
Read file on windows

Disassembly:
push edi
push esi
push ebx
sub esp, 0x20
mov ebx, dword [esp + 0x30]
mov eax, dword [ebx]
test eax, eax
je 0x401ba0
mov dword [esp + 8], 2
mov dword [esp + 4], 0
mov dword [esp], eax
call sub.msvcrt.dll_fseek
mov eax, dword [ebx]
mov dword [esp], eax
call sub.msvcrt.dll_ftell
mov edx, eax
mov esi, eax
mov eax, ebx
call fcn.00401550
test eax, eax
js 0x401a30
mov eax, dword [ebx + 0x18]
mov edi, dword [sym.imp.WS2_32.dll_ntohl]
mov dword [ebx + 0x406c], 0
mov dword [esp], eax
call edi
sub esi, eax
mov eax, dword [ebx + 0x1c]
sub esp, 4
mov dword [ebx + 4], esi
mov dword [esp], eax
call edi
sub esp, 4
add eax, esi
mov dword [esp + 8], 0
mov dword [esp + 4], eax
mov eax, dword [ebx]
mov dword [esp], eax
call sub.msvcrt.dll_fseek
mov eax, dword [ebx + 0x20]
mov dword [esp], eax
call edi
sub esp, 4
mov dword [esp], eax
call sub.msvcrt.dll_malloc
test eax, eax
mov dword [ebx + 8], eax
je 0x401c00
mov eax, dword [ebx + 0x20]
mov esi, dword [ebx]
mov dword [esp], eax
call edi
sub esp, 4
mov dword [esp + 0xc], esi
mov dword [esp + 8], 1
mov dword [esp + 4], eax
mov eax, dword [ebx + 8]
mov dword [esp], eax
call sub.msvcrt.dll_fread
test eax, eax
je 0x401bc0
mov esi, dword [ebx + 8]
mov eax, dword [ebx + 0x20]
mov dword [esp], eax
call edi
add eax, esi
sub esp, 4
mov dword [ebx + 0xc], eax
mov eax, dword [ebx]
mov dword [esp], eax
call sub.msvcrt.dll_ferror
test eax, eax
mov esi, eax
jne 0x401be0
mov eax, dword [ebx]
test eax, eax
je 0x401a25
mov dword [esp], eax
call sub.msvcrt.dll_fclose
mov dword [ebx], 0
add esp, 0x20
mov eax, esi
pop ebx
pop esi
pop edi
ret
mov dword [esp + 8], 0
mov dword [esp + 4], 0
lea esi, [esp + 0x1a]
mov eax, dword [ebx]
mov dword [esp + 0x1c], 0
mov dword [esp], eax
call sub.msvcrt.dll_fseek
mov eax, dword [ebx]
mov dword [esp + 8], 2
mov dword [esp + 4], 1
mov dword [esp], esi
mov dword [esp + 0xc], eax
call sub.msvcrt.dll_fread
cmp byte [esp + 0x1a], 0x4d
jne 0x401b88
cmp byte [esp + 0x1b], 0x5a
jne 0x401b88
mov dword [esp + 8], 0
mov dword [esp + 4], 0x3c
lea edi, [esp + 0x1c]
mov eax, dword [ebx]
mov dword [esp], eax
call sub.msvcrt.dll_fseek
mov eax, dword [ebx]
mov dword [esp + 8], 1
mov dword [esp + 4], 4
mov dword [esp], edi
mov dword [esp + 0xc], eax
call sub.msvcrt.dll_fread
mov eax, dword [esp + 0x1c]
mov dword [esp + 8], 0
add eax, 0x18
mov dword [esp + 4], eax
mov eax, dword [ebx]
mov dword [esp], eax
call sub.msvcrt.dll_fseek
mov eax, dword [ebx]
mov dword [esp], esi
mov esi, 0xffffffff
mov dword [esp + 8], 1
mov dword [esp + 4], 2
mov dword [esp + 0xc], eax
call sub.msvcrt.dll_fread
cmp byte [esp + 0x1a], 0xb
jne 0x401a25
movzx eax, byte [esp + 0x1b]
cmp al, 1
je 0x401bf6
cmp al, 2
jne 0x401b88
mov eax, 0xa8
add eax, dword [esp + 0x1c]
mov dword [esp + 8], 0
mov dword [esp + 4], eax
mov eax, dword [ebx]
mov dword [esp], eax
call sub.msvcrt.dll_fseek
mov eax, dword [ebx]
mov dword [esp + 8], 1
mov dword [esp + 4], 4
mov dword [esp], edi
mov dword [esp + 0xc], eax
call sub.msvcrt.dll_fread
mov esi, dword [esp + 0x1c]
cmp esi, 0
je 0x401b88
jle 0x401b88
lea edi, [esi - 8]
lea esi, [esi]
mov edx, esi
mov eax, ebx
call fcn.00401550
test eax, eax
jns 0x401959
sub esi, 1
cmp esi, edi
jne 0x401b70
add esp, 0x20
mov esi, 0xffffffff
mov eax, esi
pop ebx
pop esi
pop edi
ret
lea eax, [ebx + 0x68]
mov dword [esp + 4], 0x40c02c
mov dword [esp], eax
call fcn.00402ef0
test eax, eax
mov dword [ebx], eax
jne 0x401924
jmp 0x401b88
mov dword [esp], str.Could_not_read_from_file.
mov esi, 0xffffffff
call fcn.00401e10
jmp 0x401a25
mov dword [esp], str.Error_on_file
mov esi, 0xffffffff
call fcn.00401e10
jmp 0x401a25
mov eax, 0x98
jmp 0x401b27
mov dword [esp], str.Could_not_allocate_buffer_for_TOC.
mov esi, 0xffffffff
call fcn.00401e10
jmp 0x401a25