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

Disassembly:
sub esp, 0x30
mov eax, dword [0x40d018]
xor eax, esp
mov dword [esp + 0x2c], eax
push ebp
push esi
mov esi, dword [esp + 0x3c]
mov eax, dword [esi + 0x1c]
imul eax, eax, 0x10c
push edi
add eax, 0xf
push eax
xor ebp, ebp
push 0x40
mov dword [esi], 0xffffffff
mov dword [esi + 8], ebp
mov dword [esp + 0x14], eax
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov edi, eax
cmp edi, ebp
mov dword [esp + 0x18], edi
mov dword [esi + 4], edi
jne 0x4021ca
pop edi
pop esi
xor eax, eax
pop ebp
mov ecx, dword [esp + 0x2c]
xor ecx, esp
call fcn.0040332a
add esp, 0x30
ret
mov eax, dword [esp + 0xc]
mov edx, eax
shr edx, 9
add edx, 1
mov dword [esi + 0x18], edx
mov dword [esi + 0x14], eax
mov dword [esi + 0xc], edi
lea ecx, [edi + eax]
mov dword [esi + 0x10], ecx
mov edx, dword [str.N000FF_n]
mov dword [edi], edx
mov dx, word [0x40a480]
mov word [edi + 4], dx
mov dl, byte [0x40a482]
mov byte [edi + 6], dl
mov edx, dword [esi + 0x1c]
lea eax, [edi + 0xf]
mov ecx, eax
mov dword [edi + 0xb], edx
cmp dword [esi + 0x1c], ebp
push ebx
mov dword [esp + 0x18], eax
mov dword [esp + 0x28], ecx
mov dword [esp + 0x20], ebp
jbe 0x4023a4
add eax, 8
lea ebx, [esi + 0x84]
mov dword [esp + 0x14], eax
lea ebp, [esi + 0x20]
mov dword [esp + 0x24], ebx
push 0
push 0x80
push 3
push 0
push 0
push bind
push ebx
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, 0xffffffff
mov dword [ebp], eax
je 0x4023d6
push 0
push eax
call dword [sym.imp.KERNEL32.dll_GetFileSize]
add dword [esi + 0x14], eax
mov dword [esp + 0x10], eax
shr eax, 9
add eax, 1
add dword [esi + 0x18], eax
mov edx, dword [ebp]
push 0
lea eax, [esp + 0x14]
push eax
push 0xf
lea ecx, [esp + 0x38]
push ecx
push edx
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x4023d6
cmp dword [esp + 0x10], 0xf
jne 0x4023d6
mov eax, 7
mov ecx, str.B000FF_n
lea edx, [esp + 0x2c]
lea ecx, [ecx]
mov ebx, dword [edx]
cmp ebx, dword [ecx]
jne 0x4022c8
sub eax, 4
add ecx, 4
add edx, 4
cmp eax, 4
jae 0x4022b0
test eax, eax
je 0x40232d
movzx edi, byte [edx]
movzx ebx, byte [ecx]
sub edi, ebx
jne 0x402317
sub eax, 1
add ecx, 1
add edx, 1
test eax, eax
je 0x402329
movzx edi, byte [edx]
movzx ebx, byte [ecx]
sub edi, ebx
jne 0x402317
sub eax, 1
add ecx, 1
add edx, 1
test eax, eax
je 0x402329
movzx edi, byte [edx]
movzx ebx, byte [ecx]
sub edi, ebx
jne 0x402317
sub eax, 1
add ecx, 1
add edx, 1
test eax, eax
je 0x402329
movzx edi, byte [edx]
movzx eax, byte [ecx]
sub edi, eax
je 0x402329
test edi, edi
mov edi, dword [esp + 0x1c]
mov eax, 1
jg 0x40232f
or eax, 0xffffffff
jmp 0x40232f
mov edi, dword [esp + 0x1c]
xor eax, eax
test eax, eax
jne 0x4023d6
mov ecx, dword [esp + 0x33]
mov edx, dword [esp + 0x18]
mov ebx, dword [esp + 0x24]
mov dword [edx], ecx
mov eax, dword [esp + 0x37]
mov edx, dword [esp + 0x14]
mov dword [edx - 4], eax
mov eax, ebx
sub edx, ebx
mov cl, byte [eax]
mov byte [edx + eax], cl
add eax, 1
test cl, cl
jne 0x402354
mov ecx, dword [ebp]
push 0
push 0
push 0
push ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov eax, dword [esp + 0x20]
mov ecx, 0x10c
add dword [esp + 0x18], ecx
add dword [esp + 0x14], ecx
add eax, 1
add ebx, 0x104
add ebp, 4
cmp eax, dword [esi + 0x1c]
mov dword [esp + 0x20], eax
mov dword [esp + 0x24], ebx
jb 0x402236
mov ecx, dword [esp + 0x28]
xor ebp, ebp
mov dword [edi + 7], ebp
cmp ecx, dword [esi + 0x10]
jae 0x4023be
lea esp, [esp]
movzx edx, byte [ecx]
add dword [edi + 7], edx
add ecx, 1
cmp ecx, dword [esi + 0x10]
jb 0x4023b0
pop ebx
pop edi
pop esi
mov eax, 1
pop ebp
mov ecx, dword [esp + 0x2c]
xor ecx, esp
call fcn.0040332a
add esp, 0x30
ret
push esi
call fcn.00401990
mov ecx, dword [esp + 0x40]
add esp, 4
pop ebx
pop edi
pop esi
pop ebp
xor ecx, esp
xor eax, eax
call fcn.0040332a
add esp, 0x30
ret