Function at 0x40c9ef
Capabilities:
Check if file exists
Create directory
Get common file path
Get file attributes
Read .ini file
Set environment variable

Disassembly:
push ebp
sub esp, 0x820
lea ebp, [esp - 4]
mov eax, dword [0x4313f4]
xor eax, ebp
mov dword [ebp + 0x820], eax
push 0x130
mov eax, 0x41c20a
call fcn.004127a4
mov eax, dword [ebp + 0x82c]
xor ebx, ebx
push ebx
push ebx
mov dword [ebp - 0x10], eax
mov eax, dword [ebp + 0x830]
xor esi, esi
inc esi
push esi
push ebx
mov dword [ebp - 0x1c], eax
mov eax, str.class_ATL::CComBSTR___cdecl_XMP::GetUserDataPath_const_wchar_t__
push eax
push 0x4228ec
push eax
lea ecx, [ebp - 0x38]
mov dword [ebp - 0x14], ebx
call fcn.00407ab1
mov dword [ebp - 4], esi
xor eax, eax
mov edi, 0x104
mov esi, 0x4324c0
cmp ax, word [0x4324c0]
jne 0x40cd35
push 0x206
mov word [ebp], ax
lea eax, [ebp + 2]
push ebx
push eax
call sub.MSVCR90.dll_memset
add esp, 0xc
push edi
lea eax, [ebp]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
xor eax, eax
push 0x206
mov word [ebp + 0x208], ax
lea eax, [ebp + 0x20a]
push ebx
push eax
call sub.MSVCR90.dll_memset
add esp, 0xc
lea eax, [ebp + 0x208]
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x40cc5c
push str.shell32.dll
call dword [sym.imp.KERNEL32.dll_LoadLibraryW]
push str.SHGetKnownFolderPath
push eax
mov dword [ebp - 0x20], eax
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
cmp eax, ebx
je 0x40cbb6
lea ecx, [ebp - 0x18]
push ecx
push ebx
push ebx
push 0x426428
mov dword [ebp - 0x18], ebx
call eax
cmp eax, ebx
jge 0x40cb16
push dword [ebp - 0x20]
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
mov esi, dword [ebp - 0x10]
mov dword [esi], ebx
mov dword [ebp - 0x14], 1
mov byte [ebp - 4], bl
lea ecx, [ebp - 0x38]
call fcn.00407d23
mov eax, esi
jmp 0x40cdaa
push dword [ebp - 0x18]
lea eax, [ebp - 0x138]
lea ecx, [ebp - 0x13c]
mov dword [ebp - 0x13c], eax
call fcn.0040aca4
mov byte [ebp - 4], 2
push dword [ebp - 0x13c]
push esi
call dword [sym.imp.MSVCR90.dll_wcscpy]
pop ecx
pop ecx
mov byte [ebp - 4], 1
lea eax, [ebp - 0x138]
cmp dword [ebp - 0x13c], eax
je 0x40cb62
push dword [ebp - 0x13c]
call dword [sym.imp.MSVCR90.dll_free]
pop ecx
push dword [ebp - 0x18]
call dword [sym.imp.ole32.dll_CoTaskMemFree]
push esi
call dword [sym.imp.SHLWAPI.dll_PathAddBackslashW]
push 0x422890
call fcn.00402c05
pop ecx
test eax, eax
jne 0x40cbab
push 1
push esi
push str.vista_PersistFileDir_:
push ebx
push 0x422890
call fcn.00407313
pop ecx
pop ecx
mov ecx, eax
call fcn.0040c748
mov ecx, eax
call fcn.0040a3ec
mov ecx, eax
call fcn.0040bcf5
push dword [ebp - 0x20]
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
jmp 0x40cc02
push esi
push ebx
push ebx
push 0x23
push ebx
call dword [sym.imp.SHELL32.dll_SHGetFolderPathW]
push esi
call dword [sym.imp.SHLWAPI.dll_PathAddBackslashW]
push 0x422890
call fcn.00402c05
pop ecx
test eax, eax
jne 0x40cc02
push 1
push esi
push str.xp_PersistFileDir_:
push ebx
push 0x422890
call fcn.00407313
pop ecx
pop ecx
mov ecx, eax
call fcn.0040c748
mov ecx, eax
call fcn.0040a3ec
mov ecx, eax
call fcn.0040bcf5
push str.Thunder_Network_
push esi
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
push esi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x40cc1e
test al, 0x10
jne 0x40cc34
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
test eax, eax
jne 0x40cc34
push 0x41f4d4
jmp 0x40cd8d
push str.XMP4_
push esi
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
push esi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x40cc50
test al, 0x10
jne 0x40cc5c
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
test eax, eax
je 0x40cc2a
xor eax, eax
push 0x206
mov word [ebp + 0x618], ax
lea eax, [ebp + 0x61a]
push ebx
push eax
call sub.MSVCR90.dll_memset
xor eax, eax
push 0x206
mov word [ebp + 0x410], ax
lea eax, [ebp + 0x412]
push ebx
push eax
call sub.MSVCR90.dll_memset
add esp, 0x18
push edi
lea eax, [ebp + 0x618]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
push str...xmp.ini
lea eax, [ebp + 0x618]
push eax
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
lea eax, [ebp + 0x618]
push eax
push edi
lea eax, [ebp + 0x410]
push eax
push esi
push str.UserDataDir
push 0x4227f8
call dword [sym.imp.KERNEL32.dll_GetPrivateProfileStringW]
lea eax, [ebp + 0x410]
push eax
lea eax, [ebp + 0x618]
push eax
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
lea eax, [ebp + 0x618]
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x40cd09
lea eax, [ebp + 0x618]
push eax
push ebx
call dword [sym.imp.SHELL32.dll_SHCreateDirectory]
lea eax, [ebp + 0x618]
push eax
call dword [sym.imp.SHLWAPI.dll_PathAddBackslashW]
push edi
lea eax, [ebp + 0x618]
push eax
push edi
push esi
call dword [sym.imp.MSVCR90.dll_wcsncpy_s]
add esp, 0x10
push esi
push str.userdata
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
push edi
push esi
push edi
mov esi, 0x4322b8
push esi
call dword [sym.imp.MSVCR90.dll_wcsncpy_s]
add esp, 0x10
cmp dword [ebp - 0x1c], ebx
je 0x40cd56
push dword [ebp - 0x1c]
push esi
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
mov edi, 0x422890
push edi
call fcn.00402c05
pop ecx
test eax, eax
jne 0x40cd8c
push 1
push esi
push str.Path_:
push ebx
push edi
call fcn.00407313
pop ecx
pop ecx
mov ecx, eax
call fcn.0040c748
mov ecx, eax
call fcn.0040a3ec
mov ecx, eax
call fcn.0040bcf5
push esi
mov ecx, dword [ebp - 0x10]
call fcn.0040a683
mov dword [ebp - 0x14], 1
mov byte [ebp - 4], bl
lea ecx, [ebp - 0x38]
call fcn.00407d23
mov eax, dword [ebp - 0x10]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp + 0x820]
xor ecx, ebp
call fcn.0041276a
add ebp, 0x824
leave
ret