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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x416c88
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 0x958
mov eax, dword [0x4251a4]
push ebx
push esi
push edi
mov edi, dword [ebp + 0xc]
xor ebx, ebx
push ebx
push ebx
push 1
push ebx
xor eax, ebp
push str.class_ATL::CComBSTR___cdecl_XMP::GetUserDataPath_const_wchar_t__
mov dword [esp + 0x970], eax
mov eax, dword [ebp + 8]
push 0x41bc7c
push str.class_ATL::CComBSTR___cdecl_XMP::GetUserDataPath_const_wchar_t__
lea ecx, [esp + 0x38]
mov dword [esp + 0x2c], eax
mov dword [esp + 0x34], edi
mov dword [esp + 0x28], ebx
call fcn.00408360
mov dword [esp + 0x96c], 1
cmp word [0x426100], bx
mov esi, dword [sym.imp.SHLWAPI.dll_PathAppendW]
jne 0x40fe1d
mov word [esp + 0x548], bx
xor eax, eax
mov ecx, 0x81
lea edi, [esp + 0x54a]
rep stosd dword es:[edi], eax
push 0x104
lea ecx, [esp + 0x54c]
push ecx
push ebx
stosw word es:[edi], ax
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
mov word [esp + 0x750], bx
xor eax, eax
mov ecx, 0x81
lea edi, [esp + 0x752]
rep stosd dword es:[edi], eax
lea edx, [esp + 0x750]
push edx
stosw word es:[edi], ax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x40fd2c
push str.shell32.dll
call dword [sym.imp.KERNEL32.dll_LoadLibraryW]
mov edi, eax
push str.SHGetKnownFolderPath
push edi
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
cmp eax, ebx
je 0x40fc5e
lea ecx, [esp + 0x14]
push ecx
push ebx
push ebx
push 0x41b6ac
mov dword [esp + 0x24], ebx
call eax
cmp eax, ebx
jge 0x40fbb0
push edi
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
mov esi, dword [esp + 0x10]
mov dword [esi], ebx
mov dword [esp + 0xc], 1
mov byte [esp + 0x96c], bl
lea ecx, [esp + 0x1c]
call fcn.00408660
mov ecx, dword [esp + 0x964]
mov eax, esi
mov dword fs:[0], ecx
mov ecx, dword [esp + 0x95c]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00414f09
mov esp, ebp
pop ebp
ret
mov eax, dword [esp + 0x14]
lea edx, [esp + 0x38]
push eax
lea ecx, [esp + 0x38]
mov dword [esp + 0x38], edx
call fcn.0040cef0
mov byte [esp + 0x96c], 2
mov ecx, dword [esp + 0x34]
push ecx
push 0x426100
call dword [sym.imp.MSVCR71.dll_wcscpy]
add esp, 8
mov byte [esp + 0x96c], 1
mov eax, dword [esp + 0x34]
lea edx, [esp + 0x38]
cmp eax, edx
je 0x40fbff
push eax
call dword [sym.imp.MSVCR71.dll_free]
add esp, 4
mov eax, dword [esp + 0x14]
push eax
call dword [sym.imp.ole32.dll_CoTaskMemFree]
push 0x426100
call dword [sym.imp.SHLWAPI.dll_PathAddBackslashW]
push 0x41bc20
call fcn.00402d00
add esp, 4
test eax, eax
jne 0x40fc55
push 1
push 0x426100
push str.vista_PersistFileDir_:
push ebx
push 0x41bc20
call fcn.00407790
add esp, 8
mov ecx, eax
call fcn.0040f3e0
mov ecx, eax
call fcn.0040d460
mov ecx, eax
call fcn.0040f3a0
push edi
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
jmp 0x40fcb9
push 0x426100
push ebx
push ebx
push 0x23
push ebx
call dword [sym.imp.SHELL32.dll_SHGetFolderPathW]
push 0x426100
call dword [sym.imp.SHLWAPI.dll_PathAddBackslashW]
push 0x41bc20
call fcn.00402d00
add esp, 4
test eax, eax
jne 0x40fcb9
push 1
push 0x426100
push str.xp_PersistFileDir_:
push ebx
push 0x41bc20
call fcn.00407790
add esp, 8
mov ecx, eax
call fcn.0040f3e0
mov ecx, eax
call fcn.0040d460
mov ecx, eax
call fcn.0040f3a0
push str.Thunder_Network_
push 0x426100
call esi
mov edi, dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
push 0x426100
call edi
cmp eax, 0xffffffff
je 0x40fcdb
test al, 0x10
jne 0x40fceb
push ebx
push 0x426100
call dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
test eax, eax
je 0x40fd17
push str.XMP4_
push 0x426100
call esi
push 0x426100
call edi
cmp eax, 0xffffffff
je 0x40fd07
test al, 0x10
jne 0x40fd2c
push ebx
push 0x426100
call dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
test eax, eax
jne 0x40fd2c
mov esi, dword [esp + 0x10]
push 0x41967c
mov ecx, esi
call fcn.0040c250
jmp 0x40fb73
xor eax, eax
mov word [esp + 0x138], bx
mov ecx, 0x81
lea edi, [esp + 0x13a]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
mov word [esp + 0x340], bx
xor eax, eax
mov ecx, 0x81
lea edi, [esp + 0x342]
rep stosd dword es:[edi], eax
push 0x104
lea ecx, [esp + 0x13c]
push ecx
push ebx
stosw word es:[edi], ax
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
push str...xmp.ini
lea edx, [esp + 0x13c]
push edx
call esi
lea eax, [esp + 0x138]
push eax
push 0x104
lea ecx, [esp + 0x348]
push ecx
push 0x426100
push str.UserDataDir
push 0x41bb88
call dword [sym.imp.KERNEL32.dll_GetPrivateProfileStringW]
lea edx, [esp + 0x340]
push edx
lea eax, [esp + 0x13c]
push eax
call esi
lea ecx, [esp + 0x138]
push ecx
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x40fde0
lea edx, [esp + 0x138]
push edx
push ebx
call dword [sym.imp.SHELL32.dll_SHCreateDirectory]
lea eax, [esp + 0x138]
push eax
call dword [sym.imp.SHLWAPI.dll_PathAddBackslashW]
push 0x104
lea ecx, [esp + 0x13c]
push ecx
push 0x426100
call dword [sym.imp.MSVCR71.dll_wcsncpy]
add esp, 0xc
push 0x426100
push str.userdata
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
mov edi, dword [esp + 0x18]
push 0x426100
push 0x425ef8
call dword [sym.imp.MSVCR71.dll_wcscpy]
add esp, 8
cmp edi, ebx
je 0x40fe3c
push edi
push 0x425ef8
call esi
push 0x41bc20
call fcn.00402d00
add esp, 4
test eax, eax
jne 0x40fe9f
push 0x425ef8
push str.Path_:
push ebx
push 0x41bc20
call fcn.00407790
add esp, 8
mov ecx, eax
call fcn.0040f3e0
mov ecx, eax
call fcn.0040d460
push 1
mov esi, eax
push ebx
mov dword [0x425bbc], ebx
mov edx, dword [esi + 0x240]
push ebx
push edx
push 1
mov ecx, esi
mov dword [esi + 0x248], ebx
call fcn.00407d80
add esi, 0xc
push esi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push 0x425ef8
call dword [sym.imp.OLEAUT32.dll_SysReAllocString]
cmp eax, ebx
mov esi, dword [esp + 0x10]
mov dword [esi], eax
jne 0x40fb73
push 0x8007000e
call fcn.00401130
int3