Function at 0x405814
Capabilities:
Get common file path

Disassembly:
push ebp
mov ebp, esp
push ecx
mov ecx, 0x4b
push 0
push 0
dec ecx
jne 0x40581d
xchg dword [ebp - 4], ecx
push ebx
push esi
push edi
mov ebx, ecx
mov esi, edx
mov edi, eax
xor eax, eax
push ebp
push 0x405c87
push dword fs:[eax]
mov dword fs:[eax], esp
mov eax, ebx
xor edx, edx
call sub.rtl120.bpl__System__UStrAsg_qqrr20System_UnicodeStringx20System_UnicodeString
mov word [ebp - 0x20a], 0
push 0
push esi
lea eax, [ebp - 0x20a]
push eax
push edi
call sub.shell32.dll_SHGetSpecialFolderPathW
test eax, eax
je 0x405876
mov eax, ebx
lea edx, [ebp - 0x20a]
mov ecx, 0x105
call sub.rtl120.bpl__System__UStrFromWArray_qqrr20System_UnicodeStringpbi
mov eax, dword [ebx]
call sub.rtl120.bpl__System__UStrLen_qqrx20System_UnicodeString
cmp eax, 2
jg case.0x405899.27
add esi, 0xffffffe6
cmp esi, 0x11
ja case.0x405899.27
movzx esi, byte [esi + 0x4058a0]
jmp dword [esi*4 + 0x4058b2]
lea edx, [ebp - 0x210]
mov eax, 0x405ca4
call sub.rtl120.bpl__Sysutils_GetEnvironmentVariable_qqrx20System_UnicodeString
mov eax, dword [ebp - 0x210]
mov edx, ebx
call sub.rtl120.bpl__Sysutils_Trim_qqrx20System_UnicodeString
cmp dword [ebx], 0
jne case.0x405899.27
push 0x405cbc
call sub.kernel32.dll_GetModuleHandleW_1
lea edx, [ebp - 0x214]
call sub.rtl120.bpl__Sysutils_GetModuleName_qqrui
mov eax, dword [ebp - 0x214]
mov edx, ebx
call sub.rtl120.bpl__Sysutils_ExtractFileDrive_qqrx20System_UnicodeString
mov eax, dword [sym.imp.rtl120.bpl__Sysutils_Win32MajorVersion]
cmp dword [eax], 5
jle 0x405949
push dword [ebx]
push 0x405ce4
lea eax, [ebp - 0x218]
call fcn.0040578c
push dword [ebp - 0x218]
mov eax, ebx
mov edx, 3
call sub.rtl120.bpl__System__UStrCatN_qqrv
jmp case.0x405899.27
push dword [ebx]
push 0x405d00
lea eax, [ebp - 0x21c]
call fcn.0040578c
push dword [ebp - 0x21c]
mov eax, ebx
mov edx, 3
call sub.rtl120.bpl__System__UStrCatN_qqrv
jmp case.0x405899.27
call fcn.004056c0
test al, al
je 0x40599a
lea edx, [ebp - 0x220]
mov eax, 0x405d40
call sub.rtl120.bpl__Sysutils_GetEnvironmentVariable_qqrx20System_UnicodeString
mov eax, dword [ebp - 0x220]
mov edx, ebx
call sub.rtl120.bpl__Sysutils_Trim_qqrx20System_UnicodeString
jmp 0x4059b7
lea edx, [ebp - 0x224]
mov eax, 0x405d70
call sub.rtl120.bpl__Sysutils_GetEnvironmentVariable_qqrx20System_UnicodeString
mov eax, dword [ebp - 0x224]
mov edx, ebx
call sub.rtl120.bpl__Sysutils_Trim_qqrx20System_UnicodeString
cmp dword [ebx], 0
jne case.0x405899.27
push 0x405cbc
call sub.kernel32.dll_GetModuleHandleW_1
lea edx, [ebp - 0x228]
call sub.rtl120.bpl__Sysutils_GetModuleName_qqrui
mov eax, dword [ebp - 0x228]
mov edx, ebx
call sub.rtl120.bpl__Sysutils_ExtractFileDrive_qqrx20System_UnicodeString
call fcn.004056c0
test al, al
je 0x4059fc
mov eax, ebx
mov edx, 0x405d98
call sub.rtl120.bpl__System__UStrCat_qqrr20System_UnicodeStringx20System_UnicodeString
jmp case.0x405899.27
mov eax, ebx
mov edx, 0x405dd0
call sub.rtl120.bpl__System__UStrCat_qqrr20System_UnicodeStringx20System_UnicodeString
jmp case.0x405899.27
call fcn.004056c0
test al, al
je 0x405a35
lea edx, [ebp - 0x22c]
mov eax, 0x405dfc
call sub.rtl120.bpl__Sysutils_GetEnvironmentVariable_qqrx20System_UnicodeString
mov eax, dword [ebp - 0x22c]
mov edx, ebx
call sub.rtl120.bpl__Sysutils_Trim_qqrx20System_UnicodeString
jmp 0x405a52
lea edx, [ebp - 0x230]
mov eax, 0x405e38
call sub.rtl120.bpl__Sysutils_GetEnvironmentVariable_qqrx20System_UnicodeString
mov eax, dword [ebp - 0x230]
mov edx, ebx
call sub.rtl120.bpl__Sysutils_Trim_qqrx20System_UnicodeString
cmp dword [ebx], 0
jne case.0x405899.27
push 0x405cbc
call sub.kernel32.dll_GetModuleHandleW_1
lea edx, [ebp - 0x234]
call sub.rtl120.bpl__Sysutils_GetModuleName_qqrui
mov eax, dword [ebp - 0x234]
mov edx, ebx
call sub.rtl120.bpl__Sysutils_ExtractFileDrive_qqrx20System_UnicodeString
call fcn.004056c0
test al, al
je 0x405a97
mov eax, ebx
mov edx, 0x405e6c
call sub.rtl120.bpl__System__UStrCat_qqrr20System_UnicodeStringx20System_UnicodeString
jmp case.0x405899.27
mov eax, ebx
mov edx, 0x405ebc
call sub.rtl120.bpl__System__UStrCat_qqrr20System_UnicodeStringx20System_UnicodeString
jmp case.0x405899.27
lea edx, [ebp - 0x238]
mov eax, 0x405f00
call sub.rtl120.bpl__Sysutils_GetEnvironmentVariable_qqrx20System_UnicodeString
mov eax, dword [ebp - 0x238]
mov edx, ebx
call sub.rtl120.bpl__Sysutils_Trim_qqrx20System_UnicodeString
cmp dword [ebx], 0
jne case.0x405899.27
push 0x405cbc
call sub.kernel32.dll_GetModuleHandleW_1
lea edx, [ebp - 0x23c]
call sub.rtl120.bpl__Sysutils_GetModuleName_qqrui
mov eax, dword [ebp - 0x23c]
mov edx, ebx
call sub.rtl120.bpl__Sysutils_ExtractFileDrive_qqrx20System_UnicodeString
mov eax, dword [sym.imp.rtl120.bpl__Sysutils_Win32MajorVersion]
cmp dword [eax], 5
jle 0x405b28
push dword [ebx]
push 0x405ce4
lea eax, [ebp - 0x240]
call fcn.0040578c
push dword [ebp - 0x240]
push 0x405f1c
mov eax, ebx
mov edx, 4
call sub.rtl120.bpl__System__UStrCatN_qqrv
jmp case.0x405899.27
push dword [ebx]
push 0x405d00
lea eax, [ebp - 0x244]
call fcn.0040578c
push dword [ebp - 0x244]
push 0x405f4c
mov eax, ebx
mov edx, 4
call sub.rtl120.bpl__System__UStrCatN_qqrv
jmp case.0x405899.27
lea edx, [ebp - 0x248]
mov eax, 0x405f7c
call sub.rtl120.bpl__Sysutils_GetEnvironmentVariable_qqrx20System_UnicodeString
mov eax, dword [ebp - 0x248]
mov edx, ebx
call sub.rtl120.bpl__Sysutils_Trim_qqrx20System_UnicodeString
cmp dword [ebx], 0
jne case.0x405899.27
push 0x405cbc
call sub.kernel32.dll_GetModuleHandleW_1
lea edx, [ebp - 0x24c]
call sub.rtl120.bpl__Sysutils_GetModuleName_qqrui
mov eax, dword [ebp - 0x24c]
mov edx, ebx
call sub.rtl120.bpl__Sysutils_ExtractFileDrive_qqrx20System_UnicodeString
mov eax, dword [sym.imp.rtl120.bpl__Sysutils_Win32MajorVersion]
cmp dword [eax], 5
jle 0x405bd6
push dword [ebx]
push 0x405ce4
lea eax, [ebp - 0x250]
call fcn.0040578c
push dword [ebp - 0x250]
push 0x405fa4
mov eax, ebx
mov edx, 4
call sub.rtl120.bpl__System__UStrCatN_qqrv
jmp case.0x405899.27
push dword [ebx]
push 0x405d00
lea eax, [ebp - 0x254]
call fcn.0040578c
push dword [ebp - 0x254]
push 0x405fd0
mov eax, ebx
mov edx, 4
call sub.rtl120.bpl__System__UStrCatN_qqrv
jmp case.0x405899.27
lea edx, [ebp - 0x258]
mov eax, 0x406020
call sub.rtl120.bpl__Sysutils_GetEnvironmentVariable_qqrx20System_UnicodeString
mov eax, dword [ebp - 0x258]
mov edx, ebx
call sub.rtl120.bpl__Sysutils_Trim_qqrx20System_UnicodeString
cmp dword [ebx], 0
jne case.0x405899.27
push 0x405cbc
call sub.kernel32.dll_GetModuleHandleW_1
lea edx, [ebp - 0x25c]
call sub.rtl120.bpl__Sysutils_GetModuleName_qqrui
mov eax, dword [ebp - 0x25c]
mov edx, ebx
call sub.rtl120.bpl__Sysutils_ExtractFileDrive_qqrx20System_UnicodeString
mov eax, dword [sym.imp.rtl120.bpl__Sysutils_Win32MajorVersion]
cmp dword [eax], 5
jle 0x405c5d
mov eax, ebx
mov edx, 0x406044
call sub.rtl120.bpl__System__UStrCat_qqrr20System_UnicodeStringx20System_UnicodeString
jmp case.0x405899.27
mov eax, ebx
mov edx, 0x40606c
call sub.rtl120.bpl__System__UStrCat_qqrr20System_UnicodeStringx20System_UnicodeString
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x405c8e
lea eax, [ebp - 0x25c]
mov edx, 0x14
call sub.rtl120.bpl__System__UStrArrayClr_qqrpvi
ret