The BluetoothSetLocalServiceInfo function sets local service information for a specific Bluetooth radio. This function is used to advertise services to which remote devices can connect.
Note Service information set with this function will persist across reboots.
DWORD WINAPI BluetoothSetLocalServiceInfo( _In_opt_ HANDLE hRadioIn, _In_ const GUID *pClassGuid, ULONG ulInstance, const BLUETOOTH_LOCAL_SERVICE_INFO *pServiceInfoIn );
hRadioIn [in, optional]
A handle of the Bluetooth radio device to which the local service information applies. If this parameter is NULL, BluetoothSetLocalServiceInfo searches for the first available local Bluetooth radio.
The GUID of the service to expose. This should match the GUID in the server-side INF file for the profile driver.
An instance ID for the device node of the Plug and Play (PnP) ID.
A pointer to a BLUETOOTH_LOCAL_SERVICE_INFO structure that describes the local service to set.
Returns ERROR_SUCCESS upon successful completion. The following table shows some common errors.
The specified Bluetooth radio was not detected.
No Bluetooth radios were detected.
There were insufficient resources to complete the operation. This condition occurs when more than 100 local physical device objects (PDOs) corresponding to Bluetooth services.
The caller does not have the required privileges.
Applications can call BluetoothSetLocalServiceInfo subsequent times with the same service GUID but with a different instance ID to create multiple instances of the specified server-side profile. It is important that each instance ID associated with a device is unique, as it will prevent the service driver from being prematurely uninstalled if one, of possibly many, dependent devices is unpaired.
The process that calls BluetoothSetLocalServiceInfo must have the SE_LOAD_DRIVER_NAME privilege. A process running in the system or in the administrator context can elevate its privilege using the LookupPrivilegeValue and AdjustTokenPrivileges functions.
Minimum supported client
|Windows Vista [desktop apps only]|
Minimum supported server
|BluetoothAPIs.h (include Bthsdpdef.h or BluetoothAPIs.h)|