Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 7 ++----- dlls/sechost/service.c | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index fea8dc07654..431dadcb348 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -10008,7 +10008,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] ), @@ -10207,8 +10206,7 @@ static void test_RegisterDeviceNotification(void) ok( !!devnotify, "RegisterDeviceNotificationA failed, error %u\n", GetLastError() );
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 ); @@ -10249,8 +10247,7 @@ static void test_RegisterDeviceNotification(void) ok( !!devnotify, "RegisterDeviceNotificationA failed, error %u\n", GetLastError() );
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 ); diff --git a/dlls/sechost/service.c b/dlls/sechost/service.c index b2c768f77b7..1dd053a86d7 100644 --- a/dlls/sechost/service.c +++ b/dlls/sechost/service.c @@ -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);