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

Disassembly:
push ecx
push ecx
push ebx
push ebp
push esi
push edi
push dword [0x44d13c]
xor ebx, ebx
mov ebp, ebx
call fcn.004171ac
mov edi, eax
call fcn.0040cf46
mov esi, dword [esp + 0x1c]
test esi, esi
jne 0x40cf81
mov esi, 0x43f00f
push ebx
push pe_nt_image_headers32
push 3
push ebx
push 1
push 0xc0000000
mov dword [edi + 0xc], ebx
mov ebx, dword [sym.imp.KERNEL32.dll_CreateFileA]
push esi
call ebx
mov dword [edi], eax
cmp eax, 0xffffffff
jne 0x40d020
push 0
push pe_nt_image_headers32
push 3
push 0
push 1
push 0x80000000
push esi
call ebx
mov dword [edi], eax
cmp eax, 0xffffffff
jne 0x40cfd7
push 0
push pe_nt_image_headers32
push 3
push 0
push 3
push 0x80000000
push esi
call ebx
mov dword [edi], eax
cmp dword [edi], 0xffffffff
mov dword [edi + 0xc], 1
jne 0x40d020
mov eax, dword [esp + 0x20]
xor ebx, ebx
push esi
mov dword [edi], ebx
mov dword [edi + 0x2c], eax
mov dword [edi + 0x18], ebx
call sub.MSVCRT.dll_strlen
pop ecx
inc eax
push eax
push ebx
push dword [0x44cb44]
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov dword [edi + 4], eax
test eax, eax
je 0x40d1f0
push esi
push eax
call sub.MSVCRT.dll_strcpy
pop ecx
pop ecx
jmp 0x40d1f0
push 0
push dword [edi]
call dword [sym.imp.KERNEL32.dll_GetFileSize]
and dword [edi + 0x18], ebp
mov ebx, eax
mov eax, dword [esp + 0x20]
mov esi, dword [sym.imp.KERNEL32.dll_ReadFile]
mov dword [edi + 0x2c], eax
cmp ebx, 3
jl 0x40d08b
push 0
lea eax, [esp + 0x18]
push eax
push 3
lea eax, [esp + 0x1c]
push eax
push dword [edi]
call esi
cmp dword [esp + 0x14], 3
jne 0x40d07e
push 3
lea eax, [esp + 0x14]
push 0x43f014
push eax
call sub.MSVCRT.dll_memcmp
add esp, 0xc
test eax, eax
jne 0x40d07e
mov dword [edi + 0x18], 0xfde9
sub ebx, 3
jmp 0x40d08b
xor eax, eax
push eax
push eax
push eax
push dword [edi]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
test ebx, ebx
jle 0x40d0b9
lea eax, [ebx + 2]
push eax
push 0
push dword [0x44cb44]
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov dword [edi + 0x10], eax
test eax, eax
je 0x40d0b9
push 0
lea ecx, [esp + 0x18]
push ecx
push ebx
push eax
push dword [edi]
call esi
mov ebx, dword [esp + 0x14]
mov eax, dword [edi + 0x10]
test eax, eax
je 0x40d1f0
xor ecx, ecx
mov word [eax + ebx], cx
mov esi, dword [edi + 0x10]
push 0xa
lea eax, [esi + ebx]
mov dword [edi + 0x14], eax
pop ebx
cmp esi, eax
jae 0x40d1f0
mov al, byte [esi]
cmp al, 0x20
je 0x40d0e8
cmp al, 9
jne 0x40d0eb
inc esi
jmp 0x40d0de
mov al, byte [esi]
cmp al, 0x3b
jne 0x40d12a
inc esi
cmp byte [esi], 0x20
jne 0x40d0f8
inc esi
push esi
push 2
lea eax, [edi + 0x1c]
push ebp
push eax
call fcn.0040d209
add esp, 0x10
mov ebp, eax
jmp 0x40d120
mov cl, byte [esi]
cmp cl, bl
je 0x40d1d9
cmp cl, 0xd
je 0x40d1d9
inc esi
cmp byte [esi], 0
jne 0x40d10c
jmp 0x40d1d9
cmp al, 0x5b
jne 0x40d172
inc esi
lea eax, [edi + 0x1c]
push esi
push 1
push ebp
push eax
call fcn.0040d209
add esp, 0x10
mov ebp, eax
jmp 0x40d152
mov al, byte [esi]
cmp al, 0x5d
je 0x40d15c
cmp al, bl
je 0x40d157
cmp al, 0xd
je 0x40d157
inc esi
cmp byte [esi], 0
jne 0x40d143
cmp byte [esi], 0x5d
jne 0x40d1d9
mov byte [esi], 0
jmp 0x40d169
cmp al, bl
je 0x40d1dc
cmp al, 0xd
je 0x40d1dd
inc esi
mov al, byte [esi]
test al, al
jne 0x40d161
jmp 0x40d1dd
cmp al, bl
je 0x40d1dd
cmp al, 0xd
je 0x40d1dd
mov edx, esi
jmp 0x40d18d
cmp al, 0x3d
je 0x40d191
cmp al, 0xd
je 0x40d191
cmp al, bl
je 0x40d191
inc esi
mov al, byte [esi]
test al, al
jne 0x40d17e
lea eax, [esi - 1]
jmp 0x40d1a3
mov cl, byte [eax]
cmp cl, 0x20
je 0x40d1a2
cmp cl, 9
jne 0x40d1a7
dec eax
cmp eax, edx
ja 0x40d196
mov byte [eax + 1], 0
inc esi
mov al, byte [esi]
cmp al, 0x20
je 0x40d1ab
cmp al, 9
je 0x40d1ab
push esi
push edx
lea eax, [edi + 0x1c]
push ebp
push eax
call fcn.0040d209
add esp, 0x10
mov ebp, eax
jmp 0x40d1d4
mov al, byte [esi]
cmp al, bl
je 0x40d1d9
cmp al, 0xd
je 0x40d1d9
inc esi
cmp byte [esi], 0
jne 0x40d1c9
mov byte [esi], 0
inc esi
mov al, byte [esi]
cmp al, bl
je 0x40d1dc
cmp al, 0xd
je 0x40d1dc
cmp esi, dword [edi + 0x14]
jb 0x40d0de
mov eax, dword [edi]
pop edi
pop esi
pop ebp
pop ebx
pop ecx
pop ecx
ret 8