Function at 0x46173e
Capabilities:
Get common file path
Set current directory
Set environment variable

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x44
movzx eax, word [ebp + 0x14]
push ebx
push esi
mov esi, ecx
mov cl, al
and cl, 4
mov byte [ebp - 2], cl
mov cl, byte [0x496b86]
mov byte [ebp - 1], cl
xor ecx, ecx
mov dl, byte [esi + 0xe]
mov ebx, dword [ebp + 0x14]
mov cl, al
and dl, 0x7f
push edi
shr ebx, 0x10
xor edi, edi
mov dword [ebp - 0xc], esi
mov dword [ebp + 0x14], eax
and ecx, 0x10
mov dword [ebp - 0x30], ecx
xor ecx, ecx
mov cl, al
and ecx, 0x40
mov dword [ebp - 0x20], ecx
mov ecx, eax
shr ecx, 1
shl cl, 7
or cl, dl
mov byte [esi + 0xe], cl
mov cl, al
and cl, 1
test al, al
mov byte [ebp - 3], cl
js 0x4617b5
cmp byte [0x496e68], 0
je 0x4617b5
push esi
mov byte [0x496e68], 0
call fcn.0040c54c
pop ecx
cmp dword [ebp + 0xc], edi
mov ecx, dword [ebp + 8]
jne 0x4617c0
mov dword [ebp + 0xc], ecx
cmp dword [ebp + 0x18], edi
jne 0x4617c8
mov dword [ebp + 0x18], ecx
mov eax, dword [esi + 0x2c]
xor edx, edx
cmp eax, edi
setne dl
push ecx
lea ecx, [ebp - 0x24]
mov dword [ebp - 0x10], eax
mov dword [ebp - 0x24], edi
mov dword [ebp - 0x18], edx
call fcn.00451613
xor eax, eax
cmp dword [ebp + 0x10], edi
mov dword [ebp - 0x14], edi
setne al
cmp eax, edi
mov dword [ebp - 0x28], eax
je 0x461811
push 0x20a
lea ecx, [ebp - 0x14]
call fcn.0042c43e
push dword [ebp - 0x14]
push 0x208
call dword [sym.imp.KERNEL32.dll_GetCurrentDirectoryW]
xor eax, eax
cmp dword [ebp - 0x18], edi
mov dword [ebp - 0x1c], eax
je 0x46185b
cmp byte [ebp - 2], al
jne 0x46185b
push 1
call fcn.0045d25e
mov dword [esp], 0x8c4
call fcn.0046c708
cmp eax, edi
pop ecx
mov dword [ebp + 8], eax
je 0x461856
push edi
push edi
push edi
push edi
push edi
push 0x271c
call dword [sym.imp.USER32.dll_GetDesktopWindow]
mov ecx, dword [ebp + 8]
push eax
call fcn.004382f0
jmp 0x461858
xor eax, eax
mov dword [ebp - 0x1c], eax
cmp eax, edi
mov dword [ebp - 0x2c], eax
mov edi, eax
jne 0x461867
mov edi, dword [ebp - 0x10]
mov ecx, dword [ebp + 0x1c]
test ecx, ecx
je 0x461871
mov dword [ecx + 0x2c], edi
xor eax, eax
test ecx, ecx
jne 0x461898
push 0x94
call fcn.0046c708
test eax, eax
pop ecx
je 0x461891
push edi
push esi
mov ecx, eax
call fcn.0041c8c5
jmp 0x461893
xor eax, eax
mov ecx, eax
mov dword [ebp + 0x1c], ecx
test ecx, ecx
mov dword [ebp - 0x44], eax
je 0x4618a1
mov esi, ecx
mov eax, dword [esi + 0x2c]
mov word [esi + 8], bx
mov ebx, 0x4975e4
push ebx
mov dword [ebp - 0x40], eax
mov dword [esi + 0x2c], edi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [esi + 0x40]
mov dword [ebp - 0x38], eax
mov eax, dword [esi + 0x44]
mov dword [ebp - 0x3c], eax
mov al, byte [esi + 0xb]
mov byte [ebp - 4], al
mov eax, dword [esi + 4]
mov dword [ebp - 0x34], eax
mov al, byte [esi + 0x8a]
push ebx
mov byte [ebp - 5], al
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
lea eax, [ebp - 0x24]
mov dword [esi + 0x40], eax
mov eax, dword [ebp - 0x24]
mov eax, dword [eax]
push 1
push dword [ebp + 0xc]
mov ecx, esi
mov dword [ebp + 8], eax
mov dword [esi + 0x44], eax
call fcn.0043969f
push dword [ebp + 8]
call dword [sym.imp.KERNEL32.dll_lstrlenW]
cmp dword [ebp - 0x18], 0
mov dword [esi + 0x4c], eax
je 0x46191a
mov eax, dword [ebp + 0x18]
mov dword [edi + 0x144], eax
and dword [esi + 0x1c], 0
test byte [ebp + 0x14], 0x10
je 0x461928
or byte [esi + 0xb], 1
test byte [ebp + 0x14], 0x20
je 0x461935
or byte [esi + 0x8a], 1
cmp dword [ebp - 0x28], 0
je 0x461989
lea ecx, [ebp + 0x14]
call fcn.0042c3f7
cmp word [ebp - 0x20], 0
jne 0x461972
push 1
lea eax, [ebp + 0x14]
push eax
push dword [ebp + 0x10]
call fcn.00434c96
add esp, 0xc
push dword [ebp + 0x14]
push dword [ebp - 0x14]
call dword [sym.imp.KERNEL32.dll_lstrcmpiW]
test eax, eax
jne 0x461972
mov dword [ebp - 0x20], 0x40
movzx eax, word [ebp - 0x20]
push eax
push dword [ebp + 0x10]
mov ecx, esi
call fcn.00413187
lea ecx, [ebp + 0x14]
call fcn.0042704a
cmp dword [ebp + 0x10], 0
jne 0x461996
mov dword [ebp + 0x10], 0x480934
cmp dword [ebp - 0x18], 0
je 0x4619e2
cmp dword [ebp - 0x1c], 0
je 0x4619e2
mov eax, dword [edi + 0xe0]
mov dword [edi + 0x13c], esi
mov dword [eax], esi
push edi
mov byte [edi + 0x6a], 1
mov byte [edi + 0x69], 0xff
call fcn.0042a08d
cmp byte [ebp - 1], 0
pop ecx
jne 0x4619e2
cmp dword [ebp - 0x10], 0
je 0x4619e2
push ebx
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [ebp - 0x10]
inc dword [eax + 0xc0]
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [ebp - 0xc]
mov al, byte [eax + 0xd]
test al, al
je 0x4619ef
mov byte [esi + 0xd], al
cmp word [ebp - 0x30], 0
mov al, byte [ebp - 3]
mov byte [esi + 0xc], al
jne 0x461a4a
push ebx
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov ecx, dword [ebp - 0xc]
push 0xffffffffffffffff
push 0
push str.__MAIN__
call fcn.0040f12a
test eax, eax
jne 0x461a1f
mov eax, 0x4846b8
jmp 0x461a36
push dword [eax]
push 0x48759c
call fcn.00427f44
test al, al
pop ecx
pop ecx
jne 0x461a43
mov eax, 0x482188
push eax
push 0x488ca0
mov ecx, esi
call fcn.0042af0d
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
cmp dword [0x496de4], 0
je 0x461a92
mov eax, dword [ebp + 0x10]
cmp word [eax], 0
je 0x461a92
test byte [esi + 0xe], 8
jne 0x461a92
push str.ENTER:
lea ecx, [ebp + 0x14]
call fcn.004361de
push dword [ebp + 0x10]
lea ecx, [ebp + 0x14]
call fcn.0042c465
push 0
push 0x11
push 0
push dword [ebp + 0x14]
mov ecx, esi
call fcn.004152cf
lea ecx, [ebp + 0x14]
call fcn.0042704a
mov eax, dword [ebp - 0xc]
mov byte [esi + 0x88], 1
test byte [eax + 0xe], 0x80
je 0x461aa6
and byte [esi + 0xe], 0xfe
cmp dword [ebp - 0x18], 0
je 0x461ba6
cmp dword [ebp - 0x1c], 0
je 0x461ba6
cmp byte [ebp - 1], 0
mov ecx, edi
je 0x461b9b
mov eax, dword [edi]
push 0
push 0x271d
mov byte [edi + 0x69], 0x81
mov byte [edi + 0x68], 0x10
call dword [eax + 8]
mov eax, dword [edi + 0x18]
push str.0x_I64X
cdq
push str.__WinID
push edx
push eax
push esi
call fcn.00438a6c
and dword [edi + 0x144], 0
add esp, 0x14
push dword [ebp + 0x18]
mov ecx, esi
call fcn.0045c3b7
cmp dword [edi + 0xc0], 0
jg 0x461b23
mov eax, dword [edi + 0xac]
cmp dword [eax], 0
jg 0x461b23
mov eax, dword [edi + 0xbc]
cmp dword [eax], 0
jle 0x461b43
push 0
push 0
push 0x10
push dword [edi + 0x18]
mov byte [edi + 0x69], 0xff
call dword [sym.imp.USER32.dll_PostMessageW]
push 0x20
mov ecx, edi
call fcn.00435b82
mov byte [edi + 0x69], 0x81
xor edi, edi
mov eax, dword [ebp + 0x10]
cmp word [eax], di
je 0x461b81
test byte [esi + 0xe], 8
jne 0x461b81
push str.LEAVE:
lea ecx, [ebp + 0x14]
call fcn.004361de
push dword [ebp + 0x10]
lea ecx, [ebp + 0x14]
call fcn.0042c465
push edi
push 0x11
push edi
push dword [ebp + 0x14]
mov ecx, esi
call fcn.004152cf
lea ecx, [ebp + 0x14]
call fcn.0042704a
cmp dword [ebp + 0x1c], edi
mov eax, dword [esi + 0x84]
mov dword [ebp + 0x10], eax
je 0x461bd7
push dword [ebp - 0x34]
mov ecx, esi
call fcn.0041c401
jmp 0x461c00
mov byte [edi + 0x68], 0
call fcn.00435cb9
jmp 0x461b43
push dword [ebp + 8]
mov ecx, esi
call fcn.0045c3b7
mov eax, dword [esi + 0x2c]
xor edi, edi
cmp eax, edi
je 0x461b45
cmp byte [ebp - 2], 0
jne 0x461b45
push edi
push edi
push 0x10
push dword [eax + 0x18]
call dword [sym.imp.USER32.dll_PostMessageW]
mov eax, dword [esi + 0x2c]
mov dword [ebp - 0x2c], eax
jmp 0x461b45
push ebx
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [ebp - 0x38]
mov dword [esi + 0x40], eax
mov eax, dword [ebp - 0x3c]
mov dword [esi + 0x44], eax
mov al, byte [ebp - 4]
mov byte [esi + 0xb], al
mov al, byte [ebp - 5]
push ebx
mov byte [esi + 0x8a], al
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
cmp dword [esi + 0x2c], edi
je 0x461c0b
mov eax, dword [ebp - 0x40]
mov dword [esi + 0x2c], eax
lea ecx, [ebp - 0x44]
call fcn.004362cc
mov ecx, dword [ebp - 0x2c]
cmp ecx, edi
je 0x461c21
mov eax, dword [ecx]
push 1
call dword [eax + 0xc]
cmp byte [ebp - 1], 0
jne 0x461c58
mov esi, dword [ebp - 0x10]
cmp esi, edi
je 0x461c58
push ebx
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
dec dword [esi + 0xc0]
cmp byte [esi + 0x69], 0x81
je 0x461c51
push edi
push edi
push 0x43d
push dword [esi + 0x18]
call dword [sym.imp.USER32.dll_PostMessageW]
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
call fcn.0042a5f9
cmp dword [ebp - 0x28], edi
je 0x461ced
push ebx
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov esi, dword [ebp - 0xc]
push 0xffffffffffffffff
push edi
push 0x4833b8
mov ecx, esi
call fcn.0040f12a
cmp eax, edi
je 0x461c90
push dword [eax]
push str.CurDir
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
push 0xffffffffffffffff
push edi
push str.CurDrv
mov ecx, esi
call fcn.0040f12a
cmp eax, edi
je 0x461cb0
push dword [eax]
push 0x488c60
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
push 0xffffffffffffffff
push edi
push str.CurFile
mov ecx, esi
call fcn.0040f12a
cmp eax, edi
je 0x461cd0
push dword [eax]
push 0x488c3c
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
cmp word [ebp - 0x20], di
jne 0x461ce4
push dword [ebp - 0x14]
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
call fcn.0040a910
push ebx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x461cf0
mov esi, dword [ebp - 0xc]
cmp dword [esi + 0x2c], edi
je 0x461cfb
mov eax, dword [ebp - 0x10]
mov dword [esi + 0x2c], eax
cmp byte [ebp - 1], 0
jne 0x461d09
push edi
mov ecx, esi
call fcn.0044b61d
lea ecx, [ebp - 0x14]
call fcn.0042704a
lea ecx, [ebp - 0x24]
call fcn.00416b05
mov eax, dword [ebp + 0x10]
pop edi
pop esi
pop ebx
leave
ret 0x18