Function at 0x49f2d0
Capabilities:
Get common file path
Resolve function by parsing pe exports
Set current directory
Set environment variable

Disassembly:
push 0xffffffffffffffff
push 0x4e84bb
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 0x44
push ebx
push ebp
push esi
push edi
mov esi, ecx
mov dword [esp + 0x14], esi
mov eax, dword [esp + 0x70]
movzx ebx, ax
mov ebp, eax
xor ecx, ecx
mov al, bl
and al, 4
mov byte [esp + 0x11], al
mov al, byte [0x518de2]
mov cl, bl
mov byte [esp + 0x70], al
xor edx, edx
mov eax, ebx
shr eax, 1
shl al, 7
mov dl, bl
and ecx, 0x10
mov dword [esp + 0x3c], ecx
mov cl, byte [esi + 0xe]
and cl, 0x7f
or al, cl
mov byte [esi + 0xe], al
mov al, bl
and edx, 0x40
and al, 1
shr ebp, 0x10
test bl, bl
mov dword [esp + 0x38], edx
mov byte [esp + 0x12], al
js 0x49f35c
mov al, byte [0x519110]
test al, al
je 0x49f35c
push esi
mov byte [0x519110], 0
call fcn.0041fca8
add esp, 4
mov eax, dword [esp + 0x68]
xor ecx, ecx
cmp eax, ecx
mov eax, dword [esp + 0x64]
jne 0x49f36e
mov dword [esp + 0x68], eax
cmp dword [esp + 0x74], ecx
jne 0x49f378
mov dword [esp + 0x74], eax
mov edi, dword [esi + 0x2c]
xor edx, edx
cmp edi, ecx
setne dl
mov dword [esp + 0x18], edi
mov dword [esp + 0x20], ecx
mov dword [esp + 0x1c], edx
mov dword [esp + 0x5c], ecx
push eax
lea ecx, [esp + 0x24]
call fcn.00485210
mov edx, dword [esp + 0x6c]
xor eax, eax
test edx, edx
setne al
mov dword [esp + 0x28], 0
mov dword [esp + 0x34], eax
test eax, eax
mov byte [esp + 0x5c], 1
je 0x49f3e8
push 0
mov eax, 0x416
call fcn.00445f60
add esp, 4
test eax, eax
mov dword [esp + 0x28], eax
je 0x49f3dc
mov word [eax + 0x414], 0
push eax
push 0x208
call dword [sym.imp.KERNEL32.dll_GetCurrentDirectoryW]
mov ecx, dword [esp + 0x1c]
xor eax, eax
test ecx, ecx
mov dword [esp + 0x24], eax
je 0x49f441
mov cl, byte [esp + 0x11]
test cl, cl
jne 0x49f441
push 1
call fcn.00498000
push 0x8c4
call fcn.004c86a5
mov edi, eax
add esp, 8
test edi, edi
je 0x49f437
push 0
push 0
push 0
push 0
push 0
push 0x271c
call dword [sym.imp.USER32.dll_GetDesktopWindow]
push eax
mov ecx, edi
call fcn.0045a810
jmp 0x49f439
xor eax, eax
mov edi, dword [esp + 0x18]
mov dword [esp + 0x24], eax
mov dword [esp + 0x30], eax
test eax, eax
mov byte [esp + 0x5c], 2
je 0x49f450
mov edi, eax
mov eax, dword [esp + 0x78]
test eax, eax
je 0x49f45b
mov dword [eax + 0x2c], edi
xor ecx, ecx
test eax, eax
mov dword [esp + 0x2c], ecx
jne 0x49f496
push 0x94
call fcn.004c86a5
add esp, 4
mov dword [esp + 0x78], eax
test eax, eax
mov byte [esp + 0x5c], 3
je 0x49f48a
push edi
push esi
mov ecx, eax
call fcn.00430db1
jmp 0x49f48c
xor eax, eax
mov ecx, eax
mov dword [esp + 0x2c], ecx
mov dword [esp + 0x78], eax
mov dword [esp + 0x50], ecx
test eax, eax
mov esi, dword [esp + 0x78]
mov byte [esp + 0x5c], 4
jne 0x49f4ab
mov esi, dword [esp + 0x14]
mov eax, dword [esi + 0x2c]
push 0x5194ec
mov word [esi + 8], bp
mov dword [esp + 0x50], eax
mov dword [esi + 0x2c], edi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov ecx, dword [esi + 0x40]
mov edx, dword [esi + 0x44]
mov al, byte [esi + 0xb]
mov dword [esp + 0x44], ecx
mov ecx, dword [esi + 4]
mov dword [esp + 0x48], edx
mov dl, byte [esi + 0x8a]
push 0x5194ec
mov byte [esp + 0x68], al
mov dword [esp + 0x44], ecx
mov byte [esp + 0x17], dl
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov edx, dword [esp + 0x68]
lea eax, [esp + 0x20]
mov dword [esi + 0x40], eax
mov ecx, dword [esp + 0x20]
mov ebp, dword [ecx]
push 1
push edx
mov ecx, esi
mov dword [esi + 0x44], ebp
call fcn.0045c8b0
push ebp
call dword [sym.imp.KERNEL32.dll_lstrlenW]
mov dword [esi + 0x4c], eax
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x49f52f
mov eax, dword [esp + 0x74]
mov dword [edi + 0x144], eax
test bl, 0x10
mov dword [esi + 0x1c], 0
je 0x49f53f
or byte [esi + 0xb], 1
test bl, 0x20
je 0x49f54b
or byte [esi + 0x8a], 1
mov eax, dword [esp + 0x34]
test eax, eax
je 0x49f565
movzx ecx, word [esp + 0x38]
mov edx, dword [esp + 0x6c]
push ecx
push edx
mov ecx, esi
call fcn.00426e40
mov eax, dword [esp + 0x6c]
test eax, eax
jne 0x49f575
mov dword [esp + 0x6c], 0x4ebd38
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x49f5db
mov eax, dword [esp + 0x24]
test eax, eax
je 0x49f5db
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.004157bc
mov al, byte [esp + 0x74]
add esp, 4
test al, al
jne 0x49f5db
mov eax, dword [esp + 0x18]
test eax, eax
je 0x49f5db
push 0x5194ec
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [esp + 0x18]
mov ecx, dword [eax + 0xc0]
inc ecx
push 0x5194ec
mov dword [eax + 0xc0], ecx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov ecx, dword [esp + 0x14]
mov al, byte [ecx + 0xd]
test al, al
je 0x49f5e9
mov byte [esi + 0xd], al
cmp word [esp + 0x3c], 0
mov dl, byte [esp + 0x12]
mov byte [esi + 0xc], dl
jne 0x49f663
push 0x5194ec
mov dword [esp + 0x6c], 0x5194ec
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov ecx, dword [esp + 0x14]
push 0xffffffffffffffff
push 0
push str.__MAIN__
mov byte [esp + 0x68], 5
call fcn.00422a90
test eax, eax
jne 0x49f62d
mov eax, 0x4ee164
jmp 0x49f646
mov eax, dword [eax]
push eax
push 0x4f60a0
call fcn.00440490
add esp, 8
test al, al
jne 0x49f653
mov eax, 0x4ee160
push eax
push 0x4f77bc
mov ecx, esi
call fcn.00444550
push 0x5194ec
mov byte [esp + 0x60], 4
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [0x51908c]
test eax, eax
je 0x49f6cb
mov eax, dword [esp + 0x6c]
cmp word [eax], 0
je 0x49f6cb
test byte [esi + 0xe], 8
jne 0x49f6cb
push str.ENTER:
lea ecx, [esp + 0x6c]
call fcn.004127a5
mov ecx, dword [esp + 0x6c]
push ecx
lea ecx, [esp + 0x6c]
mov byte [esp + 0x60], 6
call fcn.004462e0
mov ebx, dword [esp + 0x68]
push 0
push 0x11
push 0
push ebx
mov ecx, esi
call fcn.004291c2
test ebx, ebx
mov byte [esp + 0x5c], 4
je 0x49f6cb
mov edx, dword [0x51927c]
add ebx, 0xfffffff8
push ebx
push 0
push edx
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [esp + 0x14]
mov byte [esi + 0x88], 1
mov cl, byte [eax + 0xe]
test cl, cl
jns 0x49f6e1
and byte [esi + 0xe], 0xfe
mov eax, dword [esp + 0x1c]
test eax, eax
mov ebx, dword [sym.imp.USER32.dll_PostMessageW]
je 0x49f78e
mov eax, dword [esp + 0x24]
test eax, eax
je 0x49f78e
mov al, byte [esp + 0x70]
test al, al
mov ecx, edi
je 0x49f783
mov edx, dword [edi]
push 0
push 0x271d
mov byte [edi + 0x69], 0x81
mov byte [edi + 0x68], 0x10
call dword [edx + 8]
mov eax, dword [edi + 0x18]
push str.__WinID
push esi
call fcn.00448ba0
mov eax, dword [esp + 0x7c]
add esp, 8
push eax
mov ecx, esi
mov dword [edi + 0x144], 0
call fcn.004968d0
mov eax, dword [edi + 0xc0]
test eax, eax
jg 0x49f764
mov ecx, dword [edi + 0xac]
cmp dword [ecx], 0
jg 0x49f764
mov edx, dword [edi + 0xbc]
cmp dword [edx], 0
jle 0x49f7b8
mov eax, dword [edi + 0x18]
push 0
push 0
push 0x10
push eax
mov byte [edi + 0x69], 0xff
call ebx
push 0x20
mov ecx, edi
call fcn.00456320
mov byte [edi + 0x69], 0x81
jmp 0x49f7b8
mov byte [edi + 0x68], 0
call fcn.004564b0
jmp 0x49f7b8
push ebp
mov ecx, esi
call fcn.004968d0
mov eax, dword [esi + 0x2c]
test eax, eax
je 0x49f7b8
mov cl, byte [esp + 0x11]
test cl, cl
jne 0x49f7b8
mov ecx, dword [eax + 0x18]
push 0
push 0
push 0x10
push ecx
call ebx
mov edx, dword [esi + 0x2c]
mov dword [esp + 0x30], edx
mov edi, dword [esp + 0x6c]
cmp word [edi], 0
je 0x49f812
test byte [esi + 0xe], 8
jne 0x49f812
push str.LEAVE:
lea ecx, [esp + 0x70]
call fcn.004127a5
push edi
lea ecx, [esp + 0x70]
mov byte [esp + 0x60], 7
call fcn.004462e0
mov edi, dword [esp + 0x6c]
push 0
push 0x11
push 0
push edi
mov ecx, esi
call fcn.004291c2
test edi, edi
mov byte [esp + 0x5c], 4
je 0x49f812
mov eax, dword [0x51927c]
add edi, 0xfffffff8
push edi
push 0
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [esp + 0x78]
test eax, eax
mov ecx, dword [esi + 0x84]
mov dword [esp + 0x6c], ecx
je 0x49f83e
mov edx, dword [esp + 0x40]
push edx
mov ecx, esi
call fcn.00430871
mov edi, dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov ebx, dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x49f877
mov edi, dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push 0x5194ec
call edi
mov eax, dword [esp + 0x44]
mov ecx, dword [esp + 0x48]
mov dl, byte [esp + 0x64]
mov ebx, dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov dword [esi + 0x40], eax
mov al, byte [esp + 0x13]
push 0x5194ec
mov dword [esi + 0x44], ecx
mov byte [esi + 0xb], dl
mov byte [esi + 0x8a], al
call ebx
mov eax, dword [esi + 0x2c]
test eax, eax
je 0x49f885
mov ecx, dword [esp + 0x4c]
mov dword [esi + 0x2c], ecx
mov esi, dword [esp + 0x2c]
test esi, esi
mov byte [esp + 0x5c], 2
je 0x49f8a2
mov ecx, esi
call fcn.00415293
push esi
call fcn.004c86d5
add esp, 4
mov ecx, dword [esp + 0x30]
test ecx, ecx
mov byte [esp + 0x5c], 1
je 0x49f8b6
mov edx, dword [ecx]
push 1
call dword [edx + 0xc]
mov al, byte [esp + 0x70]
test al, al
mov ebp, dword [esp + 0x18]
jne 0x49f8fc
test ebp, ebp
je 0x49f8fc
push 0x5194ec
call edi
mov edx, dword [ebp + 0xc0]
mov cl, byte [ebp + 0x69]
mov eax, dword [ebp + 0x18]
dec edx
cmp cl, 0x81
mov dword [ebp + 0xc0], edx
je 0x49f8f5
push 0
push 0
push 0x43d
push eax
call dword [sym.imp.USER32.dll_PostMessageW]
push 0x5194ec
call ebx
call fcn.00443880
mov eax, dword [esp + 0x34]
test eax, eax
je 0x49f9af
cmp word [esp + 0x38], 0
jne 0x49f9af
push 0x5194ec
mov dword [esp + 0x78], 0x5194ec
call edi
mov esi, dword [esp + 0x14]
push 0xffffffffffffffff
push 0
push 0x4f1bd4
mov ecx, esi
mov byte [esp + 0x68], 8
call fcn.00422a90
test eax, eax
mov edi, dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
je 0x49f955
mov eax, dword [eax]
push eax
push str.CurDir
call edi
push 0xffffffffffffffff
push 0
push str.CurDrv
mov ecx, esi
call fcn.00422a90
test eax, eax
je 0x49f973
mov eax, dword [eax]
push eax
push 0x4f777c
call edi
push 0xffffffffffffffff
push 0
push str.CurFile
mov ecx, esi
call fcn.00422a90
test eax, eax
je 0x49f991
mov eax, dword [eax]
push eax
push 0x4f7758
call edi
mov edi, dword [esp + 0x28]
push edi
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
call fcn.0041de75
push 0x5194ec
mov byte [esp + 0x60], 1
call ebx
jmp 0x49f9b7
mov edi, dword [esp + 0x28]
mov esi, dword [esp + 0x14]
mov eax, dword [esi + 0x2c]
test eax, eax
je 0x49f9c1
mov dword [esi + 0x2c], ebp
mov al, byte [esp + 0x70]
test al, al
jne 0x49f9d2
push 0
mov ecx, esi
call fcn.00460e70
test edi, edi
je 0x49f9e8
mov eax, dword [0x51927c]
add edi, 0xfffffff8
push edi
push 0
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
lea ecx, [esp + 0x20]
mov dword [esp + 0x5c], 0xffffffff
call fcn.0042aaff
mov ecx, dword [esp + 0x54]
mov eax, dword [esp + 0x6c]
pop edi
pop esi
pop ebp
pop ebx
mov dword fs:[0], ecx
add esp, 0x50
ret 0x18