From: Vibhav Pant vibhavp@gmail.com
--- include/Makefile.in | 1 + include/wine/dbt.h | 73 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 include/wine/dbt.h
diff --git a/include/Makefile.in b/include/Makefile.in index 40a71d45a1f..198abf5138e 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -879,6 +879,7 @@ SOURCES = \ wine/asm.h \ wine/atsvc.idl \ wine/condrv.h \ + wine/dbt.h \ wine/dcetypes.idl \ wine/debug.h \ wine/dplaysp.h \ diff --git a/include/wine/dbt.h b/include/wine/dbt.h new file mode 100644 index 00000000000..353f538de07 --- /dev/null +++ b/include/wine/dbt.h @@ -0,0 +1,73 @@ +/* + * Definitions for registering device notifications + * + * Copyright 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 __WINE_WINE_DBT_H_ +#define __WINE_WINE_DBT_H_ + +#include <wine/debug.h> + +struct device_notification_details +{ + DWORD (CALLBACK *cb)(HANDLE handle, HDEVNOTIFY notify, DWORD flags, DEVICE_BROADCAST *data, HANDLE device_handle); + HANDLE handle; + DWORD devicetype; + union + { + struct + { + BOOL all_classes; + GUID class; + } deviceinterface; + struct + { + OBJECT_NAME_INFORMATION *name_info; + HANDLE device; + } device; + } filter; +}; + +extern HDEVNOTIFY WINAPI I_ScRegisterDeviceNotification( struct device_notification_details *details, + void *filter, DWORD flags ); +extern BOOL WINAPI I_ScUnregisterDeviceNotification( HDEVNOTIFY handle ); + +static inline const char *debugstr_DEVICE_BROADCAST(const DEVICE_BROADCAST *data) +{ + if (!data) return "(null)"; + + switch (data->devicetype) + { + case DBT_DEVTYP_DEVICEINTERFACE: + return wine_dbg_sprintf( "{%d DBT_DEVTYP_DEVICEINTERFACE %s %s}", + data->event.device_interface.header.reserved, + debugstr_guid( &data->event.device_interface.class_guid ), + debugstr_w( data->event.device_interface.name ) ); + case DBT_DEVTYP_HANDLE: + return wine_dbg_sprintf( "{%d DBT_DEVTYP_HANDLE %s %s %s %d %p}", + data->event.device_interface.header.reserved, + debugstr_w( data->event.handle.handle_file_path ), + debugstr_guid( &data->event.handle.event_guid ), + debugstr_w( data->event.handle.name ), + data->event.handle.data_size, data->event.handle.data ); + default: + return wine_dbg_sprintf( "{type=%d %p}\n", data->devicetype, data ); + } +} + +#endif /* __WINE_WINE_DBT_H_ */