Function at 0x40454c
Capabilities:
Get common file path
Get domain controller name
Query environment variable
Query or enumerate registry value
Set environment variable

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x6c
mov eax, dword [0x40a070]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
xor esi, esi
mov dword [ebp - 0x3c], edx
mov dword [ebp - 0x48], esi
mov ebx, ecx
mov dword [ebp - 0x58], ebx
mov dword [ebp - 0x30], esi
mov dword [ebp - 0x34], esi
mov dword [ebp - 0x4c], esi
mov dword [ebp - 0x38], esi
mov dword [ebp - 0x44], esi
mov dword [ebp - 0x40], esi
push edi
mov edi, esi
test edx, edx
je 0x404a38
call fcn.00407b4a
test al, al
je 0x4045a2
call dword [sym.imp.ext_ms_win_session_userinit_l1_1_0.dll_PerformXForestLogonCheck]
cmp eax, 1
je 0x404a38
test ebx, ebx
je 0x404a4c
cmp word [ebx], si
je 0x404a4c
call fcn.00407b4a
test al, al
je 0x404a4c
mov ecx, ebx
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
cmp ax, si
jne 0x4045c5
sub ecx, edx
sar ecx, 1
lea ebx, [ecx*2 + 0x18]
push ebx
push 0x40
call dword [sym.imp.api_ms_win_core_heap_l2_1_0.dll_LocalAlloc]
mov dword [ebp - 0x2c], eax
test eax, eax
jne 0x40461d
mov eax, dword [section..data]
cmp eax, section..data
je 0x404ac1
test byte [eax + 0x1c], 1
je 0x404ac1
cmp byte [eax + 0x19], 2
jb 0x404ac1
push ebx
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x17
jmp 0x404abb
shr ebx, 1
mov ecx, eax
push 0x4018dc
mov edx, ebx
call fcn.004024e0
push dword [ebp - 0x58]
mov ecx, dword [ebp - 0x2c]
mov edx, ebx
call fcn.00402515
mov edx, ebx
mov ebx, dword [ebp - 0x2c]
push 0x4018e4
mov ecx, ebx
call fcn.00402515
mov dword [ebp - 0x54], esi
lea eax, [ebp - 0x28]
push eax
push esi
push ebx
call dword [sym.imp.api_ms_win_core_file_l1_1_0.dll_GetFileAttributesExW]
test eax, eax
jne 0x404913
call dword [sym.imp.api_ms_win_core_errorhandling_l1_1_0.dll_GetLastError]
cmp dword [ebp - 0x40], 1
mov ebx, eax
je 0x4046c3
lea eax, [ebp - 0x50]
push eax
push 0x20019
push esi
push 0x4018f8
push 0x80000002
call dword [sym.imp.api_ms_win_core_registry_l1_1_0.dll_RegOpenKeyExW]
test eax, eax
jne 0x4046b9
lea eax, [ebp - 0x5c]
mov dword [ebp - 0x5c], 4
push eax
lea eax, [ebp - 0x40]
push eax
lea eax, [ebp - 0x68]
push eax
push esi
push 0x401950
push dword [ebp - 0x50]
call dword [sym.imp.api_ms_win_core_registry_l1_1_0.dll_RegQueryValueExW]
push dword [ebp - 0x50]
call dword [sym.imp.api_ms_win_core_registry_l1_1_0.dll_RegCloseKey]
cmp dword [ebp - 0x40], 1
jne 0x4049f6
cmp ebx, 0x35
jne 0x4049f6
cmp dword [ebp - 0x30], esi
jne 0x4049f6
push esi
push esi
push 0x401994
call dword [sym.imp.api_ms_win_core_processenvironment_l1_1_0.dll_GetEnvironmentVariableW]
mov ebx, eax
mov dword [ebp - 0x30], ebx
test ebx, ebx
je 0x4049f6
lea eax, [ebx + ebx]
push eax
push 0x40
call dword [sym.imp.api_ms_win_core_heap_l2_1_0.dll_LocalAlloc]
mov dword [ebp - 0x48], eax
test eax, eax
je 0x4048d0
push ebx
push eax
push 0x401994
call dword [sym.imp.api_ms_win_core_processenvironment_l1_1_0.dll_GetEnvironmentVariableW]
test eax, eax
je 0x4049f6
lea eax, [ebp - 0x34]
push eax
mov eax, dword [ebp - 0x48]
push 0x40000000
push esi
push esi
push eax
push esi
call dword [sym.imp.logoncli.dll_DsGetDcNameW]
test eax, eax
jne 0x4049f6
mov ecx, dword [ebp - 0x34]
test ecx, ecx
je 0x4049f6
mov ecx, dword [ecx]
mov edx, ecx
lea ebx, [edx + 2]
mov ax, word [edx]
add edx, 2
cmp ax, si
jne 0x40474b
sub edx, ebx
sar edx, 1
cmp edx, 1
jbe 0x404770
push 0x5c
pop eax
cmp word [ecx], ax
jne 0x404770
cmp word [ecx + 2], ax
jne 0x404770
add ecx, 4
test ecx, ecx
je 0x404789
push 0x185
push ecx
call dword [sym.imp.WLDAP32.dll_Ordinal_145]
pop ecx
mov ebx, eax
pop ecx
mov dword [ebp - 0x4c], ebx
jmp 0x40478c
mov ebx, dword [ebp - 0x4c]
test ebx, ebx
je 0x4049f6
lea eax, [ebp - 0x38]
push eax
push 0x92
push ebx
call dword [sym.imp.WLDAP32.dll_Ordinal_12]
add esp, 0xc
test eax, eax
jne 0x4049f6
or dword [ebp - 0x38], 2
lea eax, [ebp - 0x38]
push eax
push 0x92
push ebx
call dword [sym.imp.WLDAP32.dll_Ordinal_14]
add esp, 0xc
test eax, eax
jne 0x4049f6
push 1
push 0x98
push ebx
call dword [sym.imp.WLDAP32.dll_Ordinal_14]
add esp, 0xc
test eax, eax
jne 0x4049f6
push esi
push 8
push ebx
call dword [sym.imp.WLDAP32.dll_Ordinal_14]
add esp, 0xc
test eax, eax
jne 0x4049f6
lea eax, [ebp - 0x44]
mov dword [ebp - 0x44], 0x1e
push eax
push 4
push ebx
call dword [sym.imp.WLDAP32.dll_Ordinal_14]
add esp, 0xc
test eax, eax
jne 0x4049f6
mov eax, dword [ebp - 0x44]
mov dword [ebp - 0x64], eax
lea eax, [ebp - 0x64]
push eax
push ebx
mov dword [ebp - 0x60], esi
call dword [sym.imp.WLDAP32.dll_Ordinal_88]
pop ecx
pop ecx
test eax, eax
jne 0x4049f6
push 0x486
push esi
push esi
push ebx
call dword [sym.imp.WLDAP32.dll_Ordinal_73]
add esp, 0x10
test eax, eax
jne 0x4049f6
push dword [ebp - 0x2c]
call dword [sym.imp.api_ms_win_core_heap_l2_1_0.dll_LocalFree]
mov eax, dword [ebp - 0x34]
mov ecx, dword [eax]
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
cmp ax, si
jne 0x404863
sub ecx, edx
sar ecx, 1
lea ebx, [ecx + 0xa]
lea eax, [ebx + ebx]
push eax
push 0x40
call dword [sym.imp.api_ms_win_core_heap_l2_1_0.dll_LocalAlloc]
mov ecx, eax
mov dword [ebp - 0x2c], ecx
test ecx, ecx
je 0x4049ff
mov eax, dword [ebp - 0x34]
mov edx, ebx
push dword [eax]
call fcn.004024e0
test eax, eax
js 0x4049f6
mov edx, ebx
mov ebx, dword [ebp - 0x2c]
push 0x4018e4
mov ecx, ebx
call fcn.00402515
test eax, eax
js 0x4049f6
mov eax, dword [ebp - 0x54]
inc eax
mov dword [ebp - 0x54], eax
cmp eax, 2
jl 0x40464e
jmp 0x4049f6
mov eax, dword [section..data]
cmp eax, section..data
je 0x4049f6
test byte [eax + 0x1c], 1
je 0x4049f6
cmp byte [eax + 0x19], 2
jb 0x4049f6
call dword [sym.imp.api_ms_win_core_errorhandling_l1_1_0.dll_GetLastError]
push eax
mov eax, dword [section..data]
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x1c
pop ecx
call fcn.0040281e
jmp 0x4049f6
mov edi, dword [ebp - 0x2c]
lea edx, [ebp - 0x30]
mov ecx, edi
call fcn.004036c4
mov ebx, eax
test ebx, ebx
je 0x404949
mov eax, dword [section..data]
cmp eax, section..data
je 0x404970
test byte [eax + 0x1c], 1
je 0x404970
cmp byte [eax + 0x19], 4
jb 0x404970
push edi
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x18
jmp 0x40496a
mov eax, dword [section..data]
cmp eax, section..data
je 0x404970
test byte [eax + 0x1c], 1
je 0x404970
cmp byte [eax + 0x19], 4
jb 0x404970
push edi
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x19
pop ecx
call fcn.004025f5
mov edx, dword [ebp - 0x3c]
mov ecx, edi
push 1
push dword [ebp + 8]
call fcn.00404313
mov edi, eax
test edi, edi
je 0x4049af
mov ecx, dword [section..data]
cmp ecx, section..data
je 0x4049db
test byte [ecx + 0x1c], 1
je 0x4049db
cmp byte [ecx + 0x19], 4
jb 0x4049db
push dword [ebp - 0x2c]
push dword [ebp - 0x3c]
push dword [ecx + 0x14]
push dword [ecx + 0x10]
push 0x1a
jmp 0x4049d5
mov eax, dword [section..data]
cmp eax, section..data
je 0x4049db
test byte [eax + 0x1c], 1
je 0x4049db
cmp byte [eax + 0x19], 4
jb 0x4049db
push dword [ebp - 0x58]
push dword [ebp - 0x3c]
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x1b
pop ecx
call fcn.00402650
test ebx, ebx
je 0x4049ed
push dword [ebp - 0x30]
push 0x401504
call dword [sym.imp.api_ms_win_core_processenvironment_l1_1_0.dll_SetEnvironmentVariableW]
push dword [ebp - 0x30]
call dword [sym.imp.api_ms_win_core_heap_l2_1_0.dll_LocalFree]
push dword [ebp - 0x2c]
call dword [sym.imp.api_ms_win_core_heap_l2_1_0.dll_LocalFree]
mov eax, dword [ebp - 0x48]
test eax, eax
je 0x404a0d
push eax
call dword [sym.imp.api_ms_win_core_heap_l2_1_0.dll_LocalFree]
cmp dword [ebp - 0x34], esi
je 0x404a1b
push dword [ebp - 0x34]
call dword [sym.imp.netutils.dll_NetApiBufferFree]
mov eax, dword [ebp - 0x4c]
test eax, eax
je 0x404a2a
push eax
call dword [sym.imp.WLDAP32.dll_Ordinal_46]
pop ecx
test edi, edi
je 0x404a4c
cmp dword [ebp + 8], esi
je 0x404a38
call fcn.00403794
xor eax, eax
inc eax
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00407f10
leave
ret 8
push esi
push esi
call dword [sym.imp.api_ms_win_core_sysinfo_l1_1_0.dll_GetSystemDirectoryW]
mov ebx, eax
add ebx, ebx
jne 0x404a88
mov eax, dword [section..data]
cmp eax, section..data
je 0x404ac1
test byte [eax + 0x1c], 1
je 0x404ac1
cmp byte [eax + 0x19], 2
jb 0x404ac1
call dword [sym.imp.api_ms_win_core_errorhandling_l1_1_0.dll_GetLastError]
push eax
mov eax, dword [section..data]
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x1d
jmp 0x404abb
add ebx, 0x2a
push ebx
push 0x40
call dword [sym.imp.api_ms_win_core_heap_l2_1_0.dll_LocalAlloc]
mov edi, eax
test edi, edi
jne 0x404ac8
mov eax, dword [section..data]
cmp eax, section..data
je 0x404ac1
test byte [eax + 0x1c], 1
je 0x404ac1
cmp byte [eax + 0x19], 2
jb 0x404ac1
push ebx
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x1e
pop ecx
call fcn.0040281e
xor eax, eax
jmp 0x404a3b
shr ebx, 1
push ebx
push edi
call dword [sym.imp.api_ms_win_core_sysinfo_l1_1_0.dll_GetSystemDirectoryW]
test eax, eax
je 0x404bbc
push 0x4019b0
mov edx, ebx
mov ecx, edi
call fcn.00402515
lea edx, [ebp - 0x30]
mov ecx, edi
call fcn.004036c4
test eax, eax
je 0x404b19
mov eax, dword [section..data]
cmp eax, section..data
je 0x404b40
test byte [eax + 0x1c], 1
je 0x404b40
cmp byte [eax + 0x19], 4
jb 0x404b40
push edi
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x1f
jmp 0x404b3a
mov eax, dword [section..data]
cmp eax, section..data
je 0x404b40
test byte [eax + 0x1c], 1
je 0x404b40
cmp byte [eax + 0x19], 4
jb 0x404b40
push edi
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x20
pop ecx
call fcn.004025f5
mov ebx, dword [ebp - 0x3c]
mov ecx, edi
push 1
push dword [ebp + 8]
mov edx, ebx
call fcn.00404313
mov esi, eax
test esi, esi
je 0x404b7b
mov eax, dword [section..data]
cmp eax, section..data
je 0x404ba3
test byte [eax + 0x1c], 1
je 0x404ba3
cmp byte [eax + 0x19], 4
jb 0x404ba3
push edi
push ebx
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x21
jmp 0x404b9d
mov eax, dword [section..data]
cmp eax, section..data
je 0x404ba3
test byte [eax + 0x1c], 1
je 0x404ba3
cmp byte [eax + 0x19], 4
jb 0x404ba3
push edi
push ebx
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x22
pop ecx
call fcn.00402650
push dword [ebp - 0x30]
push 0x401504
call dword [sym.imp.api_ms_win_core_processenvironment_l1_1_0.dll_SetEnvironmentVariableW]
push dword [ebp - 0x30]
call dword [sym.imp.api_ms_win_core_heap_l2_1_0.dll_LocalFree]
jmp 0x404bee
mov eax, dword [section..data]
cmp eax, section..data
je 0x404bee
test byte [eax + 0x1c], 1
je 0x404bee
cmp byte [eax + 0x19], 2
jb 0x404bee
call dword [sym.imp.api_ms_win_core_errorhandling_l1_1_0.dll_GetLastError]
push eax
mov eax, dword [section..data]
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x23
pop ecx
call fcn.0040281e
push edi
call dword [sym.imp.api_ms_win_core_heap_l2_1_0.dll_LocalFree]
test esi, esi
je 0x404c04
cmp dword [ebp + 8], 0
je 0x404c04
call fcn.00403794
mov eax, esi
jmp 0x404a3b