dlls/winebth.sys: Register and enable BTHPORT_DEVICE and BLUETOOTH_RADIO interfaces for radio PDOs.

This commit is contained in:
Vibhav Pant 2024-10-10 18:19:44 +05:30
parent d88ca888db
commit e2a2555f5a
No known key found for this signature in database
GPG key ID: E3FB28CB6AB59598
3 changed files with 57 additions and 0 deletions

View file

@ -29,6 +29,7 @@
#include <winternl.h>
#include <initguid.h>
#include <devpkey.h>
#include <bthdef.h>
#include <winioctl.h>
#include <ddk/wdm.h>
@ -67,6 +68,8 @@ struct bluetooth_radio
DEVICE_OBJECT *device_obj;
winebluetooth_radio_t radio;
WCHAR *hw_name;
UNICODE_STRING bthport_symlink_name;
UNICODE_STRING bthradio_symlink_name;
};
void WINAPIV append_id( struct string_buffer *buffer, const WCHAR *format, ... )
@ -348,10 +351,27 @@ static NTSTATUS WINAPI pdo_pnp( DEVICE_OBJECT *device_obj, IRP *irp )
break;
}
case IRP_MN_START_DEVICE:
if (IoRegisterDeviceInterface( device_obj, &GUID_BTHPORT_DEVICE_INTERFACE, NULL,
&device->bthport_symlink_name ) == STATUS_SUCCESS)
IoSetDeviceInterfaceState( &device->bthport_symlink_name, TRUE );
if (IoRegisterDeviceInterface( device_obj, &GUID_BLUETOOTH_RADIO_INTERFACE, NULL,
&device->bthradio_symlink_name ) == STATUS_SUCCESS)
IoSetDeviceInterfaceState( &device->bthradio_symlink_name, TRUE );
ret = STATUS_SUCCESS;
break;
case IRP_MN_REMOVE_DEVICE:
assert( device->removed );
if (device->bthport_symlink_name.Buffer)
{
IoSetDeviceInterfaceState(&device->bthport_symlink_name, FALSE);
RtlFreeUnicodeString( &device->bthport_symlink_name );
}
if (device->bthradio_symlink_name.Buffer)
{
IoSetDeviceInterfaceState(&device->bthradio_symlink_name, FALSE);
RtlFreeUnicodeString( &device->bthradio_symlink_name );
}
free( device->hw_name );
winebluetooth_radio_free( device->radio );
IoDeleteDevice( device->device_obj );

View file

@ -58,6 +58,7 @@ SOURCES = \
bits5_0.idl \
bitsmsg.h \
bluetoothapis.h \
bthdef.h \
bthsdpdef.h \
cderr.h \
cdosys.idl \

36
include/bthdef.h Normal file
View file

@ -0,0 +1,36 @@
/*
* Copyright (C) 2024 Vibhav Pant
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __BTHDEF_H__
#define __BTHDEF_H__
#ifdef __cplusplus
extern "C" {
#endif
DEFINE_GUID( GUID_BTHPORT_DEVICE_INTERFACE, 0x850302a, 0xb344, 0x4fda, 0x9b, 0xe9, 0x90, 0x57, 0x6b,
0x8d, 0x46, 0xf0 );
DEFINE_GUID( GUID_BLUETOOTH_RADIO_INTERFACE, 0x92383b0e, 0xf90e, 0x4ac9, 0x8d, 0x44, 0x8c, 0x2d,
0x0d, 0x0e, 0xbd, 0xa2 );
#ifdef __cplusplus
}
#endif
#endif /* __BTHDEF_H__ */