BluetoothRegisterForAuthentication 函数 (bluetoothapis.h)
BluetoothRegisterForAuthentication 函数注册当特定蓝牙设备请求身份验证时调用的回调函数。
注意 针对 Windows Vista SP2 和 Windows 7 进行开发时,建议使用 BluetoothRegisterForAuthenticationEx 。
语法
DWORD BluetoothRegisterForAuthentication(
const BLUETOOTH_DEVICE_INFO *pbtdi,
HBLUETOOTH_AUTHENTICATION_REGISTRATION *phRegHandle,
PFN_AUTHENTICATION_CALLBACK pfnCallback,
PVOID pvParam
);
参数
pbtdi
指向 BLUETOOTH_DEVICE_INFO 结构的指针。 Address 成员用于比较。
phRegHandle
指向在其中存储注册 HANDLE 的结构的指针。 调用 BluetoothUnregisterAuthentication 以关闭句柄。
pfnCallback
发生身份验证事件时要调用的函数。 函数应与 PFN_AUTHENTICATION_CALLBACK 中所述的原型匹配。
pvParam
要通过回调函数传递的可选参数。
返回值
成功完成后返回ERROR_SUCCESS,并在 phRegHandle 中返回有效的注册句柄。 任何其他返回值表示失败。
调用 GetLastError 函数以获取有关错误的详细信息。 下表描述了一个常见错误:
返回代码 | 说明 |
---|---|
|
内存不足。 |
要求
要求 | 值 |
---|---|
最低受支持的客户端 | Windows Vista、Windows XP 和 SP2 [仅限桌面应用] |
最低受支持的服务器 | 无受支持的版本 |
目标平台 | Windows |
标头 | bluetoothapis.h (包括 Bthsdpdef.h、BluetoothAPIs.h) |
Library | Bthprops.lib |
DLL | bthprops.cpl |
另请参阅
BluetoothAuthenticateMultipleDevices
BluetoothEnableIncomingConnections
BluetoothRegisterForAuthentication
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈