Share via


SerialNumber Property

The SerialNumber property gets or sets the value of the iSerialNumber field of the device descriptor, as defined in section 9.6.1 of the USB 2.0 specification.

This property is read/write.

Syntax

HRESULT put_SerialNumber(
  [in]           BYTE bSerialNumber
);

HRESULT get_SerialNumber(
  [out, retval]  BYTE *pbSerialNumber
);

Property Value

The new string index for the device serial number.

Error Codes

SerialNumber returns S_OK if the operation succeeds or E_POINTER if the pbSerialNumber parameter is not a valid pointer.

Remarks

The following C++ code example how to set and get the SerialNumber property.

HRESULT CLoopBackDevice::UpdateSerialNumber(ISoftUSBDevice *piDevice)
{
HRESULT hr = S_OK;
BYTE        bSerialNo= 0;
BYTE        bNewSerialNo = STRING_IDX_SERIAL;

 if(NULL == piDevice)
{
 hr = E_INVALIDARG;
 goto Exit;
}

// Get the current serial number index
 hr = piDevice->get_SerialNumber(&bSerialNumber);
 if(FAILED(hr))
 goto Exit;

// Update the serial number index if required.
 if (bNewSerialNumber != bSerialNumber)
{
 hr = piDevice->put_SerialNumber(bNewSerialNumber);
 if(FAILED(hr))
 goto Exit;
}
Exit:
 return hr;
}

Requirements

Header

SoftUSBif.h

See Also

ISoftUSBDevice

 

 

Send comments about this topic to Microsoft

Build date: 9/21/2010