detect Windows 10 edition

Rudolf Meier 271 Reputation points


I'm developing a software, that can only run on Windows 10 or Server 2016/2019 and not on the Home edition of Windows 10... now. What's the official way that Microsoft suggests to use to detect if I'm running on the correct system?

If possible, then I want to detect this during the setup... because... you know... crashing because I cannot initialize a component later or quitting with a Windows error message after the installation... that's... well, I don't like it... but, just for fun... what's the "Microsoft way" of doing this? Writing a compatiblity manifest and including this into the exe? What does it have to contain to prevent the app from running on Windows 10 Home? ...

Any ideas? ... not workarounds please... I can find those myself... but... Microsoft: "what's the official way to solve this problem?" ... every api I used in the past has been deprecated... so? solution... please? ...


Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,228 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Song Zhu - MSFT 906 Reputation points

    You can use GetProductInfo.

    Some code :

    #include <iostream>  
    #include <windows.h>  
    using namespace std;  
    int main(int argc, const char* argv[])  
    	DWORD dwPInfo = NULL;  
    	DWORD dwVersion = NULL;  
    	DWORD dwMajorVersion = NULL;  
    	DWORD dwMinorVersion = NULL;  
    	dwVersion = GetVersion();  
    	dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));  
    	dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));  
    	GetProductInfo(dwMajorVersion, dwMinorVersion, 0, 0, &dwPInfo);  
        return 0;  
    0 comments No comments

  2. Castorix31 77,501 Reputation points

    From MS, Targeting your application for Windows

    But in reality, tools like Winver just read the registry :

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

    And internally, APIs like VideoPortGetVersion use RtlGetVersion, like :

    	HMODULE hDll = LoadLibrary(TEXT("Ntdll.dll"));  
    	RTLGETVERSION pRtlGetVersion;  
    	pRtlGetVersion = (RTLGETVERSION)GetProcAddress(hDll, "RtlGetVersion");  
    	if (pRtlGetVersion)  
    		RTL_OSVERSIONINFOW ovi = { 0 };  
    		ovi.dwOSVersionInfoSize = sizeof(ovi);  
    		NTSTATUS ntStatus = pRtlGetVersion(&ovi);  
    		if (ntStatus == 0)  
    			TCHAR wsBuffer[512];  
    			wsprintf(wsBuffer, TEXT("Major Version : %d - Minor Version : %d - Build Number : %d\r\n"), ovi.dwMajorVersion, ovi.dwMinorVersion, ovi.dwBuildNumber);  
    			DWORD dwProductType = NULL;  
    			GetProductInfo(ovi.dwMajorVersion, ovi.dwMinorVersion, 0, 0, &dwProductType);  
    			// Test dwProductType  
    0 comments No comments

  3. Rudolf Meier 271 Reputation points

    It's pretty amazing how difficult this is...

    My problem is, that BitLocker needs to be available for my product and the local group policy has to be available. It seems, that's not available on the home edition of Windows 10... so, but... when I use the GetProductInfo function (which may be deprectated? but who knows that exactely... it might be... anyway, let's assume it is not) ... then I have 96 (!!!!!!!!!!!!!) documented values I could get back and I have not seen about 60 of them until now and 12 do have the word "home" in them. So... which of those do not have the BitLocker and a working local group policy?

    ... well, you can say now "That's wrong what you do! You should try to find an interface and when it's available, then it's ok!" ... ok, fine... let's try this one. The nice thing here is, that I get an error when I try to find the Win32_EncryptableVolume wmi class on a 2012 R2 server (because the feature is not installed, but ... you know, it could be, so ... my product should still install here) but... Windows 10 Home says "yup... available" :-) ... and the interfaces for the gpo manipulation ... I guess they're also working in the home edition... didn't check that, but... how should this help in identifying the system?

    ... ok then. What's the idea now? ... working with those 96 values and simply hoping, that it works in most cases? ... great... really great... and I wasted hours because of this!