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

Disassembly:
mov eax, 0x6621b46d
call fcn.6620d084
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 0x66201ce5
push 0xffffffffffffffff
push str.TS_PARENT_HANDLE
lea ecx, [ebp - 0x434]
call fcn.66203100
lea ecx, [ebp - 0x384]
mov byte [ebp - 4], 1
call fcn.662031a0
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 0x66201743
push dword [ebp - 0x384]
call fcn.6620d5de
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 0x6620189d
lea eax, [ebp - 0x384]
push eax
lea ecx, [ebp - 0xc4]
call fcn.66202f60
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.662033b0
push 0
push 0
push 0xffffffffffffffff
push str..ase
push edi
lea ecx, [ebp - 0xc4]
call fcn.662033b0
sub esp, 0xb0
lea eax, [ebp - 0xc4]
mov ecx, esp
mov dword [ebp - 0x14], esp
push eax
call fcn.66202f60
sub esp, 0xb0
mov byte [ebp - 4], 4
lea eax, [ebp - 0x384]
mov ecx, esp
push eax
call fcn.66202f60
mov byte [ebp - 4], 3
call fcn.66201f57
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.662033b0
push 0
push 0
push 0xffffffffffffffff
push str..asd
push edi
lea ecx, [ebp - 0xc4]
call fcn.662033b0
sub esp, 0xb0
lea eax, [ebp - 0xc4]
mov ecx, esp
mov dword [ebp - 0x10], esp
push eax
call fcn.66202f60
sub esp, 0xb0
mov byte [ebp - 4], 5
lea eax, [ebp - 0x384]
mov ecx, esp
push eax
call fcn.66202f60
mov byte [ebp - 4], 3
call fcn.66201f57
add esp, 0x160
push 0
push dword [ebp - 0x434]
call ebx
lea ecx, [ebp - 0xc4]
mov byte [ebp - 4], 2
call fcn.66203220
lea ecx, [ebp - 0xc4]
xor edi, edi
xor bl, bl
call fcn.662031a0
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.662031a0
jmp 0x66201a0e
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.66203100
cmp dword [esi + 4], 0
mov byte [ebp - 4], 8
jne 0x66201933
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.66202f60
push 0
push 3
push 0xffffffffffffffff
push str..old
push 1
lea ecx, [ebp - 0x174]
mov byte [ebp - 4], 9
call fcn.662033b0
lea eax, [ebp - 0x174]
push eax
lea eax, [ebp - 0x224]
push eax
lea eax, [ebp - 0x2d4]
push eax
call fcn.662024e1
add esp, 0xc
test eax, eax
je 0x66201b14
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.66203220
lea ecx, [ebp - 0x224]
mov byte [ebp - 4], 7
call fcn.66203220
lea ecx, [ebp - 0x2d4]
mov byte [ebp - 4], 6
call fcn.66203220
lea ecx, [ebp - 0xc4]
mov byte [ebp - 4], 2
call fcn.66203220
lea ecx, [ebp - 0xc4]
inc edi
call fcn.662031a0
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.662031a0
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 0x662018d5
mov bh, 1
lea ecx, [ebp - 0x2d4]
mov byte [ebp - 4], 6
call fcn.66203220
lea ecx, [ebp - 0xc4]
mov byte [ebp - 4], 2
call fcn.66203220
test bl, bl
je 0x66201b3b
test bh, bh
je 0x66201b43
push esi
lea ecx, [ebp - 0x174]
call fcn.66202f60
push 0
push 0
push 0xffffffffffffffff
push 0x6621c540
push 1
lea ecx, [ebp - 0x174]
mov byte [ebp - 4], 0xa
call fcn.662033b0
push 0
push 0
push 0xffffffffffffffff
push 0x6621c4c0
push 1
lea ecx, [ebp - 0x174]
call fcn.662033b0
sub esp, 0xb0
lea eax, [ebp - 0x174]
mov ecx, esp
mov dword [ebp - 0x10], esp
push eax
call fcn.66202f60
sub esp, 0xb0
mov byte [ebp - 4], 0xb
mov ecx, esp
push esi
call fcn.66202f60
mov byte [ebp - 4], 0xa
call fcn.66201f57
push esi
call fcn.66201da0
add esp, 0x164
call fcn.66201d04
sub esp, 0xb0
lea eax, [ebp + 8]
mov ecx, esp
push eax
call fcn.66202f60
call fcn.662022e9
add esp, 0xb0
mov byte [ebp - 4], 2
lea ecx, [ebp - 0x174]
call fcn.66203220
jmp 0x66201cc7
lea ecx, [ebp - 0x174]
mov byte [ebp - 4], 8
xor bh, bh
xor bl, bl
call fcn.66203220
lea ecx, [ebp - 0x224]
mov byte [ebp - 4], 7
call fcn.66203220
jmp 0x66201a33
test bh, bh
jne 0x66201cc7
cmp dword [esi + 4], 0
je 0x66201cab
push esi
lea ecx, [ebp - 0x174]
call fcn.66202f60
xor ebx, ebx
mov byte [ebp - 4], 0xc
push ebx
push ebx
push 0xffffffffffffffff
push 0x6621c540
push 1
lea ecx, [ebp - 0x174]
call fcn.662033b0
push ebx
push ebx
push 0xffffffffffffffff
push 0x6621c4c0
push 1
lea ecx, [ebp - 0x174]
call fcn.662033b0
sub esp, 0xb0
lea eax, [ebp - 0x174]
mov ecx, esp
mov dword [ebp - 0x10], esp
push eax
call fcn.66202f60
sub esp, 0xb0
mov byte [ebp - 4], 0xd
mov ecx, esp
push esi
call fcn.66202f60
mov byte [ebp - 4], 0xc
call fcn.66202017
add esp, 0x160
lea ecx, [ebp - 0xc4]
call fcn.662031a0
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.662031a0
jmp 0x66201c4c
push ebx
push dword [ebp - 0xc4]
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
lea ecx, [ebp - 0x224]
mov byte [ebp - 4], 0xe
call fcn.66203220
lea ecx, [ebp - 0xc4]
mov byte [ebp - 4], 0xc
call fcn.66203220
lea ecx, [ebp - 0xc4]
inc edi
call fcn.662031a0
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.662031a0
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 0x66201bf5
lea ecx, [ebp - 0x224]
mov byte [ebp - 4], 0xe
call fcn.66203220
lea ecx, [ebp - 0xc4]
mov byte [ebp - 4], 0xc
call fcn.66203220
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.66203220
sub esp, 0xb0
lea eax, [ebp + 8]
mov ecx, esp
push eax
call fcn.66202f60
call fcn.662022e9
add esp, 0xb0
lea ecx, [ebp - 0x384]
mov byte [ebp - 4], 1
call fcn.66203220
lea ecx, [ebp - 0x434]
mov byte [ebp - 4], 0
call fcn.66203220
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp + 8]
call fcn.66203220
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