From: Vibhav Pant vibhavp@gmail.com
On receiving a BLUETOOTH_WATCHER_EVENT_TYPE_DEVICE_REMOVED event from Unix, broadcast a GUID_BLUETOOTH_RADIO_OUT_OF_RANGE PnP event for the device address that was removed. --- dlls/winebth.sys/winebth.c | 24 ++++++++++++++++++++++++ include/bthdef.h | 3 +++ 2 files changed, 27 insertions(+)
diff --git a/dlls/winebth.sys/winebth.c b/dlls/winebth.sys/winebth.c index c4923902691..dc680dcca3a 100644 --- a/dlls/winebth.sys/winebth.c +++ b/dlls/winebth.sys/winebth.c @@ -539,6 +539,30 @@ static void bluetooth_radio_remove_remote_device( struct winebluetooth_watcher_e if (winebluetooth_device_equal( event.device, device->device )) { list_remove( &device->entry ); + if (device->props_mask & WINEBLUETOOTH_DEVICE_PROPERTY_ADDRESS) + { + TARGET_DEVICE_CUSTOM_NOTIFICATION *notification; + BLUETOOTH_ADDRESS *addr; + SIZE_T notif_size; + NTSTATUS ret; + + notif_size = offsetof( TARGET_DEVICE_CUSTOM_NOTIFICATION, CustomDataBuffer[sizeof( *addr )] ); + if ((notification = ExAllocatePool( PagedPool, notif_size ))) + { + notification->Version = 1; + notification->Size = notif_size; + notification->Event = GUID_BLUETOOTH_RADIO_OUT_OF_RANGE; + notification->FileObject = NULL; + notification->NameBufferOffset = -1; + addr = (BLUETOOTH_ADDRESS *)notification->CustomDataBuffer; + addr->ullLong = RtlUlonglongByteSwap( device->props.address.ullLong ) >> 16; + + ret = IoReportTargetDeviceChange( radio->device_obj, notification ); + if (ret) + ERR( "IoReportTargetDeviceChange failed: %#lx\n", ret ); + ExFreePool( notification ); + } + } winebluetooth_device_free( device->device ); DeleteCriticalSection( &device->props_cs ); free( device ); diff --git a/include/bthdef.h b/include/bthdef.h index d3b9387f8cc..3686cbb6862 100644 --- a/include/bthdef.h +++ b/include/bthdef.h @@ -32,6 +32,9 @@ DEFINE_GUID( GUID_BLUETOOTH_RADIO_INTERFACE, 0x92383b0e, 0xf90e, 0x4ac9, 0x8d, 0 DEFINE_GUID( GUID_BLUETOOTH_RADIO_IN_RANGE, 0xea3b5b82, 0x26ee, 0x450e, 0xb0, 0xd8, 0xd2, 0x6f, 0xe3, 0x0a, 0x38, 0x69 );
+DEFINE_GUID( GUID_BLUETOOTH_RADIO_OUT_OF_RANGE, 0xe28867c9, 0xc2aa, 0x4ced, 0xb9, 0x69, 0x45, 0x70, + 0x86, 0x60, 0x37, 0xc4); + typedef ULONG BTH_COD;
#define BTH_MAX_NAME_SIZE (248)