OK, I just submitted an updated change. I spent a lot of time yesterday and today getting the logic right, testing various /O options, side by side with Windows. This looks right to me. I did abstain from cleaning up the use of the global variables. This change at least does not add any. Cleaning those up will be an exercise for (another person at) another time. Let me know what you think of the change.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7131#note_93212
The Windows Bluetooth stack uses private IOCTLs in order to set the [discoverability](https://learn.microsoft.com/en-us/windows/win32/api/blueto… and [connectability](https://learn.microsoft.com/en-us/windows/win32/api/bluetoo… status of a local radio, and to start/stop the device inquiry procedure. This MR introduces 3 wine-specific IOCTL codes for the same purposes, as most applications seem to the Win32 API itself for these operations:
* IOCTL_WINBTH_RADIO_SET_FLAG
* IOCTL_WINEBTH_RADIO_START_DISCOVERY
* IOCTL_WINEBTH_RADIO_STOP_DISCOVERY
--
v5: winebth.sys: Call bluez_watcher_close as part of bluetooth_shutdown.
winebth.sys: Implement IOCTL_WINEBTH_RADIO_STOP_DISCOVERY.
winebth.sys: Implement IOCTL_WINEBTH_RADIO_START_DISCOVERY.
winebth.sys: Implement IOCTL_WINEBTH_RADIO_SET_FLAG.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7216