Function at 0x473f40
Capabilities:
Get common file path
Query environment variable
Query or enumerate registry key
Resolve function by parsing pe exports

Disassembly:
sub esp, 0x32c
mov eax, dword [0x9c48d0]
xor eax, esp
mov dword [esp + 0x324], eax
push ebx
push ebp
push esi
push edi
xor ebx, ebx
lea eax, [esp + 0x38]
push 0x40
mov ecx, eax
push ebx
push ecx
mov dword [esp + 0x8c], str.AFPL_Ghostscript
mov dword [esp + 0x90], str.Aladdin_Ghostscript
mov dword [esp + 0x94], str.GPL_Ghostscript
mov dword [esp + 0x98], str.GNU_Ghostscript
mov dword [esp + 0x3c], ebx
mov dword [esp + 0x84], ebx
mov dword [esp + 0x88], ebx
mov dword [esp + 0x34], ebx
mov dword [esp + 0x38], 0xf
mov dword [esp + 0x40], eax
call fcn.0065b340
add esp, 0xc
mov dword [esp + 0x10], 0x20219
xor edi, edi
mov dword [esp + 0x18], edi
jmp 0x473fd0
mov eax, dword [esp + edi*4 + 0x80]
cmp eax, ebx
jne 0x473fe0
mov eax, 0x923408
push 0x923408
push eax
push str.Software_
push str._s_s_s
call fcn.00458200
add esp, 0x10
mov esi, eax
mov eax, dword [esp + 0x10]
lea edx, [esp + 0x20]
push edx
push eax
push ebx
push esi
push reloc.OLEAUT32.dll_SysReAllocString
mov dword [esp + 0x30], esi
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
test eax, eax
je 0x474027
push esi
call fcn.00658a01
add esp, 4
jmp 0x4740e4
mov edx, dword [esp + 0x20]
push 0x20
lea ecx, [esp + 0xec]
push ecx
push ebx
push edx
call dword [sym.imp.ADVAPI32.dll_RegEnumKeyW]
test eax, eax
jne 0x4740ce
jmp 0x474050
lea eax, [esp + 0xe8]
push eax
call fcn.00661039
mov edi, dword [esp + 0x2c]
lea ebp, [edi + 1]
add esp, 4
mov ecx, ebp
lea esi, [esp + 0x28]
mov dword [esp + 0x24], eax
call fcn.0044f630
test al, al
jne 0x47407e
xor eax, eax
mov byte [eax], al
mov eax, dword [esp + 0x28]
mov ecx, dword [esp + 0x34]
lea esi, [ecx + edi*4]
cmp eax, edi
jbe 0x4740a1
sub eax, edi
add eax, eax
add eax, eax
push eax
lea edx, [esi + 4]
push esi
push edx
call fcn.006586a0
add esp, 0xc
mov eax, dword [esp + 0x24]
push 0x20
lea ecx, [esp + 0xec]
push ecx
mov dword [esp + 0x30], ebp
mov dword [esi], eax
mov edx, dword [esp + 0x28]
inc ebx
push ebx
push edx
call dword [sym.imp.ADVAPI32.dll_RegEnumKeyW]
test eax, eax
je 0x474050
mov edi, dword [esp + 0x18]
mov esi, dword [esp + 0x1c]
mov eax, dword [esp + 0x20]
push eax
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
push esi
call fcn.00658a01
add esp, 4
xor ebx, ebx
inc edi
mov dword [esp + 0x18], edi
cmp edi, 4
jb 0x473fd0
test dword [esp + 0x10], 0x200
je 0x47416e
push 0x104
lea ecx, [esp + 0x12c]
push ecx
mov dword [esp + 0x18], 0x20119
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryW]
push str.kernel32.dll
lea edx, [esp + 0x12c]
push edx
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
lea eax, [esp + 0x128]
push eax
call dword [sym.imp.KERNEL32.dll_LoadLibraryW]
cmp eax, ebx
jne 0x474140
xor esi, esi
jmp 0x47414e
push str.IsWow64Process
push eax
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
mov esi, eax
mov dword [esp + 0x14], ebx
cmp esi, ebx
je 0x47416e
lea ecx, [esp + 0x14]
push ecx
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call esi
cmp dword [esp + 0x14], ebx
jne 0x473fc2
mov edx, dword [esp + 0x28]
mov eax, dword [esp + 0x34]
push 0x401370
push 4
push edx
push eax
call fcn.00658b10
mov eax, dword [esp + 0x38]
add esp, 0x10
mov dword [esp + 0x18], eax
cmp eax, ebx
jbe 0x4742ba
lea ecx, [eax*4 - 4]
mov dword [esp + 0x10], ecx
xor edi, edi
mov dword [esp + 0x14], edi
mov edx, dword [esp + 0x34]
mov eax, dword [esp + 0x10]
mov ecx, dword [edx + eax]
mov edx, dword [esp + edi*4 + 0x80]
push ecx
push edx
push str.Software_s_s
call fcn.00458200
mov ebp, eax
push str.GS_DLL
push ebp
push reloc.OLEAUT32.dll_SysReAllocString
call fcn.00450f30
mov esi, eax
add esp, 0x18
test esi, esi
jne 0x4741f5
push eax
call fcn.00658a01
push ebp
call fcn.00658a01
add esp, 8
jmp 0x474296
mov eax, esi
call fcn.00455060
mov edi, eax
mov eax, str.gswin32c.exe
mov edx, edi
call fcn.00455100
mov ebx, eax
test ebx, ebx
je 0x474233
lea eax, [esp + 0xe8]
push eax
push 0
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileAttributesExW]
test eax, eax
je 0x474233
test byte [esp + 0xe8], 0x10
je 0x47443b
mov eax, str.gswin64c.exe
mov edx, edi
call fcn.00455100
push ebx
mov dword [esp + 0x20], eax
call fcn.00658a01
mov ebx, dword [esp + 0x20]
add esp, 4
test ebx, ebx
je 0x474277
lea ecx, [esp + 0xe8]
push ecx
push 0
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileAttributesExW]
test eax, eax
je 0x474277
test byte [esp + 0xe8], 0x10
je 0x474492
push ebx
call fcn.00658a01
push edi
call fcn.00658a01
push esi
call fcn.00658a01
push ebp
call fcn.00658a01
mov edi, dword [esp + 0x24]
add esp, 0x10
inc edi
mov dword [esp + 0x14], edi
cmp edi, 4
jb 0x4741a8
mov eax, dword [esp + 0x18]
sub dword [esp + 0x10], 4
dec eax
mov dword [esp + 0x18], eax
test eax, eax
jne 0x4741a2
mov edi, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
xor ebp, ebp
push ebp
push ebp
push str.PATH
call edi
mov esi, eax
push 2
push esi
call fcn.00658a3b
add esp, 8
mov ebx, eax
cmp esi, ebp
jbe 0x4745d6
cmp ebx, ebp
je 0x4745d6
push esi
push ebx
push str.PATH
call edi
lea ecx, [esp + 0xa0]
push 0x40
mov edx, ecx
push ebp
push edx
mov dword [esp + 0xa4], ebp
mov dword [esp + 0xec], ebp
mov dword [esp + 0xf0], ebp
mov dword [esp + 0x9c], ebp
mov dword [esp + 0xa0], 0xf
mov dword [esp + 0xa8], ecx
call fcn.0065b340
add esp, 0xc
push 1
push 0x929f3c
mov eax, ebx
lea ecx, [esp + 0x98]
call fcn.00401210
xor esi, esi
cmp dword [esp + 0x90], ebp
jbe 0x4743fa
lea ebx, [ebx]
mov ecx, dword [esp + 0x9c]
mov edx, dword [ecx + esi*4]
mov eax, str.gswin32c.exe
call fcn.00455100
mov edi, eax
test edi, edi
je 0x47439d
lea edx, [esp + 0xe8]
push edx
push 0
push edi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesExW]
test eax, eax
je 0x47439d
test byte [esp + 0xe8], 0x10
je 0x4744c3
mov ecx, dword [esp + 0x9c]
mov edx, dword [ecx + esi*4]
mov eax, str.gswin64c.exe
call fcn.00455100
push edi
mov ebp, eax
call fcn.00658a01
add esp, 4
test ebp, ebp
je 0x4743e3
lea edx, [esp + 0xe8]
push edx
push 0
push ebp
call dword [sym.imp.KERNEL32.dll_GetFileAttributesExW]
test eax, eax
je 0x4743e3
test byte [esp + 0xe8], 0x10
je 0x47454c
push ebp
call fcn.00658a01
inc esi
add esp, 4
cmp esi, dword [esp + 0x90]
jb 0x474360
lea esi, [esp + 0x90]
call fcn.00449370
mov eax, dword [esp + 0x9c]
lea ecx, [esp + 0xa0]
xor ebp, ebp
cmp eax, ecx
je 0x4745d6
mov ecx, dword [esp + 0xe0]
push eax
cmp ecx, ebp
jne 0x4745cf
call fcn.00658a01
add esp, 4
jmp 0x4745d6
push 0
call fcn.00658a01
push edi
call fcn.00658a01
push esi
call fcn.00658a01
push ebp
call fcn.00658a01
add esp, 0x10
lea esi, [esp + 0x28]
call fcn.00449370
mov eax, dword [esp + 0x34]
lea edx, [esp + 0x38]
cmp eax, edx
je 0x47448b
mov ecx, dword [esp + 0x78]
push eax
test ecx, ecx
jne 0x474484
call fcn.00658a01
add esp, 4
mov eax, ebx
jmp 0x474610
mov edx, dword [ecx]
mov eax, dword [edx + 0xc]
call eax
mov eax, ebx
jmp 0x474610
push 0
call fcn.00658a01
push edi
call fcn.00658a01
push esi
call fcn.00658a01
push ebp
call fcn.00658a01
add esp, 0x10
lea esi, [esp + 0x28]
call fcn.00449370
mov eax, dword [esp + 0x34]
lea ecx, [esp + 0x38]
cmp eax, ecx
jmp 0x47446a
push 0
call fcn.00658a01
add esp, 4
lea esi, [esp + 0x90]
call fcn.00449370
mov eax, dword [esp + 0x9c]
lea ecx, [esp + 0xa0]
cmp eax, ecx
je 0x474508
mov ecx, dword [esp + 0xe0]
push eax
test ecx, ecx
jne 0x474501
call fcn.00658a01
add esp, 4
jmp 0x474508
mov edx, dword [ecx]
mov eax, dword [edx + 0xc]
call eax
push ebx
call fcn.00658a01
add esp, 4
lea esi, [esp + 0x28]
call fcn.00449370
mov eax, dword [esp + 0x34]
lea ecx, [esp + 0x38]
cmp eax, ecx
je 0x474545
mov ecx, dword [esp + 0x78]
push eax
test ecx, ecx
jne 0x47453e
call fcn.00658a01
add esp, 4
mov eax, edi
jmp 0x474610
mov edx, dword [ecx]
mov eax, dword [edx + 0xc]
call eax
mov eax, edi
jmp 0x474610
push 0
call fcn.00658a01
add esp, 4
lea esi, [esp + 0x90]
call fcn.00449370
mov eax, dword [esp + 0x9c]
lea ecx, [esp + 0xa0]
cmp eax, ecx
je 0x474591
mov ecx, dword [esp + 0xe0]
push eax
test ecx, ecx
jne 0x47458a
call fcn.00658a01
add esp, 4
jmp 0x474591
mov edx, dword [ecx]
mov eax, dword [edx + 0xc]
call eax
push ebx
call fcn.00658a01
add esp, 4
lea esi, [esp + 0x28]
call fcn.00449370
mov eax, dword [esp + 0x34]
lea ecx, [esp + 0x38]
cmp eax, ecx
je 0x4745cb
mov ecx, dword [esp + 0x78]
push eax
test ecx, ecx
jne 0x4745c4
call fcn.00658a01
add esp, 4
mov eax, ebp
jmp 0x474610
mov edx, dword [ecx]
mov eax, dword [edx + 0xc]
call eax
mov eax, ebp
jmp 0x474610
mov edx, dword [ecx]
mov eax, dword [edx + 0xc]
call eax
push ebx
call fcn.00658a01
add esp, 4
lea esi, [esp + 0x28]
call fcn.00449370
mov eax, dword [esp + 0x34]
lea ecx, [esp + 0x38]
cmp eax, ecx
je 0x47460e
mov ecx, dword [esp + 0x78]
push eax
cmp ecx, ebp
jne 0x474607
call fcn.00658a01
add esp, 4
jmp 0x47460e
mov edx, dword [ecx]
mov eax, dword [edx + 0xc]
call eax
xor eax, eax
mov ecx, dword [esp + 0x334]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.0065865c
add esp, 0x32c
ret