Function at 0x40164c
Capabilities:
Check if file exists
Get common file path
Get file attributes
Query environment variable
Query or enumerate registry value

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x854
mov eax, dword [section..data]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
push edi
push 0x384
lea eax, [ebp - 0x830]
mov ebx, ecx
push eax
xor eax, eax
mov dword [ebp - 0x838], ebx
push eax
mov dword [ebp - 0x840], eax
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
lea ecx, [ebx + 0x90]
mov edi, eax
push ecx
mov edx, edi
lea ecx, [ebp - 0x830]
call fcn.0040117b
pop ecx
lea esi, [edi + edi]
mov ecx, edi
lea eax, [ebp - 0x830]
push 0x5c
add eax, esi
pop edx
sub eax, 2
mov dword [ebp - 0x83c], ecx
dec ecx
sub esi, 2
cmp word [eax], dx
jne 0x4016ac
mov dword [ebp - 0x844], eax
lea eax, [ebp - 0x830]
push ecx
mov dword [ebp - 0x834], ecx
mov ecx, ebx
push eax
call fcn.004027dd
lea edx, [ebp - 0x82e]
add edx, esi
mov ecx, edx
lea esi, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
cmp ax, word [ebp - 0x840]
jne 0x4016e6
sub ecx, esi
lea esi, [ebx + 0x60]
sar ecx, 1
push ecx
push edx
mov ecx, esi
call fcn.004027dd
mov edx, str.Au.Editor.exe
mov ecx, esi
call fcn.00401244
test al, al
je 0x401719
mov al, 1
jmp 0x401727
mov edx, str.Au.Task.exe
mov ecx, esi
call fcn.00401244
add al, al
mov byte [ebx + 0xa9], al
cmp byte [0x4178c0], 0
je 0x401763
mov edx, dword [ebp - 0x83c]
lea esi, [ebx + 0x78]
push esi
lea ecx, [ebp - 0x830]
call fcn.0040117b
mov edi, 0x4178c0
mov edx, edi
pop ecx
lea ecx, [edx + 1]
mov al, byte [edx]
inc edx
test al, al
jne 0x401756
sub edx, ecx
push edx
push edi
jmp 0x40179b
cmp word [ebp + edi*2 - 0x83c], 0x33
jne 0x40177d
cmp word [ebp + edi*2 - 0x83a], 0x32
jne 0x40177d
push 6
jmp 0x40177f
push 4
pop eax
sub edi, eax
lea esi, [ebx + 0x78]
push esi
mov edx, edi
lea ecx, [ebp - 0x830]
call fcn.0040117b
pop ecx
push 4
push str..dll
mov ecx, esi
call fcn.004028b4
xor eax, eax
lea edi, [ebp - 0x830]
mov byte [ebx + 0xa8], al
mov esi, str.coreclr.dll
mov eax, dword [ebp - 0x834]
push 6
pop ecx
lea edi, [edi + eax*2]
rep movsd dword es:[edi], dword [esi]
lea eax, [ebp - 0x830]
push eax
movsw word es:[edi], word [esi]
mov edi, dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
call edi
shr eax, 4
not al
test al, 1
jne 0x401b08
mov ecx, dword [ebp - 0x844]
mov edx, str.dotnet32coreclr.dll
movzx eax, word [edx]
lea edx, [edx + 2]
mov word [ecx], ax
lea ecx, [ecx + 2]
test ax, ax
jne 0x4017ec
lea eax, [ebp - 0x830]
push eax
call edi
shr eax, 4
not al
test al, 1
jne 0x401b08
cmp byte [ebx + 0xa9], 0
jne 0x4018b9
lea eax, [ebp - 0x830]
push eax
push 0x3e8
call dword [sym.imp.KERNEL32.dll_GetCurrentDirectoryW]
lea ecx, [eax - 0x17]
cmp ecx, 0x39e
ja 0x4018b9
lea ebx, [ebp + eax*2 - 0x856]
push str.Roslyn.exeProgram
push ebx
call fcn.00406aca
pop ecx
pop ecx
test eax, eax
jne 0x4018b3
push 6
pop ecx
mov esi, str.coreclr.dll
lea eax, [ebp - 0x830]
mov edi, ebx
rep movsd dword es:[edi], dword [esi]
push eax
movsw word es:[edi], word [esi]
mov edi, dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
call edi
shr eax, 4
not al
test al, 1
jne 0x401b02
mov ecx, str.dotnet32coreclr.dll
movzx eax, word [ecx]
lea ecx, [ecx + 2]
mov word [ebx], ax
lea ebx, [ebx + 2]
test ax, ax
jne 0x401884
lea eax, [ebp - 0x830]
push eax
call edi
mov ebx, dword [ebp - 0x838]
shr eax, 4
not al
test al, 1
jne 0x401b08
jmp 0x4018b9
mov ebx, dword [ebp - 0x838]
xor edx, edx
mov esi, edx
mov dword [ebp - 0x838], edx
test esi, esi
jne 0x40191c
lea eax, [ebp - 0x83c]
mov dword [ebp - 0x83c], edx
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.KERNEL32.dll_IsWow64Process]
test eax, eax
je 0x4018f1
cmp dword [ebp - 0x83c], esi
je 0x4018f1
mov cl, 1
jmp 0x4018f5
xor eax, eax
mov cl, al
push 0x3e8
lea eax, [ebp - 0x830]
test cl, cl
push eax
mov edx, str.DOTNET_ROOT
mov eax, str.DOTNET_ROOT_x86_
cmove eax, edx
push eax
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
jmp 0x401a0f
cmp esi, 1
jne 0x4019d7
push 0x16
pop ecx
push 0x38
pop eax
push 0x36
mov esi, str.SOFTWAREdotnetSetupInstalledVersionsx64
lea edi, [ebp - 0x60]
rep movsd dword es:[edi], dword [esi]
mov word [ebp - 0xe], ax
pop eax
mov word [ebp - 0xc], ax
lea eax, [ebp - 0x840]
push eax
push 0x20219
push edx
lea eax, [ebp - 0x60]
push eax
push 0x80000002
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
test eax, eax
je 0x40197a
mov esi, dword [ebp - 0x838]
xor edx, edx
inc esi
mov dword [ebp - 0x834], edx
mov dword [ebp - 0x838], esi
jmp 0x4018c3
lea eax, [ebp - 0x834]
mov dword [ebp - 0x834], 0x3e8
push eax
lea eax, [ebp - 0x830]
push eax
xor eax, eax
push eax
push eax
push str.InstallLocation
push dword [ebp - 0x840]
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExW]
test eax, eax
je 0x4019af
xor eax, eax
jmp 0x4019b7
mov eax, dword [ebp - 0x834]
shr eax, 1
push dword [ebp - 0x840]
mov dword [ebp - 0x834], eax
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
mov eax, dword [ebp - 0x834]
mov esi, dword [ebp - 0x838]
jmp 0x401a0a
push 0x3e8
lea eax, [ebp - 0x830]
push eax
push str._ProgramFiles_dotnet
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
cmp word [ebp - 0x830], 0x25
mov dword [ebp - 0x834], eax
jne 0x401a06
xor eax, eax
mov dword [ebp - 0x834], eax
test esi, esi
jle 0x401a15
test eax, eax
je 0x401a15
dec eax
mov dword [ebp - 0x834], eax
cmp eax, 1
jbe 0x401aeb
push 0x5c
pop ecx
cmp word [ebp + eax*2 - 0x832], cx
jne 0x401a32
dec eax
mov dword [ebp - 0x834], eax
add eax, 0xfffffffe
cmp eax, 0x381
ja 0x401aeb
lea eax, [ebp - 0x830]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x401aeb
test al, 0x10
je 0x401aeb
mov edx, dword [ebp - 0x834]
lea edi, [ebx + 0x18]
xor eax, eax
lea ecx, [ebp - 0x830]
push eax
lea eax, [ebp - 0x854]
push eax
push edi
call fcn.00401291
add esp, 0xc
test al, al
je 0x401aeb
mov edx, dword [ebp - 0x834]
lea eax, [ebp - 0x854]
push 1
push eax
lea eax, [ebx + 0x30]
push eax
lea ecx, [ebp - 0x830]
call fcn.00401291
add esp, 0xc
test al, al
je 0x401aeb
cmp dword [edi + 0x14], 7
mov edx, edi
jbe 0x401ab3
mov edx, dword [edi]
push ecx
push str.coreclr.dll
push dword [edi + 0x10]
lea esi, [ebx + 0x48]
mov ecx, esi
call fcn.004010ee
add esp, 0xc
cmp dword [esi + 0x14], 7
jbe 0x401ad1
mov esi, dword [esi]
push esi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
shr eax, 4
not al
test al, 1
jne 0x401b6b
mov esi, dword [ebp - 0x838]
inc esi
mov dword [ebp - 0x838], esi
push 0
pop edx
cmp esi, 2
jle 0x4018c3
xor al, al
jmp 0x401b6d
mov ebx, dword [ebp - 0x838]
lea ecx, [ebp - 0x830]
mov byte [ebx + 0xa8], 1
lea edx, [ecx + 2]
xor esi, esi
mov ax, word [ecx]
add ecx, 2
cmp ax, si
jne 0x401b1a
sub ecx, edx
lea eax, [ebp - 0x830]
sar ecx, 1
push ecx
push eax
lea ecx, [ebx + 0x48]
call fcn.004027dd
mov eax, dword [ebx + 0x58]
lea esi, [ebx + 0x18]
sub eax, 0xc
mov ecx, esi
push eax
lea eax, [ebp - 0x830]
push eax
call fcn.004027dd
lea ecx, [ebx + 0x30]
cmp ecx, esi
je 0x401b6b
cmp dword [esi + 0x14], 7
mov eax, esi
jbe 0x401b62
mov eax, dword [esi]
push dword [esi + 0x10]
push eax
call fcn.004027dd
mov al, 1
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00402f2c
leave
ret