Function at 0x40384c
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 [0x409070]
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 0x403d38
call fcn.00406e1a
test al, al
je 0x4038a2
call dword [sym.imp.ext_ms_win_session_userinit_l1_1_0.dll_PerformXForestLogonCheck]
cmp eax, 1
je 0x403d38
test ebx, ebx
je 0x403d4c
cmp word [ebx], si
je 0x403d4c
call fcn.00406e1a
test al, al
je 0x403d4c
mov ecx, ebx
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
cmp ax, si
jne 0x4038c5
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 0x40391d
mov eax, dword [section..data]
cmp eax, section..data
je 0x403dc1
test byte [eax + 0x1c], 1
je 0x403dc1
cmp byte [eax + 0x19], 2
jb 0x403dc1
push ebx
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x17
jmp 0x403dbb
shr ebx, 1
mov ecx, eax
push 0x40187c
mov edx, ebx
call fcn.00402430
push dword [ebp - 0x58]
mov ecx, dword [ebp - 0x2c]
mov edx, ebx
call fcn.00402465
mov edx, ebx
mov ebx, dword [ebp - 0x2c]
push 0x401884
mov ecx, ebx
call fcn.00402465
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 0x403c13
call dword [sym.imp.api_ms_win_core_errorhandling_l1_1_0.dll_GetLastError]
cmp dword [ebp - 0x40], 1
mov ebx, eax
je 0x4039c3
lea eax, [ebp - 0x50]
push eax
push 0x20019
push esi
push 0x401898
push 0x80000002
call dword [sym.imp.api_ms_win_core_registry_l1_1_0.dll_RegOpenKeyExW]
test eax, eax
jne 0x4039b9
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 0x4018f0
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 0x403cf6
cmp ebx, 0x35
jne 0x403cf6
cmp dword [ebp - 0x30], esi
jne 0x403cf6
push esi
push esi
push 0x401934
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 0x403cf6
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 0x403bd0
push ebx
push eax
push 0x401934
call dword [sym.imp.api_ms_win_core_processenvironment_l1_1_0.dll_GetEnvironmentVariableW]
test eax, eax
je 0x403cf6
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 0x403cf6
mov ecx, dword [ebp - 0x34]
test ecx, ecx
je 0x403cf6
mov ecx, dword [ecx]
mov edx, ecx
lea ebx, [edx + 2]
mov ax, word [edx]
add edx, 2
cmp ax, si
jne 0x403a4b
sub edx, ebx
sar edx, 1
cmp edx, 1
jbe 0x403a70
push 0x5c
pop eax
cmp word [ecx], ax
jne 0x403a70
cmp word [ecx + 2], ax
jne 0x403a70
add ecx, 4
test ecx, ecx
je 0x403a89
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 0x403a8c
mov ebx, dword [ebp - 0x4c]
test ebx, ebx
je 0x403cf6
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 0x403cf6
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 0x403cf6
push 1
push 0x98
push ebx
call dword [sym.imp.WLDAP32.dll_Ordinal_14]
add esp, 0xc
test eax, eax
jne 0x403cf6
push esi
push 8
push ebx
call dword [sym.imp.WLDAP32.dll_Ordinal_14]
add esp, 0xc
test eax, eax
jne 0x403cf6
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 0x403cf6
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 0x403cf6
push 0x486
push esi
push esi
push ebx
call dword [sym.imp.WLDAP32.dll_Ordinal_73]
add esp, 0x10
test eax, eax
jne 0x403cf6
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 0x403b63
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 0x403cff
mov eax, dword [ebp - 0x34]
mov edx, ebx
push dword [eax]
call fcn.00402430
test eax, eax
js 0x403cf6
mov edx, ebx
mov ebx, dword [ebp - 0x2c]
push 0x401884
mov ecx, ebx
call fcn.00402465
test eax, eax
js 0x403cf6
mov eax, dword [ebp - 0x54]
inc eax
mov dword [ebp - 0x54], eax
cmp eax, 2
jl 0x40394e
jmp 0x403cf6
mov eax, dword [section..data]
cmp eax, section..data
je 0x403cf6
test byte [eax + 0x1c], 1
je 0x403cf6
cmp byte [eax + 0x19], 2
jb 0x403cf6
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.0040276e
jmp 0x403cf6
mov edi, dword [ebp - 0x2c]
lea edx, [ebp - 0x30]
mov ecx, edi
call fcn.004029bf
mov ebx, eax
test ebx, ebx
je 0x403c49
mov eax, dword [section..data]
cmp eax, section..data
je 0x403c70
test byte [eax + 0x1c], 1
je 0x403c70
cmp byte [eax + 0x19], 4
jb 0x403c70
push edi
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x18
jmp 0x403c6a
mov eax, dword [section..data]
cmp eax, section..data
je 0x403c70
test byte [eax + 0x1c], 1
je 0x403c70
cmp byte [eax + 0x19], 4
jb 0x403c70
push edi
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x19
pop ecx
call fcn.00402545
mov edx, dword [ebp - 0x3c]
mov ecx, edi
push 1
push dword [ebp + 8]
call fcn.00403613
mov edi, eax
test edi, edi
je 0x403caf
mov ecx, dword [section..data]
cmp ecx, section..data
je 0x403cdb
test byte [ecx + 0x1c], 1
je 0x403cdb
cmp byte [ecx + 0x19], 4
jb 0x403cdb
push dword [ebp - 0x2c]
push dword [ebp - 0x3c]
push dword [ecx + 0x14]
push dword [ecx + 0x10]
push 0x1a
jmp 0x403cd5
mov eax, dword [section..data]
cmp eax, section..data
je 0x403cdb
test byte [eax + 0x1c], 1
je 0x403cdb
cmp byte [eax + 0x19], 4
jb 0x403cdb
push dword [ebp - 0x58]
push dword [ebp - 0x3c]
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x1b
pop ecx
call fcn.004025a0
test ebx, ebx
je 0x403ced
push dword [ebp - 0x30]
push 0x4014a4
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 0x403d0d
push eax
call dword [sym.imp.api_ms_win_core_heap_l2_1_0.dll_LocalFree]
cmp dword [ebp - 0x34], esi
je 0x403d1b
push dword [ebp - 0x34]
call dword [sym.imp.netutils.dll_NetApiBufferFree]
mov eax, dword [ebp - 0x4c]
test eax, eax
je 0x403d2a
push eax
call dword [sym.imp.WLDAP32.dll_Ordinal_46]
pop ecx
test edi, edi
je 0x403d4c
cmp dword [ebp + 8], esi
je 0x403d38
call fcn.00402a8f
xor eax, eax
inc eax
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.004071e0
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 0x403d88
mov eax, dword [section..data]
cmp eax, section..data
je 0x403dc1
test byte [eax + 0x1c], 1
je 0x403dc1
cmp byte [eax + 0x19], 2
jb 0x403dc1
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 0x403dbb
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 0x403dc8
mov eax, dword [section..data]
cmp eax, section..data
je 0x403dc1
test byte [eax + 0x1c], 1
je 0x403dc1
cmp byte [eax + 0x19], 2
jb 0x403dc1
push ebx
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x1e
pop ecx
call fcn.0040276e
xor eax, eax
jmp 0x403d3b
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 0x403ebc
push 0x401950
mov edx, ebx
mov ecx, edi
call fcn.00402465
lea edx, [ebp - 0x30]
mov ecx, edi
call fcn.004029bf
test eax, eax
je 0x403e19
mov eax, dword [section..data]
cmp eax, section..data
je 0x403e40
test byte [eax + 0x1c], 1
je 0x403e40
cmp byte [eax + 0x19], 4
jb 0x403e40
push edi
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x1f
jmp 0x403e3a
mov eax, dword [section..data]
cmp eax, section..data
je 0x403e40
test byte [eax + 0x1c], 1
je 0x403e40
cmp byte [eax + 0x19], 4
jb 0x403e40
push edi
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x20
pop ecx
call fcn.00402545
mov ebx, dword [ebp - 0x3c]
mov ecx, edi
push 1
push dword [ebp + 8]
mov edx, ebx
call fcn.00403613
mov esi, eax
test esi, esi
je 0x403e7b
mov eax, dword [section..data]
cmp eax, section..data
je 0x403ea3
test byte [eax + 0x1c], 1
je 0x403ea3
cmp byte [eax + 0x19], 4
jb 0x403ea3
push edi
push ebx
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x21
jmp 0x403e9d
mov eax, dword [section..data]
cmp eax, section..data
je 0x403ea3
test byte [eax + 0x1c], 1
je 0x403ea3
cmp byte [eax + 0x19], 4
jb 0x403ea3
push edi
push ebx
push dword [eax + 0x14]
push dword [eax + 0x10]
push 0x22
pop ecx
call fcn.004025a0
push dword [ebp - 0x30]
push 0x4014a4
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 0x403eee
mov eax, dword [section..data]
cmp eax, section..data
je 0x403eee
test byte [eax + 0x1c], 1
je 0x403eee
cmp byte [eax + 0x19], 2
jb 0x403eee
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.0040276e
push edi
call dword [sym.imp.api_ms_win_core_heap_l2_1_0.dll_LocalFree]
test esi, esi
je 0x403f04
cmp dword [ebp + 8], 0
je 0x403f04
call fcn.00402a8f
mov eax, esi
jmp 0x403d3b