That should be GUID_WINEBTH_AUTHENTICATION_REQUEST.
We also need to correctly handle IRP_MJ_PNP requests for this new device.
Fixed, thanks.
`+ struct bluetooth_auth_listener *hreg;`
Bikeshedding, but "hreg" seems an odd variable name; why not "listener"?
A lot of documentation/Win32 code seems to use the `h` prefix for opaque handles like these, so I inadvertently ended up doing the same. `listener` is more descriptive, you're right. Renamed.
Why the threadpool? Why can't we call the callback right now?
To avoid a deadlock if the callback calls `BluetoothUnregisterAuthentication` (which succeeds in Windows). The other way would be to make a copy of all listeners before calling them, but that feels excessive IMO. It's also to not lock up the PnP notification dispatcher loop in `I_ScRegisterDeviceNotification` if the callback itself never returns (by say, infinite looping or deadlocking). Additionally, on Windows, a callback never returning does not affect other callbacks, which are still dispatched on other threads.
I really should have said something earlier, but we don't need all these different source files with less than 500 lines in each of them, especially if it's going to necessitate an extra header for helpers.
Yeah, I have merged it into `device.c`.
Also, you don't want to test GetLastError() and the call at the same time, there's no sequence point between those. This is the one point where you _do_ need to assign a bool to a temporary variable.
Ah, right. Forgot the evaluation order is undefined, thanks.