Function at 0x406742
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_CreateFileW]
mov dword [ebp - 8], eax
cmp eax, 0xffffffff
je 0x406a46
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 0x406a4b
cmp cx, bx
jne 0x406a4b
xor eax, eax
mov dword [ebp - 4], ebx
cmp ax, di
jae 0x406a3d
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 0x40683c
movzx eax, word [ebp - 0x28]
inc dword [ebp - 4]
cmp dword [ebp - 4], eax
jl 0x4067f5
jmp 0x406a3d
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 0x406a3d
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]
movzx edi, byte [ebp - 0x32]
mov word [ebp - 0x3c], cx
mov word [ebp - 0x36], ax
mov ecx, dword [ebp - 0x38]
shr ecx, 8
shl dx, 8
movzx ecx, cl
or cx, dx
movzx edx, byte [ebp - 0x34]
mov word [ebp - 0x38], cx
mov ecx, dword [ebp - 0x34]
shr ecx, 8
shl dx, 8
movzx ecx, cl
or cx, dx
mov edx, dword [ebp - 0x32]
shr edx, 8
movzx edx, dl
shl di, 8
movzx eax, ax
or dx, di
mov word [ebp - 0x34], cx
mov word [ebp - 0x32], dx
cmp eax, dword [ebp + 0xc]
jne 0x4069a4
cmp word [ebp - 0x3c], 3
jne 0x4069a4
mov eax, 0x409
cmp word [ebp - 0x38], ax
je 0x4069b9
movzx eax, word [ebp - 0x1e]
inc dword [ebp - 4]
cmp dword [ebp - 4], eax
jl 0x406902
jmp 0x406a3d
movzx edi, cx
movzx ecx, word [ebp - 0x1c]
movzx eax, dx
add eax, dword [ebp - 0x44]
push ebx
push ebx
add ecx, eax
push ecx
push dword [ebp - 8]
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
cmp edi, ebx
jle 0x406a19
mov eax, dword [ebp - 4]
lea eax, [eax + ebx*2]
movzx edx, byte [eax]
movzx ecx, byte [eax + 1]
shl dx, 8
or cx, dx
inc ebx
mov word [eax], cx
cmp ebx, edi
jl 0x4069fd
push dword [ebp + 0x14]
mov esi, dword [ebp - 4]
push esi
push dword [ebp + 0x10]
xor eax, eax
mov word [esi + edi*2], ax
call dword [sym.imp.KERNEL32.dll_lstrcpynW]
push esi
mov dword [ebp - 0x10], 1
call dword [sym.imp.KERNEL32.dll_GlobalFree]
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp - 0x10]
jmp 0x406a4d
xor eax, eax
pop edi
pop esi
pop ebx
leave
ret