Function at 0x40865b
Capabilities:
Check if file exists
Create directory
Delete file
Get common file path
Get file attributes
Set current directory

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x424
push ebx
push esi
push edi
xor edi, edi
push 0x206
lea eax, [ebp - 0x216]
push edi
push eax
mov word [ebp - 0x218], di
call fcn.00406240
add esp, 0xc
lea eax, [ebp - 0x218]
push eax
mov ebx, 0x104
push ebx
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
cmp eax, ebx
jae 0x4086a0
cmp eax, edi
ja 0x4086b5
call dword [sym.imp.KERNEL32.dll_GetLastError]
lea eax, [ebp - 0x218]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
jmp 0x408706
lea eax, [ebp - 0x218]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
jne 0x40878c
lea eax, [ebp - 0x218]
lea edx, [eax + 2]
mov cx, word [eax]
inc eax
inc eax
cmp cx, di
jne 0x4086d4
sub eax, edx
sar eax, 1
lea esi, [ebp + eax*2 - 0x21a]
lea eax, [ebp - 0x218]
push eax
mov word [esi], di
call fcn.004084d9
test al, al
pop ecx
mov word [esi], 0x5c
jne 0x40878c
push edi
call dword [sym.imp.KERNEL32.dll_GetModuleHandleW]
push ebx
lea ecx, [ebp - 0x218]
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
lea ecx, [eax - 1]
cmp ecx, 0x102
ja 0x40873b
push eax
lea eax, [ebp - 0x218]
push eax
call fcn.00408001
pop ecx
pop ecx
mov word [eax], di
jmp 0x40878c
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, 0x401818
lea edi, [ebp - 0x10]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
lea eax, [ebp - 0x10]
push eax
movsd dword es:[edi], dword [esi]
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
lea eax, [ebp - 0x10]
je 0x408763
push ebx
push eax
jmp 0x40877d
push 0
push eax
call dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
cmp eax, 1
je 0x40878c
call dword [sym.imp.KERNEL32.dll_GetLastError]
push ebx
push 0x401810
lea eax, [ebp - 0x218]
push eax
call fcn.0040805e
add esp, 0xc
xor esi, esi
push 0x208
lea eax, [ebp - 0x422]
push esi
push eax
mov word [ebp - 0x424], si
call fcn.00406240
add esp, 0xc
lea eax, [ebp - 0x424]
push eax
push esi
push 0x401808
lea eax, [ebp - 0x218]
push eax
call dword [sym.imp.KERNEL32.dll_GetTempFileNameW]
test eax, eax
mov edi, dword [sym.imp.KERNEL32.dll_lstrcatW]
mov esi, dword [ebp + 8]
je 0x408803
push ebx
push esi
lea eax, [ebp - 0x424]
push eax
call dword [sym.imp.KERNEL32.dll_GetLongPathNameW]
cmp eax, 0x105
ja 0x408803
test eax, eax
je 0x408803
push esi
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
test eax, eax
je 0x408803
push 0
push esi
call dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
test eax, eax
jne 0x408848
call dword [sym.imp.KERNEL32.dll_GetLastError]
lea eax, [ebp - 0x424]
push eax
push eax
call fcn.00408617
push ebx
lea eax, [ebp - 0x218]
push eax
push esi
call fcn.0040805e
add esp, 0x14
lea eax, [ebp - 0x424]
push eax
push esi
call edi
push 0
push esi
call dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
test eax, eax
jne 0x408848
call dword [sym.imp.KERNEL32.dll_GetLastError]
xor al, al
jmp 0x408873
push 0x40182c
push esi
call edi
push esi
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
cmp eax, 1
je 0x408862
call dword [sym.imp.KERNEL32.dll_GetLastError]
push esi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
xor ecx, ecx
cmp eax, 0xffffffff
setne cl
mov al, cl
pop edi
pop esi
pop ebx
leave
ret