Function at 0x10021580
Capabilities:
Get file size
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x48
push ebx
mov ebx, dword [ebp + 0xc]
push esi
push edi
test ebx, ebx
je 0x100215e6
push ebx
call fcn.10027920
add esp, 4
test eax, eax
je 0x100215e6
mov edi, dword [ebp + 0x20]
mov esi, dword [ebp + 0x18]
mov dword [ebp - 0xc], esi
test edi, edi
je 0x100215ae
test esi, esi
jle 0x100215e6
mov eax, dword [ebx]
xor ecx, ecx
mov dword [ebp - 4], ecx
cmp eax, 1
jne 0x100217aa
mov esi, dword [ebx + 4]
push eax
push ecx
push ecx
push esi
mov dword [ebp - 0x18], esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ebx, eax
mov dword [ebp - 8], ebx
cmp ebx, 0xffffffff
jne 0x100215ef
mov eax, dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 2
push 0
push 0
push esi
call eax
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
test edi, edi
jne 0x10021604
push edi
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov ecx, eax
sub ecx, ebx
mov dword [ebp - 0xc], ecx
jmp 0x10021607
mov ecx, dword [ebp + 0x18]
xor ebx, ebx
mov dword [ebp - 0x3c], 0
xor eax, eax
mov dword [ebp - 0x24], ebx
xor edi, edi
mov dword [ebp - 0x34], ebx
mov dword [ebp - 0x38], edi
mov dword [ebp + 0x14], eax
mov dword [ebp - 0x20], eax
test ecx, ecx
jle 0x100217a0
mov dword [ebp - 0x10], ecx
nop
push 0x1000
call fcn.1002b0bf
add esp, 4
lea ecx, [ebp - 0x14]
mov esi, eax
mov eax, 0x1000
cmp dword [ebp - 0x10], eax
mov dword [ebp - 0x30], esi
cmovl eax, dword [ebp - 0x10]
push 0
push ecx
push eax
push esi
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x100216f2
mov edx, dword [ebp - 0x14]
xor eax, eax
mov dword [ebp - 0x1c], 0
test edx, edx
je 0x10021699
mov cl, byte [eax + esi]
test cl, cl
je 0x1002168a
cmp cl, 0x1a
je 0x1002168a
inc eax
cmp eax, edx
jb 0x10021677
jmp 0x10021699
inc dword [ebp - 8]
mov edx, eax
mov dword [ebp - 0x14], edx
mov dword [ebp - 0x1c], 1
add dword [ebp + 0x14], edx
mov dword [ebp - 0x2c], edx
cmp edi, ebx
je 0x100216b0
mov dword [edi], esi
mov dword [edi + 4], edx
add edi, 8
mov dword [ebp - 0x38], edi
jmp 0x100216c6
lea eax, [ebp - 0x30]
push eax
push edi
lea ecx, [ebp - 0x3c]
call fcn.100212c0
mov ebx, dword [ebp - 0x34]
mov edi, dword [ebp - 0x38]
mov dword [ebp - 0x24], ebx
cmp dword [ebp - 0x1c], 0
jne 0x1002170b
cmp dword [ebp - 0x14], 0x1000
jne 0x1002170b
mov eax, dword [ebp - 0x20]
sub dword [ebp - 0x10], 0x1000
add eax, 0x1000
mov dword [ebp - 0x20], eax
cmp eax, dword [ebp - 0xc]
jl 0x10021630
jmp 0x1002170b
mov eax, dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 2
push 0
push 0
push dword [ebp - 0x18]
call eax
push esi
call fcn.1002b0a4
add esp, 4
mov ebx, dword [ebp + 0x14]
mov esi, dword [ebp - 0x3c]
test ebx, ebx
jle 0x1002176c
lea eax, [ebx + 1]
push eax
call fcn.10020b60
mov ecx, dword [ebp - 8]
add esp, 4
add ecx, ebx
mov dword [ebp - 4], eax
push 0
push 0
push ecx
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ebx, dword [ebp - 4]
cmp esi, edi
je 0x1002175f
nop
push dword [esi + 4]
push dword [esi]
push ebx
call fcn.100290f0
push dword [esi]
add ebx, dword [esi + 4]
call fcn.1002b0a4
add esi, 8
add esp, 0x10
cmp esi, edi
jne 0x10021740
mov eax, dword [ebp + 0x14]
mov ecx, dword [ebp - 4]
mov esi, dword [ebp - 0x3c]
mov byte [eax + ecx], 0
test esi, esi
je 0x100217a0
mov ecx, dword [ebp - 0x24]
sub ecx, esi
mov eax, esi
and ecx, 0xfffffff8
cmp ecx, 0x1000
jb 0x10021796
mov esi, dword [esi - 4]
add ecx, 0x23
sub eax, esi
add eax, 0xfffffffc
cmp eax, 0x1f
ja 0x10021a2b
push ecx
push esi
call fcn.10028393
add esp, 8
mov eax, dword [ebp - 4]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
cmp eax, 2
jne 0x1002182b
mov ebx, dword [ebx + 4]
mov ecx, ebx
mov eax, dword [ebx]
call dword [eax + 0x14]
mov edx, dword [ebx]
mov ecx, esi
mov dword [ebp - 0x28], eax
or eax, 0xffffffff
test edi, edi
cmove ecx, eax
lea eax, [ebp - 0x2c]
push eax
lea eax, [ebp - 0x24]
push eax
push ecx
push 0
mov ecx, ebx
call dword [edx + 0x30]
xor esi, esi
test eax, eax
jle 0x100217f2
mov edx, dword [ebp - 0x24]
mov cl, byte [edx + esi]
test cl, cl
je 0x100217f2
cmp cl, 0x1a
je 0x100217f2
inc esi
cmp esi, eax
jl 0x100217e1
lea eax, [esi + 1]
push eax
call fcn.10020b60
mov edx, dword [ebx]
add esp, 4
mov dword [ebp - 4], eax
mov ecx, ebx
mov eax, dword [ebp - 0x28]
add eax, esi
push 0
push eax
call dword [edx + 0x18]
push esi
push dword [ebp - 0x24]
push dword [ebp - 4]
call fcn.1002af80
mov ecx, dword [ebp - 4]
add esp, 0xc
mov ebx, dword [ebp + 0xc]
mov byte [esi + ecx], 0
mov eax, dword [ebx]
cmp eax, 3
jne 0x10021a22
mov ebx, dword [ebx + 4]
push 1
push 0
push 0
push ebx
mov dword [ebp - 0x10], ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov esi, eax
mov dword [ebp - 0x1c], esi
cmp esi, 0xffffffff
jne 0x10021867
push 2
push 0
push 0
push ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
test edi, edi
jne 0x1002187c
push edi
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov ecx, eax
sub ecx, esi
mov dword [ebp - 0xc], ecx
jmp 0x1002187f
mov ecx, dword [ebp + 0x18]
xor edi, edi
mov dword [ebp - 0x48], 0
xor eax, eax
mov dword [ebp - 0x28], edi
xor ebx, ebx
mov dword [ebp - 0x40], edi
mov dword [ebp - 0x44], ebx
mov dword [ebp - 0x14], eax
mov dword [ebp - 0x20], eax
test ecx, ecx
jle 0x100217a0
mov dword [ebp - 0x18], ecx
push 0x1000
call fcn.1002b0bf
add esp, 4
mov esi, eax
mov dword [ebp - 0x38], esi
push 1
push 0
push 0
push dword [ebp - 0x10]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ecx, 0x1000
mov dword [ebp - 0x2c], eax
cmp dword [ebp - 0x18], ecx
lea eax, [ebp - 8]
push 0
cmovl ecx, dword [ebp - 0x18]
push eax
push ecx
push esi
push dword [ebp - 0x10]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x1002199b
mov ecx, dword [ebp + 0xc]
mov dword [ebp - 0x24], 0
lea eax, [ecx + 0x10]
push eax
push dword [ecx + 0xc]
lea eax, [ecx + 0x34]
push eax
push dword [ebp - 8]
push esi
push dword [ebp - 0x2c]
call fcn.10026d20
mov edx, dword [ebp - 8]
add esp, 0x18
xor eax, eax
test edx, edx
je 0x10021942
nop dword [eax]
mov cl, byte [eax + esi]
test cl, cl
je 0x10021933
cmp cl, 0x1a
je 0x10021933
inc eax
cmp eax, edx
jb 0x10021920
jmp 0x10021942
inc dword [ebp - 0x1c]
mov edx, eax
mov dword [ebp - 8], edx
mov dword [ebp - 0x24], 1
add dword [ebp - 0x14], edx
mov dword [ebp - 0x34], edx
cmp ebx, edi
je 0x10021959
mov dword [ebx], esi
mov dword [ebx + 4], edx
add ebx, 8
mov dword [ebp - 0x44], ebx
jmp 0x1002196f
lea eax, [ebp - 0x38]
push eax
push ebx
lea ecx, [ebp - 0x48]
call fcn.100212c0
mov edi, dword [ebp - 0x40]
mov ebx, dword [ebp - 0x44]
mov dword [ebp - 0x28], edi
cmp dword [ebp - 0x24], 0
jne 0x100219b3
cmp dword [ebp - 8], 0x1000
jne 0x100219b3
mov eax, dword [ebp - 0x20]
sub dword [ebp - 0x18], 0x1000
add eax, 0x1000
mov dword [ebp - 0x20], eax
cmp eax, dword [ebp - 0xc]
jl 0x100218a6
jmp 0x100219b3
push 2
push 0
push 0
push dword [ebp - 0x10]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push esi
call fcn.1002b0a4
add esp, 4
mov edi, dword [ebp - 0x14]
mov esi, dword [ebp - 0x48]
test edi, edi
jle 0x10021a12
lea eax, [edi + 1]
push eax
call fcn.10020b60
add esp, 4
mov dword [ebp - 4], eax
mov eax, dword [ebp - 0x1c]
add eax, edi
push 0
push 0
push eax
push dword [ebp - 0x10]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edi, dword [ebp - 4]
cmp esi, ebx
je 0x10021a05
push dword [esi + 4]
push dword [esi]
push edi
call fcn.100290f0
push dword [esi]
add edi, dword [esi + 4]
call fcn.1002b0a4
add esi, 8
add esp, 0x10
cmp esi, ebx
jne 0x100219e6
mov eax, dword [ebp - 0x14]
mov ecx, dword [ebp - 4]
mov esi, dword [ebp - 0x48]
mov byte [eax + ecx], 0
test esi, esi
je 0x100217a0
mov ecx, dword [ebp - 0x28]
jmp 0x10021773
pop edi
pop esi
mov eax, ecx
pop ebx
mov esp, ebp
pop ebp
ret
call fcn.1002af28
int3