Function at 0x404040
Capabilities:
Read file on windows

Disassembly:
sub esp, 0x10
mov eax, dword [0x40d9c4]
add eax, 8
push ebx
push ebp
push esi
push edi
push 0
push 0x27
push 3
push 0
push 1
push 0x80000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, 0xffffffff
mov dword [0x40db28], eax
je 0x4042dc
mov edi, 0x2000
mov ecx, edi
call fcn.0040a890
lea ecx, [esp + 0x14]
mov esi, eax
call fcn.00402410
mov eax, dword [0x40db28]
mov ebx, dword [sym.imp.KERNEL32.dll_ReadFile]
lea edx, [esp + 0x10]
push 0
push edx
push edi
lea ecx, [esi + 0x2000]
push esi
push eax
mov dword [esp + 0x28], esi
mov dword [esp + 0x2c], edi
mov dword [esp + 0x30], ecx
call ebx
test eax, eax
je 0x4042c8
cmp dword [esp + 0x10], edi
jne 0x4042c8
lea ecx, [esp + 0x14]
call fcn.00402460
mov edi, eax
test edi, edi
je 0x4042c8
push str..setupd
push edi
lea ecx, [esp + 0x1c]
call fcn.004024f0
test eax, eax
jne 0x404109
mov ecx, esi
call fcn.0040ab60
mov edx, dword [0x40db28]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x10
ret
mov ecx, dword [eax + 0x14]
mov dword [0x40db30], ecx
mov edx, dword [eax + 0x10]
mov dword [0x40db34], edx
mov ecx, dword [eax + 0xc]
mov dword [0x40db3c], ecx
sub eax, esi
mov ecx, edi
lea edx, [eax + 0x10]
sub ecx, esi
mov dword [0x40db40], edx
add eax, 8
lea edx, [ecx + 0x50]
add ecx, 0x5c
mov dword [0x40db4c], ecx
mov ecx, esi
mov dword [0x40db44], edx
mov dword [0x40db48], eax
call fcn.0040ab60
cmp dword [0x40db34], 0xa
jl 0x4042dc
mov eax, dword [0x40db30]
mov ecx, dword [0x40db28]
push 0
push 0
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov eax, dword [0x40db28]
lea edx, [esp + 0x10]
push 0
push edx
push 0x40
push 0x40d9f0
push eax
call ebx
test eax, eax
je 0x4042b2
cmp dword [esp + 0x10], 0x40
jne 0x4042b2
cmp byte [0x40d9f0], 0x53
jne 0x4042b2
cmp byte [0x40d9f1], 0x45
jne 0x4042b2
cmp byte [0x40d9f2], 0x54
jne 0x4042b2
cmp byte [0x40d9f3], 3
jne 0x4042b2
xor ebx, ebx
mov eax, 0x40d9f8
mov esi, 0x38
xor ecx, ecx
mov cl, byte [eax]
add ebx, ecx
jns 0x4041ef
lea ebx, [ebx + ebx + 1]
jmp 0x4041f1
add ebx, ebx
inc eax
dec esi
jne 0x4041e1
mov ecx, dword [0x40c124]
xor edi, edi
mov ebp, 0x40da08
mov ecx, dword [edi + ecx + 8]
mov esi, dword [ebp]
call fcn.0040ab60
mov ecx, esi
call fcn.0040a890
mov edx, dword [0x40c124]
push 0
mov dword [edi + edx + 8], eax
mov ecx, dword [0x40c124]
lea eax, [esp + 0x14]
mov edx, dword [edi + ecx + 8]
push eax
mov eax, dword [0x40db28]
push esi
push edx
push eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x4042b2
cmp dword [esp + 0x10], esi
jne 0x4042b2
mov ecx, dword [0x40c124]
test esi, esi
mov eax, dword [edi + ecx + 8]
jle 0x40426a
xor edx, edx
mov dl, byte [eax]
add ebx, edx
jns 0x404264
lea ebx, [ebx + ebx + 1]
jmp 0x404266
add ebx, ebx
inc eax
dec esi
jne 0x404256
add ebp, 0x10
add edi, 0xc
cmp ebp, 0x40da38
jl 0x404202
mov ecx, dword [0x40db28]
push 1
push 0
push 0
push ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edx, dword [0x40db28]
mov dword [0x40db38], eax
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [0x40d9f4]
xor eax, eax
pop edi
cmp ecx, ebx
pop esi
pop ebp
sete al
pop ebx
add esp, 0x10
ret
mov eax, dword [0x40db28]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x10
ret
mov ecx, esi
call fcn.0040ab60
mov ecx, dword [0x40db28]
push ecx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x10
ret