Function at 0x405040
Capabilities:
Check os version
Link many functions at runtime
Query or enumerate registry value

Disassembly:
sub esp, 0x6f4
mov eax, dword [0x42cb90]
xor eax, esp
mov dword [esp + 0x6f0], eax
mov eax, dword [esp + 0x6fc]
mov ecx, dword [esp + 0x700]
mov edx, dword [esp + 0x704]
push ebp
mov ebp, dword [esp + 0x6fc]
test ebp, ebp
mov dword [esp + 0x2c], ebp
mov dword [esp + 8], eax
mov dword [esp + 0x34], ecx
mov dword [esp + 0x30], edx
mov dword [esp + 0xc], 0xffffffff
mov dword [esp + 0x1c], 0
je 0x405728
test eax, eax
je 0x405728
test ecx, ecx
mov dword [eax], 0
je 0x4050b1
mov dword [ecx], 0
test edx, edx
je 0x4050b8
mov byte [edx], 0
push 0x94
lea eax, [esp + 0x54]
push 0
push eax
call fcn.0040eb90
add esp, 0xc
lea ecx, [esp + 0x50]
push ecx
mov dword [esp + 0x54], 0x94
call dword [sym.imp.KERNEL32.dll_GetVersionExA]
test eax, eax
jne 0x4050ff
call dword [sym.imp.KERNEL32.dll_GetLastError]
pop ebp
mov ecx, dword [esp + 0x6f0]
xor ecx, esp
call fcn.0040f6db
add esp, 0x6f4
ret
cmp dword [esp + 0x60], 2
je 0x40511f
or eax, 0xffffffff
pop ebp
mov ecx, dword [esp + 0x6f0]
xor ecx, esp
call fcn.0040f6db
add esp, 0x6f4
ret
push edi
push str.Netapi32.dll
call dword [sym.imp.KERNEL32.dll_LoadLibraryA]
mov edi, eax
test edi, edi
mov dword [esp + 0x14], edi
jne 0x405152
call dword [sym.imp.KERNEL32.dll_GetLastError]
pop edi
pop ebp
mov ecx, dword [esp + 0x6f0]
xor ecx, esp
call fcn.0040f6db
add esp, 0x6f4
ret
push esi
mov esi, dword [sym.imp.KERNEL32.dll_GetProcAddress]
push str.NetApiBufferFree
push edi
call esi
test eax, eax
mov dword [esp + 0x1c], eax
je 0x405179
push str.NetWkstaGetInfo
push edi
call esi
test eax, eax
mov dword [esp + 0x28], eax
jne 0x4051a2
call dword [sym.imp.KERNEL32.dll_GetLastError]
push edi
mov esi, eax
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
mov eax, esi
pop esi
pop edi
pop ebp
mov ecx, dword [esp + 0x6f0]
xor ecx, esp
call fcn.0040f6db
add esp, 0x6f4
ret
cmp dword [esp + 0x5c], 5
push ebx
mov ebx, dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
jb 0x405251
push str.NetGetJoinInformation
push edi
mov dword [esp + 0x18], 0
call esi
test eax, eax
je 0x405233
lea edx, [esp + 0x24]
push edx
lea ecx, [esp + 0x14]
push ecx
push 0
call eax
test eax, eax
jne 0x405233
mov eax, dword [esp + 0x24]
cmp eax, 1
jne 0x4051eb
mov edx, dword [esp + 0x14]
mov dword [edx], eax
jmp 0x40522b
cmp eax, 2
jne 0x405204
mov eax, dword [esp + 0x10]
test eax, eax
je 0x405251
mov ecx, dword [esp + 0x14]
mov dword [ecx], 2
jmp 0x40521b
cmp eax, 3
jne 0x405233
mov eax, dword [esp + 0x10]
test eax, eax
je 0x405251
mov edx, dword [esp + 0x14]
mov dword [edx], 3
push 0
push 0
push 0x10
push ebp
push 0xffffffffffffffff
push eax
push 0
push 0
call ebx
mov dword [esp + 0x18], 0
mov eax, dword [esp + 0x10]
test eax, eax
je 0x405240
push eax
call dword [esp + 0x24]
cmp dword [esp + 0x18], 0
je 0x40542a
mov esi, dword [sym.imp.KERNEL32.dll_GetProcAddress]
xor eax, eax
push str.Advapi32.dll
mov dword [esp + 0x34], eax
mov dword [esp + 0x28], eax
call dword [sym.imp.KERNEL32.dll_LoadLibraryA]
mov ebp, eax
test ebp, ebp
mov dword [esp + 0x28], ebp
jne 0x40529a
call dword [sym.imp.KERNEL32.dll_GetLastError]
push edi
mov esi, eax
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
mov eax, esi
pop ebx
pop esi
pop edi
pop ebp
mov ecx, dword [esp + 0x6f0]
xor ecx, esp
call fcn.0040f6db
add esp, 0x6f4
ret
push str.LsaOpenPolicy
push ebp
call esi
mov esi, eax
test esi, esi
je 0x4052e4
push str.LsaQueryInformationPolicy
push ebp
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
mov edi, eax
test edi, edi
je 0x4052e4
push str.LsaFreeMemory
push ebp
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
test eax, eax
mov dword [esp + 0x10], eax
je 0x4052e4
mov eax, dword [esp + 0x28]
push str.LsaClose
push eax
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
mov ebp, eax
test ebp, ebp
jne 0x4052fe
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, dword [esp + 0x1c]
mov edi, dword [sym.imp.KERNEL32.dll_FreeLibrary]
push ebx
mov esi, eax
call edi
push ebx
call edi
jmp 0x40527f
lea ecx, [esp + 0x24]
push ecx
push 0x64
push 0
call dword [esp + 0x38]
test eax, eax
jne 0x40541b
lea edx, [esp + 0x30]
push edx
mov dword [esp + 0x48], eax
mov dword [esp + 0x4c], eax
mov dword [esp + 0x50], eax
mov dword [esp + 0x54], eax
mov dword [esp + 0x58], eax
mov dword [esp + 0x5c], eax
push 0x80000001
lea eax, [esp + 0x4c]
push eax
push 0
call esi
test eax, eax
jne 0x40540e
mov edx, dword [esp + 0x30]
lea ecx, [esp + 0x34]
push ecx
push 3
push edx
call edi
test eax, eax
jne 0x405407
mov eax, dword [esp + 0x34]
push eax
lea ecx, [esp + 0x30]
push ecx
call fcn.00403e50
mov esi, dword [esp + 0x34]
add esp, 8
test esi, esi
je 0x4053fe
mov edi, dword [esp + 0x38]
push 0
push 0
push 0x10
push edi
push 0xffffffffffffffff
push esi
push 0
push 0
call ebx
mov edx, dword [esp + 0x34]
cmp dword [edx + 8], 0
je 0x4053a4
mov eax, dword [esp + 0x14]
mov dword [eax], 3
jmp 0x4053ed
mov edx, dword [esp + 0x24]
mov eax, dword [edx + 4]
push 0
push 0
push 0x10
lea ecx, [esp + 0x104]
push ecx
push 0xffffffffffffffff
push eax
push 0
push 0
call ebx
lea ecx, [esp + 0xf8]
push ecx
push edi
call fcn.0041060f
add esp, 8
test eax, eax
jne 0x4053e3
mov edx, dword [esp + 0x14]
mov dword [edx], 1
jmp 0x4053ed
mov eax, dword [esp + 0x14]
mov dword [eax], 2
push esi
mov dword [esp + 0x1c], 0
call fcn.0040e862
add esp, 4
mov ecx, dword [esp + 0x34]
push ecx
call dword [esp + 0x14]
mov edx, dword [esp + 0x30]
push edx
call ebp
mov eax, dword [esp + 0x24]
test eax, eax
je 0x40541b
push eax
call dword [esp + 0x24]
cmp dword [esp + 0x18], 0
jne 0x40551a
mov ebp, dword [esp + 0x38]
cmp dword [esp + 0x3c], 0
je 0x40551a
mov eax, dword [esp + 0x14]
cmp dword [eax], 3
jne 0x40551a
mov ecx, dword [esp + 0x1c]
push str.DsGetDcNameA
push ecx
mov dword [esp + 0x18], 0
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
test eax, eax
je 0x4054d4
lea edx, [esp + 0x10]
push edx
push 0x10000
push 0
push 0
push ebp
push 0
call eax
test eax, eax
jne 0x4054c7
push 0x208
push eax
lea eax, [esp + 0x100]
push eax
call fcn.0040eb90
mov edx, dword [esp + 0x1c]
add esp, 0xc
push 0x104
lea ecx, [esp + 0xfc]
push ecx
add edx, 0xc
push edx
call dword [sym.imp.ole32.dll_StringFromGUID2]
mov eax, dword [esp + 0x718]
mov ecx, dword [esp + 0x3c]
push 0
push 0
push eax
push ecx
push 0xffffffffffffffff
lea edx, [esp + 0x10c]
push edx
push 0
push 0
call ebx
mov eax, dword [esp + 0x10]
test eax, eax
je 0x4054d4
push eax
call dword [esp + 0x24]
push 0x9c
lea eax, [esp + 0x60]
push 0
push eax
call fcn.0040eb90
add esp, 0xc
lea ecx, [esp + 0x5c]
push ecx
mov dword [esp + 0x60], 0x9c
call dword [sym.imp.KERNEL32.dll_GetVersionExA]
test eax, eax
je 0x40551a
cmp dword [esp + 0x60], 5
jb 0x40551a
cmp byte [esp + 0xf6], 2
jne 0x40551a
mov edx, dword [esp + 0x14]
mov dword [edx], 4
mov edi, dword [esp + 0x40]
test edi, edi
je 0x405707
push str.GetComputerNameExA
push str.kernel32.dll
call dword [sym.imp.KERNEL32.dll_GetModuleHandleA]
push eax
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
mov esi, eax
test esi, esi
je 0x4055aa
lea eax, [esp + 0x10]
push eax
push 0
push 3
mov dword [esp + 0x1c], 0
call esi
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xea
mov eax, dword [esp + 0x10]
jne 0x405576
test eax, eax
jne 0x405578
mov eax, 0x400
mov dword [esp + 0x10], eax
jmp 0x40557a
test eax, eax
jbe 0x4055aa
push eax
call fcn.0040f141
add esp, 4
test eax, eax
mov dword [edi], eax
je 0x4055b3
lea ecx, [esp + 0x10]
push ecx
push eax
push 3
call esi
test eax, eax
jne 0x4055aa
mov edx, dword [edi]
push edx
call fcn.0040e862
add esp, 4
mov dword [edi], 0
jmp 0x4055b3
cmp dword [edi], 0
jne 0x405707
lea eax, [esp + 0x10]
push eax
mov ebx, 1
push ebx
push 0
push str.SYSTEMCurrentControlSetServicesTcpipParameters
push 0x80000002
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
test eax, eax
jne 0x4056fc
mov esi, dword [sym.imp.ADVAPI32.dll_RegQueryValueExA]
lea ecx, [esp + 0x20]
push ecx
mov ecx, dword [esp + 0x14]
lea edx, [esp + 0x304]
push edx
mov byte [esp + 0x308], al
lea eax, [esp + 0x1c]
push eax
push 0
push str.Domain
push ecx
mov dword [esp + 0x2c], ebx
mov dword [esp + 0x38], 0x400
call esi
test eax, eax
jne 0x4056fc
cmp dword [esp + 0x14], ebx
jne 0x4056fc
lea edx, [esp + 0x20]
push edx
mov edx, dword [esp + 0x14]
mov byte [esp + 0xfc], al
lea eax, [esp + 0xfc]
push eax
lea ecx, [esp + 0x1c]
push ecx
push 0
push str.Hostname
push edx
mov dword [esp + 0x2c], ebx
mov dword [esp + 0x38], 0x104
call esi
test eax, eax
jne 0x4056fc
cmp dword [esp + 0x14], ebx
jne 0x4056fc
cmp byte [esp + 0xf8], al
je 0x4056fc
lea eax, [esp + 0x300]
lea edx, [eax + 1]
nop
mov cl, byte [eax]
add eax, 1
test cl, cl
jne 0x405680
sub eax, edx
mov esi, eax
lea eax, [esp + 0xf8]
lea edx, [eax + 1]
mov cl, byte [eax]
add eax, 1
test cl, cl
jne 0x405697
sub eax, edx
add eax, 1
test esi, esi
jle 0x4056ad
lea eax, [eax + esi + 1]
push eax
call fcn.0040f141
add esp, 4
test eax, eax
mov dword [edi], eax
je 0x4056fc
test esi, esi
jle 0x4056e0
lea ecx, [esp + 0x300]
push ecx
lea edx, [esp + 0xfc]
push edx
push str._s._s
push eax
call fcn.0041025a
add esp, 0x10
jmp 0x4056fc
lea ecx, [esp + 0xf8]
mov edx, eax
lea esp, [esp]
mov al, byte [ecx]
mov byte [edx], al
add ecx, ebx
add edx, ebx
test al, al
jne 0x4056f0
mov eax, dword [esp + 0x10]
push eax
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
mov ecx, dword [esp + 0x1c]
mov esi, dword [sym.imp.KERNEL32.dll_FreeLibrary]
push ecx
call esi
mov eax, dword [esp + 0x28]
test eax, eax
je 0x40571f
push eax
call esi
mov eax, dword [esp + 0x18]
jmp 0x405281
mov ecx, dword [esp + 0x6f4]
pop ebp
xor ecx, esp
mov eax, 0x57
call fcn.0040f6db
add esp, 0x6f4
ret