IWMDMDevice::GetSerialNumber
The GetSerialNumber method retrieves a serial number that uniquely identifies the device.
Syntax
HRESULT GetSerialNumber(
PWMDMID pSerialNumber,
BYTE abMac[WMDM_MAC_LENGTH]
);
Parameters
pSerialNumber
[out] Pointer to a WMDMID structure containing the serial number information.
abMac[WMDM_MAC_LENGTH]
[in, out] Array of eight bytes containing the message authentication code for the parameter data of this method. (WMDM_MAC_LENGTH is defined as 8.)
Return Values
The method returns an HRESULT. All the interface methods in Windows Media Device Manager and service provider can return any of the following classes of error codes:
- Standard COM error codes
- Windows error codes converted to HRESULT values
- Windows Media Device Manager error codes
For a complete list of possible error codes, see Error Codes.
Possible values include, but are not limited to, those in the following table.
Return code | Description |
S_OK | The method succeeded. |
E_INVALIDARG | The pSerialNumber parameter is an invalid or NULL pointer. |
WMDM_E_NOTSUPPORTED | The device does not support serial numbers. |
E_FAIL | An unspecified error occurred. |
Remarks
Not all devices support serial numbers. To determine whether the device supports serial numbers, the caller must always check the return code when calling this function. If a media device supports serial numbers, the serial number of the media device is guaranteed to be unique for that device.
After calling this method, an application can calculate the message authentication code (MAC) values of parameters and compare them with output MAC values to ensure that the parameters have not been tampered with. For guidance on how to do this, see the example code in the Remarks section under IWMDMStorage::GetRights.
Requirements
Header: Defined in wmdm.idl.
Library: mssachlp.lib
See Also