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

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x5513ab
mov eax, dword fs:[0]
push eax
sub esp, 0xa38
mov eax, dword [0x5bb270]
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 ebx, ecx
lea ecx, [ebp - 0xa40]
mov dword [ebp - 0xa44], 0
push ecx
lea ecx, [ebx + 0x150]
mov dword [ebp - 0xa40], 0
call fcn.00403390
mov esi, dword [sym.imp.KERNEL32.dll_SetFileAttributesW]
mov edi, eax
test edi, edi
je 0x406822
xor esi, esi
mov eax, dword [ebp - 0xa40]
push 0x20
add eax, esi
push eax
call dword [sym.imp.KERNEL32.dll_SetFileAttributesW]
mov eax, dword [ebp - 0xa40]
add eax, esi
push eax
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
test eax, eax
jne 0x406813
push eax
mov eax, dword [ebp - 0xa40]
mov ecx, ebx
add eax, esi
push eax
call fcn.00407910
mov dword [ebp - 0xa44], 1
add esi, 0x208
dec edi
jne 0x4067d4
mov esi, dword [sym.imp.KERNEL32.dll_SetFileAttributesW]
push dword [ebp - 0xa40]
lea ecx, [ebx + 0x150]
call fcn.004037b0
xor eax, eax
push 0x206
push eax
mov word [ebp - 0x420], ax
lea eax, [ebp - 0x41e]
push eax
call fcn.00537c80
xor eax, eax
push 0x206
push eax
mov word [ebp - 0x218], ax
lea eax, [ebp - 0x216]
push eax
call fcn.00537c80
add esp, 0x18
lea eax, [ebp - 0xa38]
lea ecx, [ebx + 0x150]
push eax
call fcn.00403a00
cmp word [ebp - 0x830], 0
je 0x406992
mov edi, dword [sym.imp.KERNEL32.dll_RemoveDirectoryW]
lea eax, [ebp - 0x830]
push eax
lea eax, [ebp - 0xa38]
push eax
push 0x561e78
lea eax, [ebp - 0x420]
push 0x104
push eax
call fcn.0053777e
add esp, 0x14
lea eax, [ebp - 0x420]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
test al, 1
je 0x4068d7
and eax, 0xfffffffe
push eax
lea eax, [ebp - 0x420]
push eax
call esi
lea eax, [ebp - 0x420]
push eax
call edi
test eax, eax
jne 0x4068f4
push 1
lea eax, [ebp - 0x420]
mov ecx, ebx
push eax
call fcn.00407910
lea eax, [ebp - 0x830]
push eax
lea eax, [ebp - 0x218]
push 0x104
push eax
call fcn.0053725b
lea eax, [ebp - 0x218]
push 0x104
push eax
call fcn.005372b7
inc eax
add esp, 0x14
test eax, eax
jle 0x406992
lea eax, [ebp - 0x218]
push 0x104
push eax
call fcn.005372b7
add esp, 8
dec eax
js 0x40694e
lea esp, [esp]
cmp word [ebp + eax*2 - 0x218], 0x5c
je 0x40694e
dec eax
jns 0x406940
test eax, eax
jle 0x406992
add eax, eax
cmp eax, 0x208
jae 0x406a6b
xor ecx, ecx
mov word [ebp + eax - 0x218], cx
lea eax, [ebp - 0x218]
push eax
lea eax, [ebp - 0x830]
push 0x104
push eax
call fcn.0053725b
add esp, 0xc
cmp word [ebp - 0x830], 0
jne 0x406892
lea eax, [ebp - 0xa3c]
push eax
lea ecx, [ebx + 0x150]
call fcn.00403830
push dword [ebp - 0xa3c]
mov dword [ebp - 4], 0
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x4069cc
test al, 1
je 0x4069cc
and eax, 0xfffffffe
push eax
push dword [ebp - 0xa3c]
call esi
push dword [ebp - 0xa3c]
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
test eax, eax
jne 0x4069ea
push eax
push dword [ebp - 0xa3c]
mov ecx, ebx
call fcn.00407910
xor eax, eax
push 0x206
push eax
mov word [ebp - 0x628], ax
lea eax, [ebp - 0x626]
push eax
call fcn.00537c80
add esp, 0xc
lea eax, [ebp - 0x628]
push 0x104
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
xor eax, eax
mov ecx, ebx
push eax
mov word [ebp - 0x422], ax
lea eax, [ebp - 0x628]
push eax
call fcn.00407910
mov edx, dword [ebp - 0xa3c]
or ecx, 0xffffffff
add edx, 0xfffffff0
mov dword [ebp - 4], 0xffffffff
lea eax, [edx + 0xc]
lock xadd dword [eax], ecx
dec ecx
cmp dword [ebp - 0xa44], 0
je 0x406a70
test ecx, ecx
jg 0x406a64
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov eax, 0xbc2
jmp 0x406a7e
call fcn.00537eb5
test ecx, ecx
jg 0x406a7c
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
xor eax, eax
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.0053787e
mov esp, ebp
pop ebp
ret