Function at 0x510200
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x14
push ebx
push esi
mov esi, dword [ebp + 8]
push edi
nop
mov edi, dword [esi + 4]
mov ecx, dword [esi + 8]
cmp edi, ecx
jb 0x510265
push 0
push 0
push 0x2000
lea edi, [esi + 0xc]
push edi
lea eax, [esp + 0x28]
push eax
push 0
push 0
push 0
push dword [esi]
call dword [sym.imp.ntdll.dll_NtReadFile]
lea ebx, [ebx]
test eax, eax
js 0x510508
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x510508
lea ecx, [esi + 0xc]
mov dword [esi + 4], edi
add ecx, eax
mov dword [esp + 0x10], edi
mov dword [esi + 8], ecx
jmp 0x51026c
lea eax, [esi + 0xc]
mov dword [esp + 0x10], eax
mov dl, byte [edi]
inc edi
mov eax, dword [ebp + 0xc]
mov dword [esi + 4], edi
movzx ebx, dl
mov eax, dword [eax]
sub eax, 0
mov dword [esp + 0x14], eax
mov eax, dword [esp + 0x10]
jne 0x510543
test bl, bl
jns 0x510514
cmp ebx, 0xfe
jne 0x5102d7
cmp edi, ecx
jb 0x5102ae
mov ecx, esi
call fcn.00510800
test eax, eax
js 0x510508
mov eax, dword ds:[esi + 4]
mov cl, byte [eax]
inc eax
mov dword [esi + 4], eax
cmp cl, 0xff
jne 0x510508
mov eax, dword [ebp + 0xc]
mov dword [eax], 1
jmp 0x510210
cmp dl, 0xff
jne 0x510317
lea esp, [esp]
cmp edi, ecx
jb 0x5102f3
mov ecx, esi
call fcn.00510800
test eax, eax
js 0x510508
mov eax, dword ds:[esi + 4]
mov cl, byte [eax]
inc eax
mov dword [esi + 4], eax
cmp cl, 0xfe
jne 0x510508
mov eax, dword [ebp + 0xc]
mov dword [eax], 2
jmp 0x510210
mov eax, ebx
and eax, 0xe0
cmp al, 0xc0
je 0x5104b9
mov eax, ebx
and eax, 0xf0
cmp al, 0xe0
jne 0x5103d7
cmp edi, ecx
jb 0x51034d
mov ecx, esi
call fcn.00510800
test eax, eax
js 0x510508
mov eax, dword ds:[esi + 4]
movzx ecx, byte [eax]
lea edx, [eax + 1]
mov eax, ecx
mov dword [esi + 4], edx
and al, 0xc0
cmp al, 0x80
jne 0x510508
and ebx, 0xf
and ecx, 0x3f
shl ebx, 6
or ebx, ecx
mov edi, ebx
cmp edx, dword [esi + 8]
jb 0x51038d
mov ecx, esi
call fcn.00510800
test eax, eax
js 0x510508
mov eax, dword ds:[esi + 4]
movzx ebx, byte [eax]
inc eax
mov dword [esi + 4], eax
mov eax, ebx
and al, 0xc0
cmp al, 0x80
jne 0x510508
and ebx, 0x3f
shl edi, 6
or ebx, edi
cmp ebx, 0x800
jb 0x5104f2
lea esp, [esp]
cmp ebx, 0xfeff
je 0x510210
mov eax, ebx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
mov eax, ebx
and eax, 0xf8
cmp al, 0xf0
jne 0x510508
cmp edi, ecx
jb 0x5103fb
mov ecx, esi
call fcn.00510800
test eax, eax
js 0x510508
mov eax, dword [esi + 4]
movzx ecx, byte [eax]
lea edx, [eax + 1]
mov eax, ecx
mov dword [esi + 4], edx
and al, 0xc0
cmp al, 0x80
jne 0x510508
and ebx, 7
and ecx, 0x3f
shl ebx, 6
or ebx, ecx
cmp edx, dword [esi + 8]
jb 0x510434
mov ecx, esi
call fcn.00510800
test eax, eax
js 0x510508
mov eax, dword [esi + 4]
movzx edi, byte [eax]
lea ecx, [eax + 1]
mov eax, edi
mov dword [esi + 4], ecx
and al, 0xc0
cmp al, 0x80
jne 0x510508
and edi, 0x3f
shl ebx, 6
or edi, ebx
cmp ecx, dword [esi + 8]
jb 0x51046d
mov ecx, esi
call fcn.00510800
test eax, eax
js 0x510508
mov eax, dword ds:[esi + 4]
movzx ebx, byte [eax]
inc eax
mov dword [esi + 4], eax
mov eax, ebx
and al, 0xc0
cmp al, 0x80
jne 0x510508
and ebx, 0x3f
shl edi, 6
or ebx, edi
cmp ebx, 0x10000
jae 0x510784
push ebx
push str.Invalid_UTF_8_sequence_for_character_0x_04x_
lfence
call fcn.0050fec0
add esp, 8
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
cmp edi, ecx
jb 0x5104c9
mov ecx, esi
call fcn.00510800
test eax, eax
js 0x510508
mov eax, dword [esi + 4]
movzx ecx, byte [eax]
inc eax
mov dword [esi + 4], eax
mov eax, ecx
and al, 0xc0
cmp al, 0x80
jne 0x510508
and ebx, 0x1f
and ecx, 0x3f
shl ebx, 6
or ebx, ecx
cmp ebx, 0x80
jae 0x510784
push ebx
push str.Invalid_UTF_8_sequence_for_character_0x_04x_
lfence
call fcn.0050fec0
add esp, 8
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
cmp dl, 0x20
jae 0x510784
lea ecx, [ecx]
cmp dl, 0xa
je 0x510784
cmp dl, 0xd
je 0x510784
cmp dl, 9
je 0x510784
push ebx
push str.Bad_control_character_0x_02x_not_allowed_by_XML_standard_
jmp 0x5104f8
mov edx, dword [esp + 0x14]
sub edx, 1
je 0x51066f
sub edx, 1
jne 0x510784
cmp edi, ecx
jb 0x510593
push edx
push edx
push 0x2000
push eax
lea eax, [esp + 0x28]
push eax
push edx
push edx
push edx
push dword [esi]
call dword [sym.imp.ntdll.dll_NtReadFile]
test eax, eax
js 0x510508
mov eax, dword ds:[esp + 0x1c]
test eax, eax
je 0x510508
mov edi, dword [esp + 0x10]
lea ecx, [esi + 0xc]
add ecx, eax
mov dword [esi + 4], edi
mov dword [esi + 8], ecx
movzx eax, byte [edi]
inc edi
shl eax, 8
or eax, ebx
mov dword [esi + 4], edi
mov ebx, eax
cmp eax, 0x20
jae 0x5105e6
cmp eax, 0xa
je 0x510784
cmp eax, 0xd
je 0x510784
jmp 0x5105c0
cmp eax, 9
je 0x510784
push ebx
push str.Bad_control_character_0x_02x_not_allowed_by_XML_standard_
lfence
call fcn.0050fec0
add esp, 8
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
add eax, 0xffff2800
cmp eax, 0x3ff
ja 0x510784
cmp edi, ecx
jb 0x51060d
mov ecx, esi
call fcn.00510800
test eax, eax
js 0x510508
mov eax, dword [esi + 4]
movzx edi, byte [eax]
inc eax
mov dword [esi + 4], eax
cmp eax, dword [esi + 8]
jb 0x51062d
mov ecx, esi
call fcn.00510800
test eax, eax
js 0x510508
mov eax, dword [esi + 4]
movzx ecx, byte [eax]
inc eax
shl ecx, 8
or ecx, edi
mov dword [esi + 4], eax
lea eax, [ecx - 0xdc00]
cmp eax, 0x3fe
ja 0x510508
and ebx, 0x3ff
and ecx, 0x3ff
shl ebx, 0xa
or ebx, ecx
add ebx, 0x10000
mov eax, ebx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
cmp edi, ecx
jb 0x5106b7
push 0
push 0
push 0x2000
push eax
lea eax, [esp + 0x28]
push eax
push 0
push 0
push 0
push dword [esi]
call dword [sym.imp.ntdll.dll_NtReadFile]
test eax, eax
js 0x510508
mov eax, dword ds:[esp + 0x1c]
test eax, eax
je 0x510508
mov edi, dword [esp + 0x10]
lea ecx, [esi + 0xc]
add ecx, eax
mov dword [esi + 4], edi
mov dword [esi + 8], ecx
movzx eax, byte [edi]
inc edi
shl ebx, 8
or ebx, eax
mov dword [esi + 4], edi
cmp ebx, 0x20
jae 0x510706
cmp ebx, 0xa
je 0x510784
cmp ebx, 0xd
je 0x510784
lea ebx, [ebx]
cmp ebx, 9
je 0x510784
push ebx
push str.Bad_control_character_0x_02x_not_allowed_by_XML_standard_
lfence
call fcn.0050fec0
add esp, 8
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
lea eax, [ebx - 0xd800]
cmp eax, 0x3ff
ja 0x510784
cmp edi, ecx
jb 0x51072d
mov ecx, esi
call fcn.00510800
test eax, eax
js 0x510508
mov eax, dword [esi + 4]
movzx edi, byte [eax]
inc eax
mov dword [esi + 4], eax
cmp eax, dword [esi + 8]
jb 0x51074d
mov ecx, esi
call fcn.00510800
test eax, eax
js 0x510508
mov eax, dword [esi + 4]
shl edi, 8
movzx ecx, byte [eax]
inc eax
or edi, ecx
mov dword [esi + 4], eax
lea eax, [edi - 0xdc00]
cmp eax, 0x3fe
ja 0x510508
and ebx, 0x3ff
and edi, 0x3ff
shl ebx, 0xa
or ebx, edi
add ebx, 0x10000
pop edi
pop esi
mov eax, ebx
pop ebx
mov esp, ebp
pop ebp
ret 8