Function at 0x66201697
Capabilities:
Query environment variable
Set environment variable

Disassembly:
mov eax, 0x6621b3fd
call fcn.6620d014
sub esp, 0x630
push ebx
push esi
push edi
push 0x104
lea eax, [ebp - 0x63c]
xor ebx, ebx
push eax
push str.TS_SBCLEANUP
mov dword [ebp - 4], ebx
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
test eax, eax
jne 0x66201ce2
push 0xffffffffffffffff
push str.TS_PARENT_HANDLE
lea ecx, [ebp - 0x434]
call fcn.662030f0
lea ecx, [ebp - 0x384]
mov byte [ebp - 4], 1
call fcn.66203190
mov esi, dword [ebp + 0xb8]
mov ecx, esi
push ebx
mov byte [ebp - 4], 2
call fcn.66203cb0
push ebx
lea eax, [ebp - 0x384]
push eax
push dword [ebp - 0x434]
call fcn.66203d80
mov ebx, dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
add esp, 0xc
test eax, eax
js 0x66201740
push dword [ebp - 0x384]
call fcn.6620d56e
pop ecx
push 0xffffffffffffffff
push eax
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
push 0
push dword [ebp - 0x434]
call ebx
push 0
lea ecx, [ebp - 0x384]
call fcn.66203cb0
push 0xffffffffffffffff
push str.TS_UPDATE_COMPLETE
lea ecx, [ebp - 0x434]
call fcn.662041d0
push 0
lea eax, [ebp - 0x384]
push eax
push dword [ebp - 0x434]
call fcn.66203d80
add esp, 0xc
test eax, eax
js 0x6620189a
lea eax, [ebp - 0x384]
push eax
lea ecx, [ebp - 0xc4]
call fcn.66202f50
push 0
push 0
push 0xffffffffffffffff
xor edi, edi
mov byte [ebp - 4], 3
push 0x6621c540
inc edi
lea ecx, [ebp - 0xc4]
push edi
call fcn.662033a0
push 0
push 0
push 0xffffffffffffffff
push str..ase
push edi
lea ecx, [ebp - 0xc4]
call fcn.662033a0
sub esp, 0xb0
lea eax, [ebp - 0xc4]
mov ecx, esp
mov dword [ebp - 0x14], esp
push eax
call fcn.66202f50
sub esp, 0xb0
mov byte [ebp - 4], 4
lea eax, [ebp - 0x384]
mov ecx, esp
push eax
call fcn.66202f50
mov byte [ebp - 4], 3
call fcn.66201f54
add esp, 0x160
lea eax, [ebp - 0x384]
lea ecx, [ebp - 0xc4]
push eax
call fcn.66203f20
push 0
push 0
push 0xffffffffffffffff
push 0x6621c540
push edi
lea ecx, [ebp - 0xc4]
call fcn.662033a0
push 0
push 0
push 0xffffffffffffffff
push str..asd
push edi
lea ecx, [ebp - 0xc4]
call fcn.662033a0
sub esp, 0xb0
lea eax, [ebp - 0xc4]
mov ecx, esp
mov dword [ebp - 0x10], esp
push eax
call fcn.66202f50
sub esp, 0xb0
mov byte [ebp - 4], 5
lea eax, [ebp - 0x384]
mov ecx, esp
push eax
call fcn.66202f50
mov byte [ebp - 4], 3
call fcn.66201f54
add esp, 0x160
push 0
push dword [ebp - 0x434]
call ebx
lea ecx, [ebp - 0xc4]
mov byte [ebp - 4], 2
call fcn.66203210
lea ecx, [ebp - 0xc4]
xor edi, edi
xor bl, bl
call fcn.66203190
push edi
lea eax, [ebp - 0xc4]
mov byte [ebp - 4], 6
push str.TS_UPDATE__u
push eax
call fcn.662045b0
add esp, 0xc
lea ecx, [ebp - 0x2d4]
call fcn.66203190
jmp 0x66201a0b
push 0
push 0x3b
lea ecx, [ebp - 0x2d4]
call fcn.66204300
mov ebx, eax
lea ecx, [ebp - 0x224]
mov eax, dword [ebp - 0x2d4]
push 0xffffffffffffffff
lea eax, [eax + ebx*2]
add eax, 2
push eax
call fcn.662030f0
cmp dword [esi + 4], 0
mov byte [ebp - 4], 8
jne 0x66201930
lea eax, [ebp - 0x224]
mov ecx, esi
push eax
call fcn.66203f20
push 0xffffffffffffffff
push 0
mov ecx, esi
call fcn.662037d0
push eax
mov ecx, esi
call fcn.66204280
push eax
mov ecx, esi
call fcn.66203cb0
push ebx
lea ecx, [ebp - 0x2d4]
call fcn.66203cb0
lea eax, [ebp - 0x224]
push eax
lea ecx, [ebp - 0x174]
call fcn.66202f50
push 0
push 3
push 0xffffffffffffffff
push str..old
push 1
lea ecx, [ebp - 0x174]
mov byte [ebp - 4], 9
call fcn.662033a0
lea eax, [ebp - 0x174]
push eax
lea eax, [ebp - 0x224]
push eax
lea eax, [ebp - 0x2d4]
push eax
call fcn.662024de
add esp, 0xc
test eax, eax
je 0x66201b11
push 0
push dword [ebp - 0xc4]
mov bl, 1
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
lea ecx, [ebp - 0x174]
mov byte [ebp - 4], 8
call fcn.66203210
lea ecx, [ebp - 0x224]
mov byte [ebp - 4], 7
call fcn.66203210
lea ecx, [ebp - 0x2d4]
mov byte [ebp - 4], 6
call fcn.66203210
lea ecx, [ebp - 0xc4]
mov byte [ebp - 4], 2
call fcn.66203210
lea ecx, [ebp - 0xc4]
inc edi
call fcn.66203190
push edi
lea eax, [ebp - 0xc4]
mov byte [ebp - 4], 6
push str.TS_UPDATE__u
push eax
call fcn.662045b0
add esp, 0xc
lea ecx, [ebp - 0x2d4]
call fcn.66203190
push 0
lea eax, [ebp - 0x2d4]
mov byte [ebp - 4], 7
push eax
push dword [ebp - 0xc4]
call fcn.66203d80
add esp, 0xc
test eax, eax
jns 0x662018d2
mov bh, 1
lea ecx, [ebp - 0x2d4]
mov byte [ebp - 4], 6
call fcn.66203210
lea ecx, [ebp - 0xc4]
mov byte [ebp - 4], 2
call fcn.66203210
test bl, bl
je 0x66201b38
test bh, bh
je 0x66201b40
push esi
lea ecx, [ebp - 0x174]
call fcn.66202f50
push 0
push 0
push 0xffffffffffffffff
push 0x6621c540
push 1
lea ecx, [ebp - 0x174]
mov byte [ebp - 4], 0xa
call fcn.662033a0
push 0
push 0
push 0xffffffffffffffff
push 0x6621c4c0
push 1
lea ecx, [ebp - 0x174]
call fcn.662033a0
sub esp, 0xb0
lea eax, [ebp - 0x174]
mov ecx, esp
mov dword [ebp - 0x10], esp
push eax
call fcn.66202f50
sub esp, 0xb0
mov byte [ebp - 4], 0xb
mov ecx, esp
push esi
call fcn.66202f50
mov byte [ebp - 4], 0xa
call fcn.66201f54
push esi
call fcn.66201d9d
add esp, 0x164
call fcn.66201d01
sub esp, 0xb0
lea eax, [ebp + 8]
mov ecx, esp
push eax
call fcn.66202f50
call fcn.662022e6
add esp, 0xb0
mov byte [ebp - 4], 2
lea ecx, [ebp - 0x174]
call fcn.66203210
jmp 0x66201cc4
lea ecx, [ebp - 0x174]
mov byte [ebp - 4], 8
xor bh, bh
xor bl, bl
call fcn.66203210
lea ecx, [ebp - 0x224]
mov byte [ebp - 4], 7
call fcn.66203210
jmp 0x66201a30
test bh, bh
jne 0x66201cc4
cmp dword [esi + 4], 0
je 0x66201ca8
push esi
lea ecx, [ebp - 0x174]
call fcn.66202f50
xor ebx, ebx
mov byte [ebp - 4], 0xc
push ebx
push ebx
push 0xffffffffffffffff
push 0x6621c540
push 1
lea ecx, [ebp - 0x174]
call fcn.662033a0
push ebx
push ebx
push 0xffffffffffffffff
push 0x6621c4c0
push 1
lea ecx, [ebp - 0x174]
call fcn.662033a0
sub esp, 0xb0
lea eax, [ebp - 0x174]
mov ecx, esp
mov dword [ebp - 0x10], esp
push eax
call fcn.66202f50
sub esp, 0xb0
mov byte [ebp - 4], 0xd
mov ecx, esp
push esi
call fcn.66202f50
mov byte [ebp - 4], 0xc
call fcn.66202014
add esp, 0x160
lea ecx, [ebp - 0xc4]
call fcn.66203190
push edi
mov esi, str.TS_UPDATE__u
mov byte [ebp - 4], 0xe
lea eax, [ebp - 0xc4]
push esi
push eax
call fcn.662045b0
add esp, 0xc
lea ecx, [ebp - 0x224]
call fcn.66203190
jmp 0x66201c49
push ebx
push dword [ebp - 0xc4]
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
lea ecx, [ebp - 0x224]
mov byte [ebp - 4], 0xe
call fcn.66203210
lea ecx, [ebp - 0xc4]
mov byte [ebp - 4], 0xc
call fcn.66203210
lea ecx, [ebp - 0xc4]
inc edi
call fcn.66203190
push edi
lea eax, [ebp - 0xc4]
mov byte [ebp - 4], 0xe
push esi
push eax
call fcn.662045b0
add esp, 0xc
lea ecx, [ebp - 0x224]
call fcn.66203190
push ebx
lea eax, [ebp - 0x224]
mov byte [ebp - 4], 0xf
push eax
push dword [ebp - 0xc4]
call fcn.66203d80
add esp, 0xc
test eax, eax
jns 0x66201bf2
lea ecx, [ebp - 0x224]
mov byte [ebp - 4], 0xe
call fcn.66203210
lea ecx, [ebp - 0xc4]
mov byte [ebp - 4], 0xc
call fcn.66203210
push ebx
push 0x6621c3dc
push str.Appsync_failed_to_upgrade_older_package.___________________________Older_package_is_locked_by_some_process.___________________________Please_close_all_the_applications_using___________________________older_package_and_restart_the_upgrade.
push ebx
call dword [sym.imp.USER32.dll_MessageBoxW]
lea ecx, [ebp - 0x174]
mov byte [ebp - 4], 2
mov bl, 1
call fcn.66203210
sub esp, 0xb0
lea eax, [ebp + 8]
mov ecx, esp
push eax
call fcn.66202f50
call fcn.662022e6
add esp, 0xb0
lea ecx, [ebp - 0x384]
mov byte [ebp - 4], 1
call fcn.66203210
lea ecx, [ebp - 0x434]
mov byte [ebp - 4], 0
call fcn.66203210
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp + 8]
call fcn.66203210
mov ecx, dword [ebp - 0xc]
mov al, bl
pop edi
pop esi
mov dword fs:[0], ecx
pop ebx
mov esp, ebp
pop ebp
ret