Function at 0x406800
Capabilities:
Read file on windows

Disassembly:
mov eax, dword [esp + 4]
sub esp, 0x10
cmp eax, dword [0x40d8e0]
push ebx
push esi
push edi
push ebp
jae 0x406a42
and eax, 0xffffffe7
sar eax, 3
lea ebp, [eax + 0x40d7e0]
mov eax, dword [esp + 0x24]
and eax, 0x1f
lea ebx, [eax*8]
mov eax, dword [ebp]
add eax, ebx
test byte [eax + 4], 1
je 0x406a42
mov edx, dword [esp + 0x28]
mov ecx, dword [esp + 0x2c]
mov dword [esp + 0x14], 0
test ecx, ecx
je 0x406a38
test byte [eax + 4], 2
jne 0x406a38
test byte [eax + 4], 0x48
je 0x406883
mov al, byte [eax + 5]
cmp al, 0xa
je 0x406883
mov byte [edx], al
inc edx
dec ecx
mov eax, dword [ebp]
mov dword [esp + 0x14], 1
mov byte [eax + ebx + 5], 0xa
lea eax, [esp + 0x18]
push 0
push eax
push ecx
push edx
mov ecx, dword [ebp]
mov edx, dword [ecx + ebx]
push edx
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x4068e9
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 5
jne 0x4068c4
pop ebp
mov dword [0x40b424], eax
mov eax, 0xffffffff
pop edi
mov dword [0x40b420], 9
pop esi
pop ebx
add esp, 0x10
ret
cmp eax, 0x6d
jne 0x4068d3
xor eax, eax
pop ebp
pop edi
pop esi
pop ebx
add esp, 0x10
ret
push eax
call fcn.00408c90
add esp, 4
mov eax, 0xffffffff
pop ebp
pop edi
pop esi
pop ebx
add esp, 0x10
ret
mov eax, dword [esp + 0x18]
mov ecx, dword [ebp]
add dword [esp + 0x14], eax
lea eax, [ecx + ebx + 4]
mov cl, byte [eax]
test cl, 0x80
je 0x406a2c
cmp dword [esp + 0x18], 0
je 0x406918
mov edx, dword [esp + 0x28]
cmp byte [edx], 0xa
jne 0x406918
or cl, 4
jmp 0x40691b
and cl, 0xfb
mov edi, dword [esp + 0x28]
mov byte [eax], cl
mov esi, edi
mov eax, dword [esp + 0x14]
add eax, edi
mov dword [esp + 0x1c], eax
cmp edi, eax
jae 0x406a24
mov al, byte [esi]
cmp al, 0x1a
je 0x406a11
cmp al, 0xd
je 0x40694b
inc esi
mov byte [edi], al
jmp 0x406a04
mov ecx, dword [esp + 0x1c]
dec ecx
cmp ecx, esi
jbe 0x406970
lea ecx, [esi + 1]
cmp byte [ecx], 0xa
jne 0x406967
add esi, 2
mov byte [edi], 0xa
jmp 0x406a04
mov esi, ecx
mov byte [edi], al
jmp 0x406a04
inc esi
push 0
lea eax, [esp + 0x1c]
lea ecx, [esp + 0x17]
push eax
mov edx, dword [ebp]
mov dword [esp + 0x1c], 0
push 1
mov eax, dword [edx + ebx]
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x4069a2
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esp + 0x14], eax
cmp dword [esp + 0x14], 0
jne 0x406a01
cmp dword [esp + 0x18], 0
je 0x406a01
mov eax, dword [ebp]
test byte [eax + ebx + 4], 0x48
je 0x4069d7
cmp byte [esp + 0x13], 0xa
jne 0x4069c6
mov byte [edi], 0xa
jmp 0x406a04
mov byte [edi], 0xd
inc edi
mov al, byte [esp + 0x13]
mov ecx, dword [ebp]
mov byte [ecx + ebx + 5], al
jmp 0x406a05
cmp dword [esp + 0x28], edi
jne 0x4069e9
cmp byte [esp + 0x13], 0xa
jne 0x4069e9
mov byte [edi], 0xa
jmp 0x406a04
mov eax, dword [esp + 0x24]
push 1
push 0xffffffffffffffff
push eax
call fcn.00406470
add esp, 0xc
cmp byte [esp + 0x13], 0xa
je 0x406a05
mov byte [edi], 0xd
inc edi
cmp dword [esp + 0x1c], esi
ja 0x406935
jmp 0x406a24
mov eax, dword [ebp]
lea eax, [eax + ebx + 4]
mov cl, byte [eax]
test cl, 0x40
jne 0x406a24
or cl, 2
mov byte [eax], cl
sub edi, dword [esp + 0x28]
mov dword [esp + 0x14], edi
mov eax, dword [esp + 0x14]
pop ebp
pop edi
pop esi
pop ebx
add esp, 0x10
ret
xor eax, eax
pop ebp
pop edi
pop esi
pop ebx
add esp, 0x10
ret
mov eax, 0xffffffff
pop ebp
mov dword [0x40b420], 9
mov dword [0x40b424], 0
pop edi
pop esi
pop ebx
add esp, 0x10
ret