Function at 0x404958
Capabilities:
Get common file path
Link many functions at runtime
Set current directory

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x210
cmp dword [0x40ebc4], 0
mov eax, dword [0x40e044]
push ebx
push esi
push edi
mov edi, dword [ebp + 8]
mov dword [ebp - 4], eax
jne 0x404ac6
lea eax, [ebp - 0x20c]
push eax
mov ebx, 0x104
push ebx
call dword [sym.imp.KERNEL32.dll_GetCurrentDirectoryA]
test eax, eax
jne 0x4049a6
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x401a64
jmp 0x404be8
push ebx
lea eax, [ebp - 0x108]
push eax
push dword [0x40ebc0]
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
test eax, eax
jne 0x4049cf
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x401a2c
jmp 0x404be8
lea eax, [ebp - 0x108]
push eax
call fcn.0040642d
test edi, edi
mov esi, dword [sym.imp.KERNEL32.dll_lstrlenA]
mov byte [eax - 1], 0
je 0x404a14
push edi
call esi
test eax, eax
jne 0x404a14
lea eax, [ebp - 0x108]
push eax
call esi
inc eax
push eax
push edi
call dword [sym.imp.KERNEL32.dll_IsBadWritePtr]
test eax, eax
jne 0x404a14
lea eax, [ebp - 0x108]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_lstrcpyA]
lea eax, [ebp - 0x108]
push eax
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryA]
test eax, eax
jne 0x404a36
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4019e8
jmp 0x404be8
mov edi, 0x4019d8
push edi
call esi
lea ecx, [ebp - 0x108]
push ecx
mov dword [ebp - 0x210], eax
call esi
mov ecx, dword [ebp - 0x210]
lea eax, [ecx + eax + 1]
cmp eax, ebx
jle 0x404a6a
push 0x4019b4
call fcn.0040674d
jmp 0x404bee
push edi
lea eax, [ebp - 0x108]
push eax
call dword [sym.imp.KERNEL32.dll_lstrcatA]
lea eax, [ebp - 0x108]
push eax
call dword [sym.imp.KERNEL32.dll_LoadLibraryA]
mov dword [0x40ebc4], eax
lea eax, [ebp - 0x20c]
push eax
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryA]
test eax, eax
jne 0x404aac
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x401970
jmp 0x404be8
cmp dword [0x40ebc4], 0
jne 0x404ac6
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x401938
jmp 0x404be8
cmp dword [0x40ebe8], 0
mov esi, dword [sym.imp.KERNEL32.dll_GetProcAddress]
jne 0x404afe
push 0x401928
push dword [0x40ebc4]
call esi
xor edi, edi
cmp eax, edi
mov dword [0x40ebe8], eax
jne 0x404b00
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4018e0
jmp 0x404be8
xor edi, edi
cmp dword [0x40ebe0], edi
jne 0x404b2f
push 0x4018c8
push dword [0x40ebc4]
call esi
cmp eax, edi
mov dword [0x40ebe0], eax
jne 0x404b2f
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x401878
jmp 0x404be8
cmp dword [0x40ebec], edi
jne 0x404b66
push 0x401860
push dword [0x40ebc4]
call esi
cmp eax, edi
mov dword [0x40ebec], eax
jne 0x404b5e
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x401810
jmp 0x404be8
push dword [0x40ebcc]
call eax
cmp dword [0x40ebf0], edi
jne 0x404b92
push 0x4017fc
push dword [0x40ebc4]
call esi
cmp eax, edi
mov dword [0x40ebf0], eax
jne 0x404b92
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4017b0
jmp 0x404be8
cmp dword [0x40ebf4], edi
jne 0x404bbe
push 0x401798
push dword [0x40ebc4]
call esi
cmp eax, edi
mov dword [0x40ebf4], eax
jne 0x404bbe
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x401748
jmp 0x404be8
cmp dword [0x40ebe4], edi
jne 0x404bf3
push 0x40172c
push dword [0x40ebc4]
call esi
cmp eax, edi
mov dword [0x40ebe4], eax
jne 0x404bf3
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4016e0
call fcn.0040674d
pop ecx
pop ecx
xor eax, eax
jmp 0x404bf6
xor eax, eax
inc eax
mov ecx, dword [ebp - 4]
pop edi
pop esi
pop ebx
call fcn.00406819
leave
ret 4