Function at 0x408593
Capabilities:
Check if file exists
Clear file content
Delete file
Get file attributes
Write file on windows

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x874
mov eax, dword [0x41c194]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [0x41d1dc]
and dword [ebp - 0x868], 0
push ebx
push esi
push edi
mov esi, edx
mov dword [ebp - 0x864], eax
call fcn.00416cb3
mov ebx, dword [ebp + 8]
xor edi, edi
inc edi
test ebx, ebx
je 0x4085fd
push 3
pop edi
push 0x41e040
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x4085fd
test eax, 0x4000
je 0x4085fd
push 0
push 0x80
push 2
push esi
push 0x41e040
call dword [sym.imp.ADVAPI32.dll_DuplicateEncryptionInfoFile]
push esi
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
push 0
push 0x80
push 4
push 0
push edi
push 0xc0000000
push esi
mov dword [ebp - 0x86c], eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [0x41e6dc], eax
cmp eax, 0xffffffff
jne 0x40864b
test ebx, ebx
jne 0x40863f
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 5
je 0x408895
mov ecx, esi
call fcn.0040947b
jmp 0x408895
call dword [sym.imp.KERNEL32.dll_GetLastError]
xor ecx, ecx
cmp eax, 0xb7
setne cl
cmp dword [0x41d1bc], 0
mov dword [ebp - 0x870], ecx
je 0x40866f
call fcn.004084f5
xor ebx, ebx
push ebx
push ebx
push 0xe
push dword [0x41d1d4]
call dword [sym.imp.USER32.dll_SendMessageW]
push ebx
push ebx
push 0xbd
push dword [0x41d1d4]
mov dword [ebp - 0x854], eax
call dword [sym.imp.USER32.dll_SendMessageW]
mov edi, eax
test edi, edi
je 0x408846
push edi
call dword [sym.imp.KERNEL32.dll_LocalLock]
mov ebx, eax
test ebx, ebx
je 0x408846
mov ecx, dword [0x41e620]
mov eax, ecx
sub eax, 1
je 0x4087fb
sub eax, 1
je 0x408794
sub eax, 1
jne 0x4086f5
push eax
lea eax, [ebp - 0x85c]
push eax
push 3
push 0x41c278
push dword [0x41e6dc]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov ecx, dword [0x41e620]
cmp ecx, 3
je 0x40870f
call dword [sym.imp.KERNEL32.dll_GetACP]
mov ecx, eax
lea edx, [ebp - 0x868]
mov eax, 0x400
jmp 0x408718
xor edx, edx
mov ecx, 0xfde9
xor eax, eax
push edx
xor edx, edx
mov dword [ebp - 0x860], eax
push edx
push edx
push edx
push dword [ebp - 0x854]
mov dword [ebp - 0x858], ecx
push ebx
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
cmp dword [ebp - 0x868], 0
jne 0x40874f
cmp dword [ebp - 0x854], 0
je 0x408776
test eax, eax
jne 0x408776
mov edx, dword [0x41c244]
mov ecx, dword [ebp - 0x864]
push 0x31
push esi
push dword [0x41c1f4]
call fcn.0040788e
cmp eax, 2
je 0x40884d
xor eax, eax
jmp 0x40877c
mov eax, dword [ebp - 0x860]
push dword [ebp - 0x854]
mov edx, dword [ebp - 0x858]
push ebx
push eax
call fcn.00408442
jmp 0x408836
push 0
lea eax, [ebp - 0x85c]
push eax
push 2
push 0x41c270
push dword [0x41e6dc]
call dword [sym.imp.KERNEL32.dll_WriteFile]
push dword [ebp - 0x854]
mov edx, ebx
mov ecx, ebx
call fcn.00408410
push 0
lea eax, [ebp - 0x85c]
push eax
mov eax, dword [ebp - 0x854]
add eax, eax
push eax
push ebx
push dword [0x41e6dc]
call dword [sym.imp.KERNEL32.dll_WriteFile]
push dword [ebp - 0x854]
mov edx, ebx
mov dword [ebp - 0x864], eax
mov ecx, ebx
call fcn.00408410
mov eax, dword [ebp - 0x864]
jmp 0x408836
push 0
lea eax, [ebp - 0x85c]
push eax
push 2
push 0x41c274
push dword [0x41e6dc]
call dword [sym.imp.KERNEL32.dll_WriteFile]
push 0
lea eax, [ebp - 0x85c]
push eax
mov eax, dword [ebp - 0x854]
add eax, eax
push eax
push ebx
push dword [0x41e6dc]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x4088aa
push dword [0x41dfcc]
call dword [sym.imp.USER32.dll_SetCursor]
mov ecx, esi
call fcn.0040947b
push dword [0x41dfcc]
call dword [sym.imp.USER32.dll_SetCursor]
push dword [0x41e6dc]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
or dword [0x41e6dc], 0xffffffff
test edi, edi
je 0x408877
push edi
call dword [sym.imp.KERNEL32.dll_LocalUnlock]
cmp dword [ebp - 0x870], 0
je 0x408887
push esi
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
cmp dword [0x41d1bc], 0
je 0x408895
call fcn.00408559
xor eax, eax
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0041b4e0
mov esp, ebp
pop ebp
ret 8
push dword [0x41e6dc]
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
mov eax, dword [0x41e620]
xor ebx, ebx
push ebx
push ebx
push 0xb9
push dword [0x41d1d4]
mov dword [0x41c19c], eax
call dword [sym.imp.USER32.dll_SendMessageW]
mov ecx, esi
call fcn.004074aa
push 0x210
lea eax, [ebp - 0x850]
mov dword [0x41c268], ebx
push ebx
push eax
call sub.msvcrt.dll_memset
add esp, 0xc
cmp dword [ebp + 8], ebx
je 0x408935
push esi
call dword [sym.imp.SHLWAPI.dll_PathIsNetworkPathW]
mov dword [ebp - 0x84c], eax
lea eax, [ebp - 0x63c]
push eax
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesExW]
neg eax
lea edx, [ebp - 0x848]
mov ecx, esi
sbb eax, eax
and eax, dword [ebp - 0x61c]
mov dword [ebp - 0x850], eax
call fcn.00408ab1
push dword [0x41e6dc]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
or dword [0x41e6dc], 0xffffffff
push edi
call dword [sym.imp.KERNEL32.dll_LocalUnlock]
cmp dword [0x41d1bc], ebx
je 0x40895c
call fcn.00408559
cmp word [0x41cfa0], bx
je 0x4089cb
push 0x208
xor edi, edi
lea eax, [ebp - 0x410]
push edi
push eax
call sub.msvcrt.dll_memset
add esp, 0xc
cmp dword [ebp - 0x86c], ebx
je 0x4089c8
push edi
lea eax, [ebp - 0x410]
push eax
push 0x104
push esi
call dword [sym.imp.KERNEL32.dll_GetFullPathNameW]
test eax, eax
je 0x4089cb
lea eax, [ebp - 0x858]
mov dword [ebp - 0x858], edi
push eax
push ecx
lea edx, [ebp - 0x208]
lea ecx, [ebp - 0x410]
call fcn.00419326
test eax, eax
js 0x4089cb
cmp dword [ebp - 0x858], 2
je 0x4089cb
xor ebx, ebx
inc ebx
mov edi, dword [ebp + 0xc]
test edi, edi
jne 0x4089da
test ebx, ebx
je 0x408a8f
push 0x208
xor ebx, ebx
lea eax, [ebp - 0x618]
push ebx
push eax
call sub.msvcrt.dll_memset
add esp, 0xc
lea eax, [ebp - 0x618]
push ebx
push eax
push 0x104
push esi
call dword [sym.imp.KERNEL32.dll_GetFullPathNameW]
test eax, eax
je 0x408a8f
push 0x1fa
lea eax, [ebp - 0x208]
push ebx
push eax
call sub.msvcrt.dll_memset
add esp, 0xc
test edi, edi
jne 0x408a2b
mov edi, 0x41cfa0
push edi
mov edx, 0xfd
lea ecx, [ebp - 0x208]
call fcn.00405313
test eax, eax
js 0x408895
lea edx, [ebp - 0x208]
lea ecx, [ebp - 0x618]
call fcn.00419eae
test eax, eax
js 0x408a8f
cmp word [ebp - 0x208], bx
je 0x408a87
lea ecx, [ebp - 0x208]
call fcn.00408099
test eax, eax
jne 0x408a7e
mov edx, dword [0x41c19c]
mov ecx, esi
call fcn.00408b35
inc word [0x41cf7c]
jmp 0x408a8f
xor ecx, ecx
inc ecx
call fcn.004080f7
push dword [0x41dfcc]
call dword [sym.imp.USER32.dll_SetCursor]
mov edx, dword [ebp + 8]
lea ecx, [ebp - 0x850]
call fcn.00416d49
xor eax, eax
inc eax
jmp 0x408897