Skip to main content
SLGetPKeyInformation function

Gets the information of the specified product key.

Syntax


HRESULT WINAPI SLGetPKeyInformation(
  _In_       HSLC hSLC,
  _In_       const SLID *pPKeyId,
  _In_       PCWSTR pwszValueName,
  _Out_opt_  SLDATATYPE *peDataType,
  _Out_      UINT *pcbValue,
  _Out_      PBYTE *ppbValue
);

Parameters

hSLC [in]

Type: HSLC

The handle to the current SLC context.

pPKeyId [in]

Type: const SLID*

A pointer to the PKey ID.

pwszValueName [in]

Type: PCWSTR

The name associated with the value to retrieve. The following names are valid.

ValueMeaning
SL_INFO_KEY_DIGITAL_PID
L"DigitalPID"

Formatted PID structure for a PID4

SL_INFO_KEY_DIGITAL_PID2
L"DigitalPID2"

Formatted PID structure for a PID2

SL_INFO_KEY_PARTIAL_PRODUCT_KEY
L"PartialProductKey"

First 5 characters of product key

SL_INFO_KEY_PRODUCT_SKU_ID
L"ProductSkuId"

SKU SLID

SL_INFO_KEY_CHANNEL
L"Channel"

Channel ID

 

peDataType [out, optional]

Type: SLDATATYPE*

The data type.

ValueMeaning
SL_DATA_SZ

UNICODE string

SL_DATA_DWORD

DWORD

SL_DATA_BINARY

Binary BLOB

 

pcbValue [out]

Type: UINT*

A pointer to the size, in bytes, of the ppbValue buffer.

ppbValue [out]

Type: PBYTE*

A pointer to the data returned by SLC. When finished using the memory, free it by calling the LocalFree function.

Return value

Type: HRESULT WINAPI

If this function succeeds, it return S_OK. Otherwise, it returns an HRESULT error code.

Return code/valueDescription
E_INVALIDARG
0x80070057

One or more arguments are not valid.

SL_E_PKEY_NOT_INSTALLED
0xC004F014

The product key is not available.

SL_E_NOT_SUPPORTED
0xC004F016

The request is not supported.

 

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Slpublic.h

Library

Slc.lib

DLL

Slc.dll