Function at 0x405840
Capabilities:
Check if file exists
Enumerate files on windows

Disassembly:
push ebp
mov ebp, esp
add esp, 0xfffff06c
push ebx
push esi
push edi
mov dword [ebp - 4], ecx
mov edi, edx
mov esi, eax
mov ebx, dword [ebp + 8]
call fcn.00405388
test eax, eax
je 0x405a33
cmp dword [ebp - 4], 0
je 0x405882
mov eax, dword [ebp - 4]
cmp word [eax], 0
je 0x405882
lea eax, [ebp - 0x804]
mov edx, dword [ebp - 4]
call fcn.0040ff64
jmp 0x405894
lea edx, [ebp - 0x804]
mov ecx, 0x10000000
mov eax, edi
call fcn.0040fd68
cmp esi, 0xffffffff
jne 0x4058d8
lea eax, [ebp - 0xa54]
push eax
lea edx, [ebp - 0x804]
push edx
call sub.KERNEL32.DLL_FindFirstFileW
mov esi, eax
cmp esi, 0xffffffff
jne 0x405900
call sub.KERNEL32.DLL_GetLastError
cmp eax, 2
je 0x4058c7
cmp eax, 3
je 0x4058c7
cmp eax, 0x12
jne 0x4058cb
xor eax, eax
jmp 0x4058d0
mov eax, 1
mov byte [ebx + 0x10b0], al
jmp 0x405900
lea edx, [ebp - 0xa54]
push edx
push esi
call sub.KERNEL32.DLL_FindNextFileW
test eax, eax
jne 0x405900
or esi, 0xffffffff
call sub.KERNEL32.DLL_GetLastError
cmp eax, 0x12
setne al
and eax, 1
mov byte [ebx + 0x10b0], al
cmp esi, 0xffffffff
je 0x405be6
lea edx, [ebp - 0x804]
lea edi, [ebx + 0x400]
mov eax, edi
call fcn.0040ff64
mov eax, edi
call fcn.00405c80
lea edx, [ebp - 0xa28]
call fcn.0040ff64
mov eax, edi
mov ecx, 0x10000000
mov edx, ebx
call fcn.0040fd44
mov eax, dword [ebp - 0xa38]
xor edx, edx
mov edx, eax
xor eax, eax
push edx
push eax
mov eax, dword [ebp - 0xa34]
xor edx, edx
add eax, dword [esp]
adc edx, dword [esp + 4]
mov dword [ebx + 0xc00], eax
mov dword [ebx + 0xc04], edx
lea edx, [ebx + 0xc98]
mov ecx, dword [ebp - 0xa54]
lea eax, [ebp - 0x820]
mov dword [ebx + 0xc08], ecx
mov ecx, 0x10000000
add esp, 8
call fcn.0040fd44
mov eax, dword [ebp - 0xa50]
mov dword [ebx + 0x1098], eax
mov eax, dword [ebp - 0xa4c]
mov dword [ebx + 0x109c], eax
lea eax, [ebx + 0xc14]
mov edx, dword [ebp - 0xa48]
mov dword [ebx + 0x10a0], edx
mov edx, dword [ebp - 0xa44]
mov dword [ebx + 0x10a4], edx
lea edx, [ebp - 0xa40]
mov ecx, dword [ebp - 0xa40]
mov dword [ebx + 0x10a8], ecx
mov ecx, dword [ebp - 0xa3c]
mov dword [ebx + 0x10ac], ecx
call fcn.004064bc
lea edx, [ebp - 0xa50]
lea eax, [ebx + 0xc40]
call fcn.004064bc
lea edx, [ebp - 0xa48]
lea eax, [ebx + 0xc6c]
call fcn.004064bc
lea eax, [ebx + 0xc14]
call fcn.004066b0
mov dword [ebx + 0xc0c], eax
mov eax, edi
call fcn.00406c84
test al, al
je 0x405be6
mov word [ebx + 0x400], 0
jmp 0x405be6
test edi, edi
je 0x405a4b
cmp byte [edi], 0
je 0x405a4b
lea eax, [ebp - 0xe54]
mov edx, edi
call fcn.0040f78c
jmp 0x405a5e
lea edx, [ebp - 0xe54]
mov ecx, 0x10000000
mov eax, dword [ebp - 4]
call fcn.0040fd44
cmp esi, 0xffffffff
jne 0x405a9d
lea eax, [ebp - 0xf94]
push eax
lea edx, [ebp - 0xe54]
push edx
call sub.KERNEL32.DLL_FindFirstFileA
mov esi, eax
cmp esi, 0xffffffff
jne 0x405ac5
call sub.KERNEL32.DLL_GetLastError
cmp eax, 2
je 0x405a8c
cmp eax, 3
jne 0x405a90
xor eax, eax
jmp 0x405a95
mov eax, 1
mov byte [ebx + 0x10b0], al
jmp 0x405ac5
lea edx, [ebp - 0xf94]
push edx
push esi
call sub.KERNEL32.DLL_FindNextFileA
test eax, eax
jne 0x405ac5
or esi, 0xffffffff
call sub.KERNEL32.DLL_GetLastError
cmp eax, 0x12
setne al
and eax, 1
mov byte [ebx + 0x10b0], al
cmp esi, 0xffffffff
je 0x405be6
lea edx, [ebp - 0xe54]
mov eax, ebx
call fcn.0040f78c
mov eax, ebx
call fcn.00405bf4
lea edx, [ebp - 0xf68]
call fcn.0040f78c
lea edx, [ebx + 0x400]
mov ecx, 0x10000000
mov eax, ebx
call fcn.0040fd68
mov eax, dword [ebp - 0xf78]
xor edx, edx
mov edx, eax
xor eax, eax
push edx
push eax
mov eax, dword [ebp - 0xf74]
xor edx, edx
add eax, dword [esp]
adc edx, dword [esp + 4]
add esp, 8
mov dword [ebx + 0xc00], eax
mov dword [ebx + 0xc04], edx
mov ecx, dword [ebp - 0xf94]
mov dword [ebx + 0xc08], ecx
lea edx, [ebp - 0xe64]
lea eax, [ebx + 0xc98]
call fcn.0040f78c
mov ecx, dword [ebp - 0xf90]
lea edi, [ebx + 0xc14]
mov dword [ebx + 0x1098], ecx
mov ecx, dword [ebp - 0xf8c]
mov dword [ebx + 0x109c], ecx
mov eax, dword [ebp - 0xf88]
mov dword [ebx + 0x10a0], eax
mov eax, dword [ebp - 0xf84]
mov dword [ebx + 0x10a4], eax
mov eax, edi
mov edx, dword [ebp - 0xf80]
mov dword [ebx + 0x10a8], edx
mov edx, dword [ebp - 0xf7c]
mov dword [ebx + 0x10ac], edx
lea edx, [ebp - 0xf80]
call fcn.004064bc
lea edx, [ebp - 0xf90]
lea eax, [ebx + 0xc40]
call fcn.004064bc
lea edx, [ebp - 0xf88]
lea eax, [ebx + 0xc6c]
call fcn.004064bc
mov eax, edi
call fcn.004066b0
mov dword [ebx + 0xc0c], eax
mov eax, ebx
call fcn.00406c64
test al, al
je 0x405be6
mov word [ebx + 0x400], 0
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 4