Функция GetProductInfo

Declare Function GetProductInfo Lib "kernel32" (ByVal dwOSMajorVersion As Long, _
    ByVal dwOSMinorVersion As Long, _
    ByVal dwSpMajorVersion As Long, _
    ByVal dwSpMinorVersion As Long, _
    ByRef pdwReturnedProductType As Long) As Long

GetProductInfo возвращает тип редакции для операционной системы на локальном компьютере.

Возвращаемое значение

В успешном случае функция возвращает ненулевое значение. Если лицензия пиратская или закончилась, то параметр pdwReturnedProductType получает значение PRODUCT_UNLICENSED. В случае ошибки возвращается 0

Параметры

dwOSMajorVersion
Основной номер версии. Минимальное значение равно 6
dwOSMinorVersion
Дополнительный номер версии. Минимальное значение равно 0
dwSpMajorVersion
Основной номер пакета обновлений (Service pack). Минимальное значение равно 0
dwSpMinorVersion
Дополнительный номер пакета обновлений (Service pack). Минимальное значение равно 0
pdwReturnedProductType
Редакция продукта. Этот параметр не может быть равен null. Если продукт не активирован или ознакомительный период закончился, то параметру присваивается значение PRODUCT_UNLICENSED (0xABCDABCD). В других случаях параметр принимает одно из следующих значений:
PRODUCT_BUSINESS0x00000006Business Edition
PRODUCT_BUSINESS_N0x00000010Business Edition
PRODUCT_CLUSTER_SERVER0x00000012Cluster Server Edition
PRODUCT_DATACENTER_SERVER0x00000008Server Datacenter Edition (full installation)
PRODUCT_DATACENTER_SERVER_CORE0x0000000CServer Datacenter Edition (core installation)
PRODUCT_DATACENTER_SERVER_CORE_V0x00000027Server Datacenter Edition without Hyper-V (core installation)
PRODUCT_DATACENTER_SERVER_V0x00000025Server Datacenter Edition without Hyper-V (full installation)
PRODUCT_ENTERPRISE0x00000004Enterprise Edition
PRODUCT_ENTERPRISE_N0x0000001BEnterprise Edition
PRODUCT_ENTERPRISE_SERVER0x0000000AServer Enterprise Edition (full installation)
PRODUCT_ENTERPRISE_SERVER_CORE0x0000000EServer Enterprise Edition (core installation)
PRODUCT_ENTERPRISE_SERVER_CORE_V0x00000029Server Enterprise Edition without Hyper-V (core installation)
PRODUCT_ENTERPRISE_SERVER_IA640x0000000FServer Enterprise Edition for Itanium-based Systems
PRODUCT_ENTERPRISE_SERVER_V0x00000026Server Enterprise Edition without Hyper-V (full installation)
PRODUCT_HOME_BASIC0x00000002Home Basic Edition
PRODUCT_HOME_BASIC_N0x00000005Home Basic Edition
PRODUCT_HOME_PREMIUM0x00000003Home Premium Edition
PRODUCT_HOME_PREMIUM_N0x0000001AHome Premium Edition
PRODUCT_HOME_SERVER0x00000013Home Server Edition
PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT0x0000001EWindows Essential Business Server Management Server
PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING0x00000020Windows Essential Business Server Messaging Server
PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY0x0000001FWindows Essential Business Server Security Server
PRODUCT_SERVER_FOR_SMALLBUSINESS0x00000018Server for Small Business Edition
PRODUCT_SMALLBUSINESS_SERVER0x00000009Small Business Server
PRODUCT_SMALLBUSINESS_SERVER_PREMIUM0x00000019Small Business Server Premium Edition
PRODUCT_STANDARD_SERVER0x00000007Server Standard Edition (full installation)
PRODUCT_STANDARD_SERVER_CORE0x0000000DServer Standard Edition (core installation)
PRODUCT_STANDARD_SERVER_CORE_V0x00000028Server Standard Edition without Hyper-V (core installation)
PRODUCT_STANDARD_SERVER_V0x00000024Server Standard Edition without Hyper-V (full installation)
PRODUCT_STARTER0x0000000BStarter Edition
PRODUCT_STORAGE_ENTERPRISE_SERVER0x00000017Storage Server Enterprise Edition
PRODUCT_STORAGE_EXPRESS_SERVER0x00000014Storage Server Express Edition
PRODUCT_STORAGE_STANDARD_SERVER0x00000015Storage Server Standard Edition
PRODUCT_STORAGE_WORKGROUP_SERVER0x00000016Storage Server Workgroup Edition
PRODUCT_UNDEFINED0x00000000An unknown product
PRODUCT_ULTIMATE0x00000001Ultimate Edition
PRODUCT_ULTIMATE_N0x0000001CUltimate Edition
PRODUCT_WEB_SERVER0x00000011Web Server Edition (full installation)
PRODUCT_WEB_SERVER_CORE0x0000001DWeb Server Edition (core installation)

Пример

Private Const PRODUCT_STARTER As Integer = &HB                            'Starter
Private Const PRODUCT_HOME_BASIC As Integer = &H2                         'Home Basic
Private Const PRODUCT_HOME_PREMIUM  As Integer = &H3                      'Home Premium
Private Const PRODUCT_BUSINESS As Integer = &H6                           'Business
Private Const PRODUCT_ENTERPRISE As Integer = &H4                         'Enterprise
Private Const PRODUCT_ULTIMATE As Integer = &H1                           'Ultimate

Dim editiontype as Long
GetProductInfo(6, 0, 0, 0, editiontype)
Select Case (editiontype)
    Case PRODUCT_HOME_BASIC: MsgBox("Home Basic)
    Case PRODUCT_BUSINESS: MsgBox("Business)
End Select

Категория

Системная информация