Function at 0x405870
Capabilities:
Check if file exists
Delete directory
Delete file
Get file attributes
Move file
Set file attributes

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x50baf1
mov eax, dword fs:[0]
push eax
sub esp, 0x884
mov eax, dword [0x55b524]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov esi, dword [ebp + 8]
mov ebx, dword [ebp + 0xc]
test esi, esi
jne 0x4058af
xor eax, eax
jmp 0x405b43
cmp word [esi], 0
je 0x4058a8
test ebx, ebx
je 0x4058a8
cmp word [ebx], 0
je 0x4058a8
mov ecx, esi
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x4058c4
sub ecx, edx
sar ecx, 1
cmp ecx, 0x104
jge 0x4058a8
push 0x410
lea eax, [ebp - 0x420]
push 0
push eax
call fcn.00491810
add esp, 0xc
lea eax, [ebp - 0x420]
push 0x51c950
push esi
push eax
call dword [sym.imp.SHLWAPI.dll_PathCombineW]
mov eax, 0x5c
mov dword [ebp - 0x428], 0
mov word [ebp - 0x42c], ax
mov dword [ebp - 0x424], 0
lea eax, [ebp - 0x420]
mov dword [ebp - 4], 0
push eax
lea ecx, [ebp - 0x884]
call fcn.004051b0
test eax, eax
je 0x405b28
mov edi, dword [sym.imp.KERNEL32.dll_MoveFileExW]
nop dword [eax + eax]
cmp dword [ebp - 0x424], 0
je 0x4059b6
mov eax, dword [ebp - 0x884]
shr eax, 4
and eax, 1
je 0x4059b6
cmp word [ebp - 0x858], 0x2e
jne 0x4059b6
mov ax, word [ebp - 0x856]
test ax, ax
je 0x40598d
cmp ax, 0x2e
jne 0x4059b6
cmp word [ebp - 0x854], 0
jne 0x4059b6
mov eax, dword [ebp - 0x428]
test eax, eax
je 0x405b28
lea ecx, [ebp - 0x884]
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_FindNextFileW]
mov edi, eax
mov dword [ebp - 0x424], edi
jmp 0x405b1a
lea eax, [ebp - 0x888]
push eax
lea ecx, [ebp - 0x884]
call fcn.00405450
cmp dword [ebp - 0x424], 0
mov byte [ebp - 4], 1
je 0x4059f8
mov eax, dword [ebp - 0x884]
shr eax, 4
and eax, 1
je 0x4059f8
mov esi, dword [ebp - 0x888]
push ebx
push esi
call fcn.00405870
add esp, 8
jmp 0x405acd
mov esi, dword [ebp - 0x888]
push esi
call dword [sym.imp.SHLWAPI.dll_PathFindExtensionW]
push ebx
push eax
call fcn.004ae47e
add esp, 8
test eax, eax
jne 0x405acd
push esi
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
test eax, eax
jne 0x405acd
push esi
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x405acd
push 0x80
push esi
call dword [sym.imp.KERNEL32.dll_SetFileAttributesW]
test eax, eax
je 0x405a50
push esi
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
test eax, eax
jne 0x405acd
push esi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x405a6b
test al, 0x10
je 0x405a6b
push esi
call dword [sym.imp.KERNEL32.dll_RemoveDirectoryW]
test eax, eax
jne 0x405acd
lea ecx, [ebp - 0x88c]
call fcn.004044e0
lea eax, [ebp - 0x88c]
mov byte [ebp - 4], 2
push eax
lea eax, [ebp - 0x888]
push eax
call fcn.004049d0
add esp, 8
push 4
push 0
test eax, eax
je 0x405aaa
mov esi, dword [ebp - 0x88c]
push esi
call edi
push esi
mov esi, dword [ebp - 0x888]
jmp 0x405ab4
mov esi, dword [ebp - 0x888]
push esi
call edi
push esi
push esi
push str.delete_file:_s_by_pending:_s
call fcn.00426b80
add esp, 0xc
lea ecx, [ebp - 0x88c]
call fcn.00404540
mov eax, dword [ebp - 0x428]
test eax, eax
jne 0x405adb
xor edi, edi
jmp 0x405afe
cmp dword [ebp - 0x424], 0
jne 0x405ae8
xor edi, edi
jmp 0x405afe
lea ecx, [ebp - 0x884]
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_FindNextFileW]
mov edi, eax
mov dword [ebp - 0x424], edi
mov byte [ebp - 4], 0
add esi, 0xfffffff0
or eax, 0xffffffff
lock xadd dword [esi + 0xc], eax
dec eax
test eax, eax
jg 0x405b1a
mov ecx, dword [esi]
push esi
mov eax, dword [ecx]
call dword [eax + 4]
test edi, edi
mov edi, dword [sym.imp.KERNEL32.dll_MoveFileExW]
jne 0x405950
lea ecx, [ebp - 0x884]
call fcn.00404910
lea ecx, [ebp - 0x884]
call fcn.00404570
mov eax, 1
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.00462c38
mov esp, ebp
pop ebp
ret