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

Disassembly:
push ebp
mov ebp, esp
push ecx
mov ecx, 0xa
push 0
push 0
dec ecx
jne 0x51054d
push ecx
xchg dword [ebp - 4], ecx
push ebx
push esi
push edi
mov dword [ebp - 8], ecx
mov dword [ebp - 4], edx
mov dword [ebp - 0x10], eax
mov eax, dword [ebp - 4]
call fcn.00407248
mov eax, dword [ebp - 8]
call fcn.00407248
mov eax, dword [ebp + 0xc]
call fcn.00407248
xor eax, eax
push ebp
push 0x5107f6
push dword fs:[eax]
mov dword fs:[eax], esp
mov dl, 1
mov eax, dword [ebp - 4]
call fcn.0041e058
test al, al
je 0x5105ef
cmp byte [ebp + 8], 0
je 0x5105ef
mov eax, dword [ebp - 4]
call fcn.00407b7c
mov edi, eax
push edi
call sub.kernel32.dll_DeleteFileW
cmp eax, 1
sbb ebx, ebx
inc ebx
test bl, bl
jne 0x5105ef
call sub.kernel32.dll_GetLastError_1
mov esi, eax
push edi
call sub.kernel32.dll_GetFileAttributesW
cmp eax, 0xffffffff
je 0x5105e9
test ah, 4
je 0x5105e9
test al, 0x10
je 0x5105e9
mov eax, dword [ebp - 4]
call fcn.00407b7c
push eax
call sub.kernel32.dll_RemoveDirectoryW
cmp eax, 1
sbb ebx, ebx
inc ebx
jmp 0x5105ef
push esi
call sub.kernel32.dll_SetLastError
mov ecx, dword [ebp - 4]
mov dl, 1
mov eax, dword [0x4510fc]
call fcn.004514b0
mov dword [ebp - 0x14], eax
xor edx, edx
push ebp
push 0x510786
push dword fs:[edx]
mov dword fs:[edx], esp
lea eax, [ebp - 0xc]
mov edx, 0x510814
call fcn.0040756c
mov eax, dword [ebp - 0x10]
mov edx, dword [eax]
call dword [edx + 0x14]
dec eax
test eax, eax
jl 0x510757
inc eax
mov dword [ebp - 0x18], eax
xor ebx, ebx
mov esi, dword [ebp - 0xc]
test esi, esi
je 0x51063f
sub esi, 4
mov esi, dword [esi]
lea ecx, [ebp - 0x2c]
mov edx, ebx
mov eax, dword [ebp - 0x10]
mov edi, dword [eax]
call dword [edi + 0xc]
mov edx, dword [ebp - 0x2c]
lea eax, [ebp - 0x28]
call fcn.00407c68
mov eax, dword [ebp - 0x28]
lea ecx, [ebp - 0x24]
mov edx, esi
call fcn.0044d97c
mov edx, dword [ebp - 0x24]
lea eax, [ebp - 0x20]
call fcn.00407c54
mov eax, dword [ebp - 0x20]
mov edx, dword [ebp - 0xc]
call fcn.0041d1a4
test al, al
jne 0x5106ba
lea ecx, [ebp - 0x30]
mov edx, ebx
mov eax, dword [ebp - 0x10]
mov esi, dword [eax]
call dword [esi + 0xc]
mov eax, dword [ebp - 0x30]
push eax
lea edx, [ebp - 0x38]
mov eax, ebx
call fcn.0041d8f4
mov ecx, dword [ebp - 0x38]
lea eax, [ebp - 0x34]
mov edx, dword [ebp + 0xc]
call fcn.00407dc8
mov ecx, dword [ebp - 0x34]
mov edx, dword [ebp - 8]
mov eax, dword [ebp - 0x14]
mov esi, dword [eax]
call dword [esi + 8]
jmp 0x51074d
lea ecx, [ebp - 0x3c]
mov edx, ebx
mov eax, dword [ebp - 0x10]
mov esi, dword [eax]
call dword [esi + 0xc]
mov eax, dword [ebp - 0x3c]
mov dword [ebp - 0x40], eax
mov esi, dword [ebp - 0x40]
test esi, esi
je 0x5106d9
sub esi, 4
mov esi, dword [esi]
mov eax, dword [ebp - 0xc]
mov dword [ebp - 0x1c], eax
cmp dword [ebp - 0x1c], 0
je 0x5106f0
mov eax, dword [ebp - 0x1c]
sub eax, 4
mov eax, dword [eax]
mov dword [ebp - 0x1c], eax
lea ecx, [ebp - 0x50]
mov edx, ebx
mov eax, dword [ebp - 0x10]
mov edi, dword [eax]
call dword [edi + 0xc]
mov edx, dword [ebp - 0x50]
lea eax, [ebp - 0x4c]
call fcn.00407c68
mov eax, dword [ebp - 0x4c]
lea ecx, [ebp - 0x48]
mov edx, esi
sub edx, dword [ebp - 0x1c]
call fcn.0044d998
mov edx, dword [ebp - 0x48]
lea eax, [ebp - 0x44]
call fcn.00407c54
mov eax, dword [ebp - 0x44]
push eax
lea edx, [ebp - 0x58]
mov eax, ebx
call fcn.0041d8f4
mov ecx, dword [ebp - 0x58]
lea eax, [ebp - 0x54]
mov edx, dword [ebp + 0xc]
call fcn.00407dc8
mov ecx, dword [ebp - 0x54]
mov edx, dword [ebp - 8]
mov eax, dword [ebp - 0x14]
mov esi, dword [eax]
call dword [esi + 8]
inc ebx
dec dword [ebp - 0x18]
jne 0x510633
mov eax, dword [ebp - 0x10]
mov edx, dword [eax]
call dword [edx + 0x14]
push eax
mov ecx, 0x510838
mov edx, dword [ebp - 8]
mov eax, dword [ebp - 0x14]
mov ebx, dword [eax]
call dword [ebx + 0x10]
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x51078d
mov eax, dword [ebp - 0x14]
call fcn.00405744
ret