Function at 0x405120
Capabilities:
Read file on windows

Disassembly:
sub esp, 0x40
push ebx
mov ebx, dword [esp + 0x4c]
push ebp
push esi
test ebx, ebx
push edi
je 0x40513a
mov eax, dword [esp + 0x5c]
test eax, eax
je 0x40513a
mov byte [ebx], 0
mov esi, dword [esp + 0x54]
test esi, esi
je 0x405212
mov edi, dword [sym.imp.KERNEL32.dll_lstrlenA]
push esi
call edi
cmp eax, 5
jl 0x405212
push esi
call edi
lea eax, [eax + esi - 4]
push eax
push str..TTF
call dword [sym.imp.KERNEL32.dll_lstrcmpiA]
test eax, eax
jne 0x405212
test ebx, ebx
je 0x405212
cmp dword [esp + 0x5c], 2
jb 0x405212
push 0
push 0
push 3
push 0
push 1
push 0x80000000
push esi
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov edi, eax
cmp edi, 0xffffffff
je 0x405212
lea ecx, [esp + 0x54]
push 0
push ecx
lea edx, [esp + 0x3c]
push 0xc
push edx
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x40520b
cmp dword [esp + 0x54], 0xc
jne 0x40520b
mov ax, word [esp + 0x38]
xor ebx, ebx
mov bh, al
xor esi, esi
mov bl, ah
test ebx, ebx
jbe 0x40520b
mov ebp, 0x10
cmp esi, 0x28
jae 0x40520b
lea eax, [esp + 0x54]
push 0
push eax
lea ecx, [esp + 0x2c]
push ebp
push ecx
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x40520b
cmp dword [esp + 0x54], ebp
jne 0x40520b
cmp dword [esp + 0x24], 0x656d616e
je 0x40521c
inc esi
cmp esi, ebx
jb 0x4051d9
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x40
ret
mov eax, dword [esp + 0x2c]
push 0
mov esi, eax
mov edx, eax
mov ecx, eax
and esi, 0xff0000
shr edx, 0x10
shl ecx, 0x10
and eax, 0xff00
or esi, edx
or ecx, eax
push 0
shr esi, 8
shl ecx, 8
or esi, ecx
push esi
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, esi
jne 0x40520b
mov esi, dword [sym.imp.KERNEL32.dll_ReadFile]
lea edx, [esp + 0x54]
push 0
push edx
lea eax, [esp + 0x18]
push 6
push eax
push edi
call esi
test eax, eax
je 0x40520b
cmp dword [esp + 0x54], 6
jne 0x40520b
mov eax, dword [esp + 0x12]
xor ecx, ecx
mov ch, al
mov cl, ah
mov ebp, ecx
mov edx, ebp
dec ebp
test edx, edx
je 0x40520b
mov ebx, dword [esp + 0x60]
lea eax, [esp + 0x54]
push 0
push eax
lea ecx, [esp + 0x20]
push 0xc
push ecx
push edi
call esi
test eax, eax
je 0x40520b
cmp dword [esp + 0x54], 0xc
jne 0x40520b
cmp ebx, 1
jne 0x4052d8
mov ax, word [esp + 0x18]
xor edx, edx
mov dl, ah
mov dh, al
cmp dx, bx
jne 0x405312
mov ax, word [esp + 0x1e]
xor ecx, ecx
mov cl, ah
mov ch, al
cmp cx, 5
je 0x40532e
jmp 0x405312
test ebx, ebx
jne 0x405312
mov ax, word [esp + 0x18]
xor edx, edx
mov dl, ah
mov dh, al
cmp dx, 3
jne 0x405312
mov ax, word [esp + 0x1c]
xor ecx, ecx
mov cl, ah
mov ch, al
cmp cx, word [0x41223e]
jne 0x405312
mov ax, word [esp + 0x1e]
xor edx, edx
mov dl, ah
mov dh, al
cmp dx, 4
je 0x40532e
mov eax, ebp
dec ebp
test eax, eax
jne 0x40528c
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x40
ret
mov eax, dword [esp + 0x2c]
mov ebp, dword [esp + 0x5c]
mov esi, eax
mov ecx, eax
mov edx, eax
and esi, 0xff0000
shr ecx, 0x10
shl edx, 0x10
and eax, 0xff00
or esi, ecx
or edx, eax
mov ax, word [esp + 0x14]
xor ecx, ecx
xor ebx, ebx
shr esi, 8
shl edx, 8
mov ch, al
or esi, edx
mov cl, ah
mov ax, word [esp + 0x22]
xor edx, edx
add esi, ecx
mov dh, al
mov dl, ah
mov eax, dword [esp + 0x20]
mov bh, al
add esi, edx
mov bl, ah
dec ebp
cmp ebp, ebx
jbe 0x405388
mov dword [esp + 0x5c], ebx
mov ebp, ebx
push 0
push 0
push esi
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, esi
jne 0x40520b
mov esi, dword [esp + 0x58]
lea eax, [esp + 0x54]
push 0
push eax
push ebp
push esi
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x40520b
cmp ebp, dword [esp + 0x54]
jne 0x40520b
push edi
mov byte [esi + ebp], 0
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
lea eax, [ebx + 1]
pop ebp
pop ebx
add esp, 0x40
ret