GetProductInfo function
Retrieves the product type for the operating system on the local computer, and maps the type to the product types supported by the specified operating system.
To retrieve product type information on versions of Windows prior to the minimum supported operating systems specified in the Requirements section, use the GetVersionEx function. You can also use the OperatingSystemSKU property of the Win32_OperatingSystem WMI class.
Syntax
BOOL WINAPI GetProductInfo( _In_ DWORD dwOSMajorVersion, _In_ DWORD dwOSMinorVersion, _In_ DWORD dwSpMajorVersion, _In_ DWORD dwSpMinorVersion, _Out_ PDWORD pdwReturnedProductType );
Parameters
- dwOSMajorVersion [in]
-
The major version number of the operating system. The minimum value is 6.
The combination of the dwOSMajorVersion, dwOSMinorVersion, dwSpMajorVersion, and dwSpMinorVersion parameters describes the maximum target operating system version for the application. For example, Windows Vista and Windows Server 2008 are version 6.0.0.0 and Windows 7 and Windows Server 2008 R2 are version 6.1.0.0.
- dwOSMinorVersion [in]
-
The minor version number of the operating system. The minimum value is 0.
- dwSpMajorVersion [in]
-
The major version number of the operating system service pack. The minimum value is 0.
- dwSpMinorVersion [in]
-
The minor version number of the operating system service pack. The minimum value is 0.
- pdwReturnedProductType [out]
-
The product type. This parameter cannot be NULL. If the specified operating system is less than the current operating system, this information is mapped to the types supported by the specified operating system. If the specified operating system is greater than the highest supported operating system, this information is mapped to the types supported by the current operating system.
This parameter can be one of the following values.
Return value
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. This function fails if one of the input parameters is invalid.
Remarks
To detect whether a server role or feature is installed, use the Server Feature WMI provider.
Subsequent releases of Windows will map the product types it supports to the set of product types supported by each supported previous release of Windows, back to version 6.0.0.0. Therefore, an application that does an equality test for any of these values will continue to work on future releases, even when new product types are added.
PRODUCT_*_SERVER_CORE values are not returned in Windows Server 2012. For example, the base server edition, Server Datacenter, is used to build the two different installation options: "full server" and "core server". With Windows Server 2012, GetProductInfo will return PRODUCT_DATACENTER regardless of the option used during product installation.
The following table indicates the product types that were introduced in 6.1.0.0, and what they will map to if GetProductInfo is called with version 6.0.0.0 on a 6.1.0.0 system.
| New for 6.1.0.0 | Value returned with 6.0.0.0 |
|---|---|
| PRODUCT_PROFESSIONAL | PRODUCT_BUSINESS |
| PRODUCT_PROFESSIONAL_N | PRODUCT_BUSINESS_N |
| PRODUCT_STARTER_N | PRODUCT_STARTER |
To compile an application that uses this function, define _WIN32_WINNT as 0x0600 or later. For more information, see Using the Windows Headers.
Examples
For an example, see Getting the System Version.
Requirements
|
Minimum supported client |
Windows Vista [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2008 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also