From: Vibhav Pant vibhavp@gmail.com
--- dlls/bluetoothapis/main.c | 45 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-)
diff --git a/dlls/bluetoothapis/main.c b/dlls/bluetoothapis/main.c index ccfbe07258c..a9c9526f925 100644 --- a/dlls/bluetoothapis/main.c +++ b/dlls/bluetoothapis/main.c @@ -212,13 +212,54 @@ DWORD WINAPI BluetoothGetRadioInfo( HANDLE radio, PBLUETOOTH_RADIO_INFO info ) return ERROR_SUCCESS; }
+#define LOCAL_RADIO_CONNECTABLE 0x0002 + /********************************************************************* * BluetoothIsConnectable */ BOOL WINAPI BluetoothIsConnectable( HANDLE radio ) { - FIXME( "(%p): stub!\n", radio ); - return FALSE; + TRACE( "(%p)\n", radio ); + + if (!radio) + { + BLUETOOTH_FIND_RADIO_PARAMS params = {.dwSize = sizeof( params )}; + HBLUETOOTH_RADIO_FIND find = BluetoothFindFirstRadio( ¶ms, &radio ); + + if (!find) + return FALSE; + for (;;) + { + if (BluetoothIsConnectable( radio )) + { + CloseHandle( radio ); + BluetoothFindRadioClose( find ); + return TRUE; + } + + CloseHandle( radio ); + if (!BluetoothFindNextRadio( find, &radio )) + { + BluetoothFindRadioClose( find ); + return FALSE; + } + } + } + else + { + BTH_LOCAL_RADIO_INFO radio_info = {0}; + DWORD bytes; + DWORD ret; + + ret = DeviceIoControl( radio, IOCTL_BTH_GET_LOCAL_INFO, NULL, 0, &radio_info, sizeof( radio_info ), &bytes, + NULL ); + if (!ret) + { + ERR( "DeviceIoControl failed: %#lx\n", GetLastError() ); + return FALSE; + } + return !!(radio_info.flags & LOCAL_RADIO_CONNECTABLE); + } }
/*********************************************************************