Function at 0x405361
Capabilities:
Check if file exists
Get common file path
Get file attributes

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x518
mov eax, dword [0x41f29c]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
push edi
mov edi, dword [ebp + 0x10]
lea eax, [ebp - 0x40c]
mov esi, 0x100
mov ebx, edx
push esi
push eax
push esi
mov esi, dword [sym.imp.api_ms_win_crt_filesystem_l1_1_0.dll__splitpath_s]
lea eax, [ebp - 0x104]
xor edx, edx
push eax
push edx
push edx
push edx
push edx
push ecx
mov dword [ebp - 0x518], edx
call esi
add esp, 0x24
lea ecx, [ebp - 0x104]
call fcn.00405abc
cmp byte [ebp - 0x40c], 0x2e
jne 0x4053c8
lea ecx, [ebp - 0x40b]
call fcn.00405abc
xor ecx, ecx
lea eax, [ebp - 0x30c]
push eax
push ecx
push ecx
push 0x20
push ecx
mov byte [ebp - 0x30c], cl
call dword [sym.imp.SHELL32.dll_SHGetFolderPathA]
test eax, eax
jns 0x4053f8
lea eax, [ebp - 0x30c]
push eax
push 0x208
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
xor eax, eax
push eax
push eax
push eax
push eax
push 0x100
lea eax, [ebp - 0x50c]
push eax
push 3
lea eax, [ebp - 0x514]
push eax
lea eax, [ebp - 0x30c]
push eax
call esi
add esp, 0x24
lea eax, [ebp - 0x104]
mov edx, 0x208
lea ecx, [ebp - 0x30c]
push eax
call fcn.0040518f
lea eax, [ebp - 0x104]
push eax
call dword [sym.imp.KERNEL32.dll_lstrlenA]
mov esi, eax
lea eax, [ebp - 0x40c]
push eax
lea eax, [ebp - 0x30c]
mov dword [ebp - 0x510], esi
push eax
lea eax, [ebp - 0x50c]
push eax
lea eax, [ebp - 0x514]
push eax
push 0x101
push ebx
call dword [sym.imp.api_ms_win_crt_filesystem_l1_1_0.dll__makepath_s]
add esp, 0x18
test eax, eax
jne 0x405605
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
je 0x405493
test al, 0x10
jne 0x405493
xor eax, eax
inc eax
jmp 0x405495
xor eax, eax
test al, al
jne 0x4054c7
push 1
push 0
push 0x80
push 2
push 0
push 0
push 0x40000000
push ebx
call dword [sym.imp.Mso20Win32Client.dll_Ordinal_745]
cmp eax, 0xffffffff
je 0x4054c7
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
jmp 0x405611
mov eax, dword [ebp - 0x518]
inc eax
push eax
mov dword [ebp - 0x518], eax
lea eax, [ebp - 0x104]
push eax
push str._s_x
lea eax, [ebp - 0x30c]
push 0x208
push eax
call fcn.00401717
add esp, 0x14
lea eax, [ebp - 0x30c]
push eax
call dword [sym.imp.KERNEL32.dll_lstrlenA]
jmp 0x405579
test esi, esi
jle 0x405605
lea eax, [ebp - 0x104]
add eax, esi
push eax
lea eax, [ebp - 0x104]
push eax
call dword [sym.imp.USER32.dll_CharPrevA]
mov esi, eax
push esi
call dword [sym.imp.OLMAPI32.dll_FGLeadBytep_4]
test eax, eax
mov eax, dword [ebp - 0x510]
je 0x405536
dec eax
push dword [ebp - 0x518]
dec eax
mov byte [esi], 0
mov dword [ebp - 0x510], eax
lea eax, [ebp - 0x104]
push eax
push str._s_x
lea eax, [ebp - 0x30c]
push 0x208
push eax
call fcn.00401717
add esp, 0x14
lea eax, [ebp - 0x30c]
push eax
call dword [sym.imp.KERNEL32.dll_lstrlenA]
mov esi, dword [ebp - 0x510]
cmp eax, 0xff
jge 0x405504
lea eax, [ebp - 0x40c]
push eax
lea eax, [ebp - 0x30c]
push eax
lea eax, [ebp - 0x50c]
push eax
lea eax, [ebp - 0x514]
push eax
push 0x101
push ebx
call dword [sym.imp.api_ms_win_crt_filesystem_l1_1_0.dll__makepath_s]
add esp, 0x18
test eax, eax
jne 0x405605
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
je 0x4055c4
test al, 0x10
jne 0x4055c4
xor eax, eax
inc eax
jmp 0x4055c6
xor eax, eax
test al, al
jne 0x4054c7
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 3
je 0x405605
push 1
xor eax, eax
push eax
push 0x80
push 2
push eax
push eax
push 0x40000000
push ebx
call dword [sym.imp.Mso20Win32Client.dll_Ordinal_745]
mov esi, eax
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp esi, 0xffffffff
jne 0x4054c0
push 0x80004005
mov ecx, edi
call fcn.0040c69e
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00414f12
mov esp, ebp
pop ebp
ret 0xc