Function at 0x40b790
Capabilities:
Get common file path
Query or enumerate registry value

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x278
mov eax, dword [0x441064]
xor eax, ebp
mov dword [ebp - 4], eax
push edi
mov edi, edx
mov dword [ebp - 0x274], ecx
test edi, edi
jne 0x40b7c4
mov eax, 0x80070057
pop edi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00410b68
mov esp, ebp
pop ebp
ret
push esi
push 0x104
push edi
call fcn.0040ddc0
mov esi, eax
test esi, esi
js 0x40ba07
mov eax, dword [edi]
xor esi, esi
push ebx
mov dword [ebp - 0x264], eax
call fcn.0040ebf0
mov ebx, eax
test ebx, ebx
je 0x40b8f4
mov ecx, ebx
lea edx, [ecx + 2]
nop dword [eax]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40b800
sub ecx, edx
sar ecx, 1
je 0x40b8f4
push ebx
lea eax, [ebp - 0x268]
mov dword [ebp - 0x268], esi
push str._sSoftwareMicrosoftWindowsCurrentVersionExplorerShell_Folders
push eax
call fcn.0040df30
push 0x208
lea eax, [ebp - 0x25c]
mov dword [ebp - 0x260], esi
push 0
push eax
call fcn.00412cd0
add esp, 0x18
mov dword [ebp - 0x26c], 0x206
lea eax, [ebp - 0x260]
mov dword [ebp - 0x270], 1
push eax
push 0x20019
push 0
push dword [ebp - 0x268]
push 0x80000003
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
test eax, eax
jne 0x40b8eb
lea eax, [ebp - 0x26c]
push eax
lea eax, [ebp - 0x25c]
push eax
lea eax, [ebp - 0x270]
push eax
push 0
push str.Local_AppData
push dword [ebp - 0x260]
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExW]
test eax, eax
jne 0x40b8df
lea eax, [ebp - 0x25c]
push eax
lea eax, [ebp - 0x264]
push str._sTemp
push eax
call fcn.0040df30
mov esi, dword [ebp - 0x264]
add esp, 0xc
lea ecx, [esi + 2]
mov ax, word [esi]
add esi, 2
test ax, ax
jne 0x40b8d0
sub esi, ecx
sar esi, 1
push dword [ebp - 0x260]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
push ebx
call dword [sym.imp.KERNEL32.dll_LocalFree]
jmp 0x40b907
push dword [ebp - 0x264]
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
mov esi, eax
test esi, esi
je 0x40b913
cmp esi, 0x104
jb 0x40b922
push dword [edi]
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
mov esi, eax
test esi, esi
je 0x40b9d7
cmp esi, 0x104
jae 0x40b9d7
push 0
push 0x43cbe4
push edi
call fcn.0040de20
mov esi, eax
test esi, esi
js 0x40ba06
mov ebx, dword [ebp - 0x274]
lea eax, [ebp - 0x54]
push 0x27
push eax
lea eax, [ebx + 0x8c]
push eax
call dword [sym.imp.ole32.dll_StringFromGUID2]
mov esi, eax
test esi, esi
js 0x40ba06
push 0
lea eax, [ebp - 0x54]
push eax
push edi
call fcn.0040de20
mov esi, eax
test esi, esi
js 0x40ba06
push 0
push 0x43cbe4
push edi
call fcn.0040de20
mov esi, eax
test esi, esi
js 0x40ba06
push 0
push dword [edi]
call fcn.0040ead0
mov esi, eax
test esi, esi
js 0x40ba06
push 0
lea eax, [ebx + 0xc]
push eax
push edi
call fcn.0040de20
mov esi, eax
test esi, esi
js 0x40ba06
push 2
push dword [edi]
push ebx
call fcn.0040e130
pop ebx
mov esi, eax
pop esi
pop edi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00410b68
mov esp, ebp
pop ebp
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, eax
test esi, esi
jle 0x40b9ec
movzx esi, si
or esi, 0x80070000
test esi, esi
mov eax, 0x80004005
cmovns esi, eax
push esi
push 0x1ff
push str.c:_buildagentwork9efead2954b58eab_setupexe_setupexe.cpp
call fcn.0040ebe0
pop ebx
mov ecx, dword [ebp - 4]
mov eax, esi
pop esi
xor ecx, ebp
pop edi
call fcn.00410b68
mov esp, ebp
pop ebp
ret