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

C++
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.

If the product has not been activated and is no longer in the grace period, this parameter is set to PRODUCT_UNLICENSED (0xABCDABCD). Otherwise, this parameter can be one of the following values.

ValueMeaning
PRODUCT_BUSINESS
0x00000006

Business

PRODUCT_BUSINESS_N
0x00000010

Business N

PRODUCT_CLUSTER_SERVER
0x00000012

HPC Edition

PRODUCT_DATACENTER_SERVER
0x00000008

Server Datacenter (full installation)

PRODUCT_DATACENTER_SERVER_CORE
0x0000000C

Server Datacenter (core installation)

PRODUCT_DATACENTER_SERVER_CORE_V
0x00000027

Server Datacenter without Hyper-V (core installation)

PRODUCT_DATACENTER_SERVER_V
0x00000025

Server Datacenter without Hyper-V (full installation)

PRODUCT_ENTERPRISE
0x00000004

Enterprise

PRODUCT_ENTERPRISE_E
0x00000046

Enterprise E

PRODUCT_ENTERPRISE_N
0x0000001B

Enterprise N

PRODUCT_ENTERPRISE_SERVER
0x0000000A

Server Enterprise (full installation)

PRODUCT_ENTERPRISE_SERVER_CORE
0x0000000E

Server Enterprise (core installation)

PRODUCT_ENTERPRISE_SERVER_CORE_V
0x00000029

Server Enterprise without Hyper-V (core installation)

PRODUCT_ENTERPRISE_SERVER_IA64
0x0000000F

Server Enterprise for Itanium-based Systems

PRODUCT_ENTERPRISE_SERVER_V
0x00000026

Server Enterprise without Hyper-V (full installation)

PRODUCT_HOME_BASIC
0x00000002

Home Basic

PRODUCT_HOME_BASIC_E
0x00000043

Home Basic E

PRODUCT_HOME_BASIC_N
0x00000005

Home Basic N

PRODUCT_HOME_PREMIUM
0x00000003

Home Premium

PRODUCT_HOME_PREMIUM_E
0x00000044

Home Premium E

PRODUCT_HOME_PREMIUM_N
0x0000001A

Home Premium N

PRODUCT_HYPERV
0x0000002A

Microsoft Hyper-V Server

PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT
0x0000001E

Windows Essential Business Server Management Server

PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING
0x00000020

Windows Essential Business Server Messaging Server

PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY
0x0000001F

Windows Essential Business Server Security Server

PRODUCT_PROFESSIONAL
0x00000030

Professional

PRODUCT_PROFESSIONAL_E
0x00000045

Professional E

PRODUCT_PROFESSIONAL_N
0x00000031

Professional N

PRODUCT_SERVER_FOR_SMALLBUSINESS
0x00000018

Windows Server 2008 for Windows Essential Server Solutions

PRODUCT_SERVER_FOR_SMALLBUSINESS_V
0x00000023

Windows Server 2008 without Hyper-V for Windows Essential Server Solutions

PRODUCT_SERVER_FOUNDATION
0x00000021

Server Foundation

PRODUCT_SMALLBUSINESS_SERVER
0x00000009

Windows Small Business Server

PRODUCT_STANDARD_SERVER
0x00000007

Server Standard (full installation)

PRODUCT_STANDARD_SERVER_CORE
0x0000000D

Server Standard (core installation)

PRODUCT_STANDARD_SERVER_CORE_V
0x00000028

Server Standard without Hyper-V (core installation)

PRODUCT_STANDARD_SERVER_V
0x00000024

Server Standard without Hyper-V (full installation)

PRODUCT_STARTER
0x0000000B

Starter

PRODUCT_STARTER_E
0x00000042

Starter E

PRODUCT_STARTER_N
0x0000002F

Starter N

PRODUCT_STORAGE_ENTERPRISE_SERVER
0x00000017

Storage Server Enterprise

PRODUCT_STORAGE_EXPRESS_SERVER
0x00000014

Storage Server Express

PRODUCT_STORAGE_STANDARD_SERVER
0x00000015

Storage Server Standard

PRODUCT_STORAGE_WORKGROUP_SERVER
0x00000016

Storage Server Workgroup

PRODUCT_UNDEFINED
0x00000000

An unknown product

PRODUCT_ULTIMATE
0x00000001

Ultimate

PRODUCT_ULTIMATE_E
0x00000047

Ultimate E

PRODUCT_ULTIMATE_N
0x0000001C

Ultimate N

PRODUCT_WEB_SERVER
0x00000011

Web Server (full installation)

PRODUCT_WEB_SERVER_CORE
0x0000001D

Web Server (core installation)

 

Return Value

If the function succeeds, the return value is a nonzero value. If the software license is invalid or expired, the function succeeds but the pdwReturnedProductType parameter is set to PRODUCT_UNLICENSED.

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.

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.0Value returned with 6.0.0.0
PRODUCT_ENTERPRISE_EPRODUCT_ENTERPRISE
PRODUCT_HOME_BASIC_EPRODUCT_HOME_BASIC
PRODUCT_HOME_PREMIUM_EPRODUCT_HOME_PREMIUM
PRODUCT_PROFESSIONALPRODUCT_BUSINESS
PRODUCT_PROFESSIONAL_EPRODUCT_BUSINESS
PRODUCT_PROFESSIONAL_NPRODUCT_BUSINESS_N
PRODUCT_STARTER_EPRODUCT_STARTER
PRODUCT_STARTER_NPRODUCT_STARTER
PRODUCT_ULTIMATE_EPRODUCT_ULTIMATE

 

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 clientWindows Vista
Minimum supported serverWindows Server 2008
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll

See Also

System Information Functions

Send comments about this topic to Microsoft

Build date: 10/8/2009

Tags :


Page view tracker