BluetoothRegisterForAuthentication function (bluetoothapis.h)

The BluetoothRegisterForAuthentication function registers a callback function that is called when a particular Bluetooth device requests authentication.

Note  When developing for Windows Vista SP2 and Windows 7 the use of BluetoothRegisterForAuthenticationEx is recommended.
 

Syntax

DWORD BluetoothRegisterForAuthentication(
  const BLUETOOTH_DEVICE_INFO            *pbtdi,
  HBLUETOOTH_AUTHENTICATION_REGISTRATION *phRegHandle,
  PFN_AUTHENTICATION_CALLBACK            pfnCallback,
  PVOID                                  pvParam
);

Parameters

pbtdi

Pointer to a BLUETOOTH_DEVICE_INFO structure. The Address member is used for comparison.

phRegHandle

Pointer to a structure in which the registration HANDLE is stored. Call the BluetoothUnregisterAuthentication to close the handle.

pfnCallback

Function to be called when the authentication event occurs. The function should match the prototype described in PFN_AUTHENTICATION_CALLBACK.

pvParam

Optional parameter to be passed through the callback function.

Return value

Returns ERROR_SUCCESS upon successful completion, and a valid registration handle was returned in phRegHandle. Any other return value indicates failure.

Call the GetLastError function to obtain more information about the error. The following table describes a common error:

Return code Description
ERROR_OUTOFMEMORY
Out of memory.

Requirements

Requirement Value
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

BLUETOOTH_DEVICE_INFO

BluetoothAuthenticateDevice

BluetoothAuthenticateMultipleDevices

BluetoothEnableDiscovery

BluetoothEnableIncomingConnections

BluetoothIsConnectable

BluetoothIsDiscoverable

BluetoothRegisterForAuthentication

BluetoothSendAuthenticationResponse

BluetoothUnregisterAuthentication