sechost: Support device interface notifications filtering.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
30af95f45d
commit
439d126a99
|
@ -197,7 +197,6 @@ static LRESULT CALLBACK devnotify_wndproc( HWND hwnd, UINT msg, WPARAM wparam, L
|
|||
|
||||
winetest_push_context( "%u", device_change_count );
|
||||
|
||||
todo_wine_if( IsEqualGUID( &iface->dbcc_classguid, &control_class ) && !device_change_all )
|
||||
ok( IsEqualGUID( &iface->dbcc_classguid, &expect_guid ), "got dbch_classguid %s\n",
|
||||
debugstr_guid( &iface->dbcc_classguid ) );
|
||||
ok( iface->dbcc_size >= offsetof( DEV_BROADCAST_DEVICEINTERFACE_W, dbcc_name[wcslen( iface->dbcc_name ) + 1] ),
|
||||
|
@ -315,8 +314,7 @@ static void test_RegisterDeviceNotification(void)
|
|||
while (PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE )) DispatchMessageW( &msg );
|
||||
|
||||
device_change_count = 0;
|
||||
if (!strcmp( winetest_platform, "wine" )) device_change_expect = 4;
|
||||
else device_change_expect = 2;
|
||||
device_change_expect = 2;
|
||||
device_change_hwnd = hwnd;
|
||||
device_change_all = FALSE;
|
||||
stop_event = CreateEventW( NULL, FALSE, FALSE, NULL );
|
||||
|
@ -349,8 +347,7 @@ static void test_RegisterDeviceNotification(void)
|
|||
while (PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE )) DispatchMessageW( &msg );
|
||||
|
||||
device_change_count = 0;
|
||||
if (!strcmp( winetest_platform, "wine" )) device_change_expect = 4;
|
||||
else device_change_expect = 2;
|
||||
device_change_expect = 2;
|
||||
device_change_hwnd = hwnd;
|
||||
device_change_all = FALSE;
|
||||
stop_event = CreateEventW( NULL, FALSE, FALSE, NULL );
|
||||
|
|
|
@ -1990,6 +1990,23 @@ struct device_notify_registration
|
|||
struct device_notification_details details;
|
||||
};
|
||||
|
||||
static BOOL notification_filter_matches( DEV_BROADCAST_HDR *filter, DEV_BROADCAST_HDR *event )
|
||||
{
|
||||
if (!filter->dbch_devicetype) return TRUE;
|
||||
if (filter->dbch_devicetype != event->dbch_devicetype) return FALSE;
|
||||
|
||||
if (filter->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
|
||||
{
|
||||
DEV_BROADCAST_DEVICEINTERFACE_W *filter_iface = (DEV_BROADCAST_DEVICEINTERFACE_W *)filter;
|
||||
DEV_BROADCAST_DEVICEINTERFACE_W *event_iface = (DEV_BROADCAST_DEVICEINTERFACE_W *)event;
|
||||
if (filter_iface->dbcc_size == offsetof(DEV_BROADCAST_DEVICEINTERFACE_W, dbcc_classguid)) return TRUE;
|
||||
return IsEqualGUID( &filter_iface->dbcc_classguid, &event_iface->dbcc_classguid );
|
||||
}
|
||||
|
||||
FIXME( "Filter dbch_devicetype %u not implemented\n", filter->dbch_devicetype );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static DWORD WINAPI device_notify_proc( void *arg )
|
||||
{
|
||||
WCHAR endpoint[] = L"\\pipe\\wine_plugplay";
|
||||
|
@ -2074,6 +2091,7 @@ static DWORD WINAPI device_notify_proc( void *arg )
|
|||
|
||||
for (i = 0; i < details_copy_nelems; i++)
|
||||
{
|
||||
if (!notification_filter_matches( &details_copy[i].filter.header, (DEV_BROADCAST_HDR *)buf )) continue;
|
||||
details_copy[i].cb( details_copy[i].handle, code, (DEV_BROADCAST_HDR *)buf );
|
||||
}
|
||||
MIDL_user_free(buf);
|
||||
|
@ -2104,8 +2122,6 @@ HDEVNOTIFY WINAPI I_ScRegisterDeviceNotification( struct device_notification_det
|
|||
|
||||
TRACE("callback %p, handle %p, filter %p, flags %#x\n", details->cb, details->handle, filter, flags);
|
||||
|
||||
if (filter) FIXME("Notification filters are not yet implemented.\n");
|
||||
|
||||
if (!(registration = heap_alloc(sizeof(struct device_notify_registration))))
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
|
|
Loading…
Reference in New Issue