Function at 0x40a940
Capabilities:
Check os version
Query or enumerate registry value

Disassembly:
sub esp, 0xf8
push ebx
push ebp
push esi
push edi
push 1
push 0x200
call dword [sym.imp.MSVCRT.dll_calloc]
mov ebx, dword [esp + 0x114]
mov esi, dword [sym.imp.KERNEL32.DLL_GetVersionExA]
mov dword [esp + 0x18], eax
mov ecx, 0x27
xor eax, eax
lea edi, [esp + 0x24]
add esp, 8
mov byte [ebx], 0
rep stosd dword es:[edi], eax
lea eax, [esp + 0x1c]
mov dword [esp + 0x1c], 0x9c
push eax
call esi
mov ebp, eax
test ebp, ebp
jne 0x40a9c3
lea ecx, [esp + 0x1c]
mov dword [esp + 0x1c], 0x94
push ecx
call esi
test eax, eax
jne 0x40a9c3
mov edi, str.Unknown_OS
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov edx, ecx
mov esi, edi
mov edi, ebx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov eax, dword [esp + 0x2c]
sub eax, 0
je 0x40ae92
dec eax
je 0x40adfa
dec eax
jne 0x40aebc
mov eax, dword [esp + 0x20]
mov ecx, dword [esp + 0x24]
cmp eax, 5
jne 0x40aa0e
cmp ecx, 2
jne 0x40a9f7
mov edi, str.Microsoft_Windows_Server_2003_family_
jmp 0x40aa18
cmp ecx, 1
jne 0x40aa03
mov edi, str.Microsoft_Windows_XP
jmp 0x40aa18
test ecx, ecx
jne 0x40aa3d
mov edi, str.Microsoft_Windows_2000
jmp 0x40aa18
cmp eax, 4
ja 0x40aa3d
mov edi, str.Microsoft_Windows_NT
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edx, ecx
mov edi, ebx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, edx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
test ebp, ebp
mov ebp, dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
je 0x40ab93
mov al, byte [esp + 0xb6]
cmp al, 1
jne 0x40aaac
cmp dword [esp + 0x20], 4
jne 0x40aa8c
mov edi, str.Workstation_4.0
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edx, ecx
mov edi, ebx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, edx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
jmp 0x40ad18
mov eax, dword [esp + 0xb4]
test ah, 2
je 0x40aaa2
mov edi, str.Home_Edition
jmp 0x40ace8
mov edi, str.Professional
jmp 0x40ace8
cmp al, 3
jne 0x40ad0d
cmp dword [esp + 0x20], 5
jne 0x40ab75
mov eax, dword [esp + 0x24]
cmp eax, 2
jne 0x40ab44
mov eax, dword [esp + 0xb4]
test al, 0x80
je 0x40ab25
mov edi, str.Datacenter_Edition
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edx, ecx
mov edi, ebx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, edx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [esp + 0x28]
mov edi, dword [esp + 0x10]
and ecx, 0xffff
lea edx, [esp + 0x30]
push ecx
push edx
push str._s__Build__d_
push edi
call dword [sym.imp.MSVCRT.dll_sprintf]
add esp, 0x10
jmp 0x40ae97
test al, 2
je 0x40ab30
mov edi, str.Enterprise_Edition
jmp 0x40aad8
cmp ax, 0x400
jne 0x40ab3d
mov edi, str.Web_Edition
jmp 0x40aad8
mov edi, str.Standard_Edition
jmp 0x40aad8
test eax, eax
jne 0x40ab75
mov al, byte [esp + 0xb4]
test al, 0x80
je 0x40ab5d
mov edi, str.Datacenter_Server
jmp 0x40aad8
test al, 2
je 0x40ab6b
mov edi, str.Advanced_Server
jmp 0x40aad8
mov edi, str.Server
jmp 0x40aad8
test byte [esp + 0xb4], 2
je 0x40ab89
mov edi, str.Server_4.0__Enterprise_Edition
jmp 0x40ace8
mov edi, str.Server_4.0
jmp 0x40ace8
lea eax, [esp + 0x14]
mov esi, 0x50
push eax
push 1
push 0
push str.SYSTEMCurrentControlSetControlProductOptions
push 0x80000002
mov dword [esp + 0x2c], esi
call ebp
test eax, eax
je 0x40abd0
mov edi, str.Unknown_OS
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edx, ecx
mov edi, ebx
jmp 0x40aeb0
mov eax, dword [esp + 0x14]
lea ecx, [esp + 0x18]
lea edx, [esp + 0xb8]
push ecx
push edx
push 0
push 0
push str.ProductType
push eax
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExA]
test eax, eax
jne 0x40adbf
cmp dword [esp + 0x18], esi
ja 0x40adbf
mov ecx, dword [esp + 0x14]
push ecx
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
lea edx, [esp + 0xb8]
push edx
push str.WINNT
call dword [sym.imp.KERNEL32.DLL_lstrcmpiA]
test eax, eax
jne 0x40ac4d
mov edi, str.Workstation
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edx, ecx
mov edi, ebx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, edx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
lea eax, [esp + 0xb8]
push eax
push str.LANMANNT
call dword [sym.imp.KERNEL32.DLL_lstrcmpiA]
test eax, eax
jne 0x40ac8c
mov edi, str.Server
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edx, ecx
mov edi, ebx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, edx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
lea eax, [esp + 0xb8]
push eax
push str.SERVERNT
call dword [sym.imp.KERNEL32.DLL_lstrcmpiA]
test eax, eax
jne 0x40accb
mov edi, str.Advanced_Server
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edx, ecx
mov edi, ebx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, edx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov eax, dword [esp + 0x24]
mov ecx, dword [esp + 0x20]
mov edi, dword [esp + 0x10]
push eax
push ecx
push str._d._d
push edi
call dword [sym.imp.MSVCRT.dll_sprintf]
add esp, 0x10
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edx, ecx
mov edi, ebx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, edx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
cmp dword [esp + 0x20], 4
jne 0x40aafd
lea eax, [esp + 0x30]
push str.Service_Pack_6
push eax
call dword [sym.imp.KERNEL32.DLL_lstrcmpiA]
test eax, eax
jne 0x40aafd
lea ecx, [esp + 0x14]
push ecx
push 1
push eax
push str.SOFTWAREMicrosoftWindows_NTCurrentVersionHotfixQ246009
push 0x80000002
call ebp
test eax, eax
jne 0x40ad68
mov edx, dword [esp + 0x28]
mov edi, dword [esp + 0x10]
and edx, 0xffff
push edx
push str.Service_Pack_6a__Build__d_
push edi
call dword [sym.imp.MSVCRT.dll_sprintf]
add esp, 0xc
jmp 0x40ad8a
mov eax, dword [esp + 0x28]
mov edi, dword [esp + 0x10]
and eax, 0xffff
lea ecx, [esp + 0x30]
push eax
push ecx
push str._s__Build__d_
push edi
call dword [sym.imp.MSVCRT.dll_sprintf]
add esp, 0x10
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edx, ecx
mov edi, ebx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, edx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov eax, dword [esp + 0x14]
mov ecx, edx
and ecx, 3
push eax
rep movsb byte es:[edi], byte [esi]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
jmp 0x40aebc
mov edi, str.Unknown_OS
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov eax, ecx
mov esi, edi
mov edi, ebx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [esp + 0x10]
push ecx
call dword [sym.imp.MSVCRT.dll_free]
add esp, 4
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xf8
ret
cmp dword [esp + 0x20], 4
jne 0x40aebc
mov eax, dword [esp + 0x24]
test eax, eax
jne 0x40ae48
mov edi, str.Microsoft_Windows_95
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edx, ecx
mov edi, ebx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, edx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov al, byte [esp + 0x31]
mov ecx, edx
and ecx, 3
cmp al, 0x43
rep movsb byte es:[edi], byte [esi]
je 0x40ae41
cmp al, 0x42
jne 0x40aebc
mov edi, str.OSR2
jmp 0x40ae97
cmp eax, 0xa
jne 0x40ae86
mov edi, str.Microsoft_Windows_98
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edx, ecx
mov edi, ebx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, edx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov al, byte [esp + 0x31]
mov ecx, edx
and ecx, 3
cmp al, 0x41
rep movsb byte es:[edi], byte [esi]
jne 0x40aebc
mov edi, 0x419314
jmp 0x40ae97
cmp eax, 0x5a
jne 0x40aebc
mov edi, str.Microsoft_Windows_Millennium_Edition
jmp 0x40ae97
mov edi, str.Microsoft_Win32s
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edx, ecx
mov edi, ebx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
dec edi
mov ecx, edx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov eax, dword [esp + 0x10]
push eax
call dword [sym.imp.MSVCRT.dll_free]
add esp, 4
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xf8
ret