Function at 0x406566
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x4c
push ebx
push esi
push edi
xor ebx, ebx
push ebx
push 0x80
push 3
push ebx
push 1
push 0x80000000
push dword [ebp + 8]
mov dword [ebp - 0x10], ebx
mov dword [ebp - 0xc], ebx
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [ebp - 8], eax
cmp eax, 0xffffffff
je 0x40687f
mov esi, dword [sym.imp.KERNEL32.dll_ReadFile]
push ebx
lea ecx, [ebp - 0xc]
push ecx
push 0xc
lea ecx, [ebp - 0x2c]
push ecx
push eax
call esi
mov eax, dword [ebp - 0x28]
movzx ecx, byte [ebp - 0x2c]
movzx edx, byte [ebp - 0x2a]
shr eax, 8
movzx edi, al
movzx eax, byte [ebp - 0x28]
shl ax, 8
or di, ax
mov eax, dword [ebp - 0x2c]
shr eax, 8
shl cx, 8
movzx eax, al
or ax, cx
mov word [ebp - 0x28], di
mov ecx, dword [ebp - 0x2a]
shr ecx, 8
movzx ecx, cl
shl dx, 8
or cx, dx
mov word [ebp - 0x2c], ax
mov word [ebp - 0x2a], cx
cmp ax, 1
jne 0x406884
cmp cx, bx
jne 0x406884
xor eax, eax
mov dword [ebp - 4], ebx
cmp ax, di
jae 0x406876
push ebx
lea eax, [ebp - 0xc]
push eax
push 0x10
lea eax, [ebp - 0x4c]
push eax
push dword [ebp - 8]
call esi
push 5
lea eax, [ebp - 0x4c]
push eax
lea eax, [ebp - 0x18]
push eax
call dword [sym.imp.KERNEL32.dll_lstrcpynA]
lea eax, [ebp - 0x18]
push eax
push str.name
mov byte [ebp - 0x14], bl
call dword [sym.imp.KERNEL32.dll_lstrcmpA]
test eax, eax
je 0x406660
movzx eax, word [ebp - 0x28]
inc dword [ebp - 4]
cmp dword [ebp - 4], eax
jl 0x406619
jmp 0x406876
movzx ecx, byte [ebp - 0x40]
mov edx, dword [ebp - 0x40]
mov eax, dword [ebp - 0x40]
shr edx, 8
shl cx, 8
movzx edx, dl
movzx ecx, cx
or ecx, edx
shr eax, 0x10
movzx edx, al
shl dx, 8
shr eax, 8
movzx edx, dx
movzx eax, al
shl ecx, 0x10
or ecx, edx
mov edx, dword [ebp - 0x44]
or ecx, eax
movzx eax, byte [ebp - 0x44]
shl ax, 8
shr edx, 8
mov dword [ebp - 0x40], ecx
mov ecx, dword [ebp - 0x44]
movzx eax, ax
movzx edx, dl
or eax, edx
shr ecx, 0x10
movzx edx, cl
shl dx, 8
movzx edx, dx
shr ecx, 8
shl eax, 0x10
movzx ecx, cl
push ebx
or eax, edx
or eax, ecx
push ebx
push eax
push dword [ebp - 8]
mov dword [ebp - 0x44], eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push ebx
lea eax, [ebp - 0xc]
push eax
push 6
lea eax, [ebp - 0x20]
push eax
push dword [ebp - 8]
call esi
mov eax, dword [ebp - 0x1e]
movzx ecx, byte [ebp - 0x1e]
movzx edx, byte [ebp - 0x1c]
shr eax, 8
shl cx, 8
movzx eax, al
or ax, cx
mov ecx, dword [ebp - 0x1c]
shr ecx, 8
movzx ecx, cl
shl dx, 8
or cx, dx
mov word [ebp - 0x1c], cx
xor ecx, ecx
mov word [ebp - 0x1e], ax
mov dword [ebp - 4], ebx
cmp cx, ax
jae 0x406876
push ebx
lea eax, [ebp - 0xc]
push eax
push 0xc
lea eax, [ebp - 0x3c]
push eax
push dword [ebp - 8]
call esi
mov eax, dword [ebp - 0x36]
movzx ecx, byte [ebp - 0x36]
movzx edx, byte [ebp - 0x3c]
shl cx, 8
shr eax, 8
movzx eax, al
or ax, cx
mov ecx, dword [ebp - 0x3c]
shr ecx, 8
movzx ecx, cl
shl dx, 8
or cx, dx
movzx edx, byte [ebp - 0x38]
mov word [ebp - 0x3c], cx
mov word [ebp - 0x36], ax
mov ecx, dword [ebp - 0x38]
shr ecx, 8
movzx ecx, cl
shl dx, 8
or cx, dx
movzx edx, byte [ebp - 0x32]
mov word [ebp - 0x38], cx
mov ecx, dword [ebp - 0x34]
shr ecx, 8
movzx edi, cl
movzx ecx, byte [ebp - 0x34]
shl cx, 8
or di, cx
mov ecx, dword [ebp - 0x32]
shr ecx, 8
movzx ecx, cl
shl dx, 8
movzx eax, ax
or cx, dx
mov word [ebp - 0x34], di
mov word [ebp - 0x32], cx
cmp eax, dword [ebp + 0xc]
jne 0x4067c8
cmp word [ebp - 0x3c], 3
jne 0x4067c8
mov eax, 0x409
cmp word [ebp - 0x38], ax
je 0x4067dd
movzx eax, word [ebp - 0x1e]
inc dword [ebp - 4]
cmp dword [ebp - 4], eax
jl 0x406726
jmp 0x406876
movzx eax, cx
movzx ecx, word [ebp - 0x1c]
add eax, dword [ebp - 0x44]
push ebx
push ebx
add ecx, eax
push ecx
push dword [ebp - 8]
movzx edi, di
shr edi, 1
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
movzx eax, word [ebp - 0x34]
add eax, 2
push eax
push 0x40
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
push ebx
lea ecx, [ebp - 0xc]
push ecx
movzx ecx, word [ebp - 0x34]
push ecx
push eax
push dword [ebp - 8]
mov dword [ebp - 4], eax
call esi
xor ecx, ecx
cmp edi, ebx
jle 0x40683f
mov eax, dword [ebp - 4]
lea eax, [eax + ecx*2]
movzx esi, byte [eax]
movzx edx, byte [eax + 1]
shl si, 8
or dx, si
inc ecx
mov word [eax], dx
cmp ecx, edi
jl 0x406823
mov esi, dword [ebp + 0x10]
mov eax, dword [ebp - 4]
push ebx
push ebx
push dword [ebp + 0x14]
xor ecx, ecx
push esi
push edi
push eax
push ebx
push 0x4e4
mov word [eax + edi*2], cx
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
mov byte [eax + esi], bl
cmp eax, ebx
je 0x40686d
mov dword [ebp - 0x10], 1
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_GlobalFree]
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp - 0x10]
jmp 0x406886
xor eax, eax
pop edi
pop esi
pop ebx
leave
ret