From: Rémi Bernon rbernon@codeweavers.com
--- dlls/ntoskrnl.exe/pnp.c | 6 +++--- dlls/sechost/service.c | 6 +++++- include/wine/plugplay.idl | 6 ++++-- programs/plugplay/main.c | 7 +++++-- 4 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c index 9d91160c46d..de9c319c20f 100644 --- a/dlls/ntoskrnl.exe/pnp.c +++ b/dlls/ntoskrnl.exe/pnp.c @@ -744,11 +744,11 @@ static LONG WINAPI rpc_filter( EXCEPTION_POINTERS *eptr ) return I_RpcExceptionFilter( eptr->ExceptionRecord->ExceptionCode ); }
-static void send_devicechange( DWORD code, void *data, unsigned int size ) +static void send_devicechange( const WCHAR *path, DWORD code, void *data, unsigned int size ) { __TRY { - plugplay_send_event( code, data, size ); + plugplay_send_event( path, code, data, size ); } __EXCEPT(rpc_filter) { @@ -864,7 +864,7 @@ NTSTATUS WINAPI IoSetDeviceInterfaceState( UNICODE_STRING *name, BOOLEAN enable broadcast->dbcc_classguid = iface->interface_class; lstrcpynW( broadcast->dbcc_name, name->Buffer, namelen + 1 ); if (namelen > 1) broadcast->dbcc_name[1] = '\'; - send_devicechange( enable ? DBT_DEVICEARRIVAL : DBT_DEVICEREMOVECOMPLETE, broadcast, len ); + send_devicechange( L"", enable ? DBT_DEVICEARRIVAL : DBT_DEVICEREMOVECOMPLETE, broadcast, len ); heap_free( broadcast ); } return ret; diff --git a/dlls/sechost/service.c b/dlls/sechost/service.c index b376cc312d4..6fc225a3501 100644 --- a/dlls/sechost/service.c +++ b/dlls/sechost/service.c @@ -2029,6 +2029,7 @@ static DWORD WINAPI device_notify_proc( void *arg ) plugplay_rpc_handle handle = NULL; DWORD code = 0; unsigned int size; + WCHAR *path; BYTE *buf;
SetThreadDescription( GetCurrentThread(), L"wine_sechost_device_notify" ); @@ -2064,10 +2065,11 @@ static DWORD WINAPI device_notify_proc( void *arg )
for (;;) { + path = NULL; buf = NULL; __TRY { - code = plugplay_get_event( handle, &buf, &size ); + code = plugplay_get_event( handle, &path, &buf, &size ); err = ERROR_SUCCESS; } __EXCEPT(rpc_filter) @@ -2098,7 +2100,9 @@ static DWORD WINAPI device_notify_proc( void *arg ) list_remove( &event->entry ); free( event ); } + MIDL_user_free(buf); + MIDL_user_free(path); }
__TRY diff --git a/include/wine/plugplay.idl b/include/wine/plugplay.idl index 32b0799b83c..9df59e9ac05 100644 --- a/include/wine/plugplay.idl +++ b/include/wine/plugplay.idl @@ -41,7 +41,9 @@ interface plugplay typedef [context_handle] void *plugplay_rpc_handle;
plugplay_rpc_handle plugplay_register_listener(); - DWORD plugplay_get_event([in] plugplay_rpc_handle handle, [out, size_is(,*size)] BYTE **data, [out] unsigned int *size); + DWORD plugplay_get_event([in] plugplay_rpc_handle handle, [out, string] WCHAR **path, + [out, size_is(,*size)] BYTE **data, [out] unsigned int *size); void plugplay_unregister_listener([in] plugplay_rpc_handle handle); - void plugplay_send_event([in] DWORD event_code, [in, size_is(size)] const BYTE *data, [in] unsigned int size); + void plugplay_send_event([in, string] const WCHAR *path, [in] DWORD event_code, + [in, size_is(size)] const BYTE *data, [in] unsigned int size); } diff --git a/programs/plugplay/main.c b/programs/plugplay/main.c index 8426f2204a3..f3614288f3c 100644 --- a/programs/plugplay/main.c +++ b/programs/plugplay/main.c @@ -65,6 +65,7 @@ struct event struct list entry; DWORD code; BYTE *data; + WCHAR *path; unsigned int size; };
@@ -108,7 +109,7 @@ plugplay_rpc_handle __cdecl plugplay_register_listener(void) return listener; }
-DWORD __cdecl plugplay_get_event( plugplay_rpc_handle handle, BYTE **data, unsigned int *size ) +DWORD __cdecl plugplay_get_event( plugplay_rpc_handle handle, WCHAR **path, BYTE **data, unsigned int *size ) { struct listener *listener = handle; struct event *event; @@ -126,6 +127,7 @@ DWORD __cdecl plugplay_get_event( plugplay_rpc_handle handle, BYTE **data, unsig LeaveCriticalSection( &plugplay_cs );
ret = event->code; + *path = event->path; *data = event->data; *size = event->size; free( event ); @@ -137,7 +139,7 @@ void __cdecl plugplay_unregister_listener( plugplay_rpc_handle handle ) destroy_listener( handle ); }
-void __cdecl plugplay_send_event( DWORD code, const BYTE *data, unsigned int size ) +void __cdecl plugplay_send_event( const WCHAR *path, DWORD code, const BYTE *data, unsigned int size ) { struct listener *listener; struct event *event; @@ -158,6 +160,7 @@ void __cdecl plugplay_send_event( DWORD code, const BYTE *data, unsigned int siz break; }
+ event->path = wcsdup( path ); event->code = code; memcpy( event->data, data, size ); event->size = size;