BluetoothSdpGetString function (bluetoothapis.h)

The BluetoothSdpGetString function converts a raw string embedded in the SDP record into a Unicode string.


DWORD BluetoothSdpGetString(
  [in]      LPBYTE                      pRecordStream,
  [in]      ULONG                       cbRecordLength,
  [in]      const PSDP_STRING_TYPE_DATA pStringData,
  [in]      USHORT                      usStringOffset,
  [out]     PWSTR                       pszString,
  [in, out] PULONG                      pcchStringLength


[in] pRecordStream

A pointer to a valid record stream formatted as a single SDP record.

[in] cbRecordLength

The length, in bytes, of pRecordStream.

[in] pStringData

When set to NULL, the calling thread locale is used to search for a matching string in the SDP record. If not NULL, the mibeNum and attributeId members of the SDP_STRING_TYPE_DATA structure are used to find the string to convert.

[in] usStringOffset

SDP string type offset to convert. The usStringOffset is added to the base attribute identifier of the string. SDP specification-defined offsets are: STRING_NAME_OFFSET, STRING_DESCRIPTION_OFFSET, and STRING_PROVIDER_NAME_OFFSET. These offsets can be found in the bthdef.h header file.

[out] pszString

If not NULL, contains the converted string on output. When set to NULL, the pcchStringLength parameter is filled with the required number of characters, not bytes, to retrieve the converted string.

[in, out] pcchStringLength

On input, contains the length of pszString if pszString is not NULL, in characters.

Upon output, contains the number of required characters including NULL if an error is returned, or the number of characters written to pszString, including NULL.

Return value

Returns ERROR_SUCCESS upon successful completion; the pszString parameter contains the converted string. Returns error codes upon failure. Common errors are listed in the following table.

Return code Description
The pszString parameter was NULL or too small to contain the converted string; the pcchStringLength parameter contains, in characters, the required length.
The conversion cannot be performed.
The system cannot allocate memory internally to perform the conversion.
One of the required pointers was NULL, the pRecordStream parameter was not a valid SDP stream, the pRecordStream was not a properly formatted record, or the requested attribute plus offset was not a string.


Minimum supported client Windows Vista, Windows XP with SP2 [desktop apps only]
Minimum supported server None supported
Target Platform Windows
Header bluetoothapis.h (include Bthsdpdef.h, BluetoothAPIs.h)
Library Bthprops.lib
DLL bthprops.cpl

See also