Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
I don't really know the difference between "ncalrpc" and "ncacn_np", but the services manager uses "ncacn_np" and it doesn't require rpcss to be there to work.
I think plugplay should do the same, to not be dependent on rpcss, which may be started after it, and stopped before it, causing problems with device hotplug notifications when it's not there.
dlls/ntoskrnl.exe/pnp.c | 6 +++--- dlls/sechost/service.c | 6 +++--- include/wine/plugplay.idl | 7 +++++++ programs/plugplay/main.c | 6 +++--- 4 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c index 6d53d79267e..165e431ea68 100644 --- a/dlls/ntoskrnl.exe/pnp.c +++ b/dlls/ntoskrnl.exe/pnp.c @@ -1083,8 +1083,8 @@ static NTSTATUS WINAPI pnp_manager_driver_entry( DRIVER_OBJECT *driver, UNICODE_ void pnp_manager_start(void) { static const WCHAR driver_nameW[] = {'\','D','r','i','v','e','r','\','P','n','p','M','a','n','a','g','e','r',0}; - WCHAR endpoint[] = L"\pipe\wine_plugplay"; - WCHAR protseq[] = L"ncalrpc"; + WCHAR transport[] = PLUGPLAY_TRANSPORT; + WCHAR endpoint[] = PLUGPLAY_ENDPOINT; UNICODE_STRING driver_nameU; RPC_WSTR binding_str; NTSTATUS status; @@ -1094,7 +1094,7 @@ void pnp_manager_start(void) if ((status = IoCreateDriver( &driver_nameU, pnp_manager_driver_entry ))) ERR("Failed to create PnP manager driver, status %#x.\n", status);
- if ((err = RpcStringBindingComposeW( NULL, protseq, NULL, endpoint, NULL, &binding_str ))) + if ((err = RpcStringBindingComposeW( NULL, transport, NULL, endpoint, NULL, &binding_str ))) { ERR("RpcStringBindingCompose() failed, error %#x\n", err); return; diff --git a/dlls/sechost/service.c b/dlls/sechost/service.c index e6f4eb75db0..4a23758de5e 100644 --- a/dlls/sechost/service.c +++ b/dlls/sechost/service.c @@ -1987,8 +1987,8 @@ struct device_notify_registration
static DWORD WINAPI device_notify_proc( void *arg ) { - WCHAR endpoint[] = L"\pipe\wine_plugplay"; - WCHAR protseq[] = L"ncalrpc"; + WCHAR transport[] = PLUGPLAY_TRANSPORT; + WCHAR endpoint[] = PLUGPLAY_ENDPOINT; RPC_WSTR binding_str; DWORD err = ERROR_SUCCESS; struct device_notify_registration *registration; @@ -1999,7 +1999,7 @@ static DWORD WINAPI device_notify_proc( void *arg ) unsigned int i, size; BYTE *buf;
- if ((err = RpcStringBindingComposeW( NULL, protseq, NULL, endpoint, NULL, &binding_str ))) + if ((err = RpcStringBindingComposeW( NULL, transport, NULL, endpoint, NULL, &binding_str ))) { ERR("RpcStringBindingCompose() failed, error %#x\n", err); return err; diff --git a/include/wine/plugplay.idl b/include/wine/plugplay.idl index 8123b733ad1..b5d42ec2135 100644 --- a/include/wine/plugplay.idl +++ b/include/wine/plugplay.idl @@ -18,8 +18,15 @@
import "wtypes.idl";
+cpp_quote("#include "winsvc.h"") +cpp_quote("#define PLUGPLAY_TRANSPORT {'n','c','a','c','n','_','n','p',0}") +cpp_quote("#define PLUGPLAY_TRANSPORTA "ncacn_np"") +cpp_quote("#define PLUGPLAY_ENDPOINT {'\\','p','i','p','e','\\','w','i','n','e','_','p','l','u','g','p','l','a','y',0}") +cpp_quote("#define PLUGPLAY_ENDPOINTA "\\pipe\\wine_plugplay"") + [ uuid(57c680ac-7bce-4f39-97fd-ffea566754d5), + endpoint("ncacn_np:[\pipe\wine_plugplay]"), implicit_handle(handle_t plugplay_binding_handle) ] interface plugplay diff --git a/programs/plugplay/main.c b/programs/plugplay/main.c index 1156cb9f036..0ca1c37194e 100644 --- a/programs/plugplay/main.c +++ b/programs/plugplay/main.c @@ -199,14 +199,14 @@ static DWORD WINAPI service_handler( DWORD ctrl, DWORD event_type, LPVOID event_
static void WINAPI ServiceMain( DWORD argc, LPWSTR *argv ) { - unsigned char endpoint[] = "\pipe\wine_plugplay"; - unsigned char protseq[] = "ncalrpc"; + unsigned char transport[] = PLUGPLAY_TRANSPORTA; + unsigned char endpoint[] = PLUGPLAY_ENDPOINTA; SERVICE_STATUS status; RPC_STATUS err;
WINE_TRACE( "starting service\n" );
- if ((err = RpcServerUseProtseqEpA( protseq, 0, endpoint, NULL ))) + if ((err = RpcServerUseProtseqEpA( transport, 0, endpoint, NULL ))) { ERR("RpcServerUseProtseqEp() failed, error %u\n", err); return;
Device drivers may be installed and started on prefix initialization but if PlugPlay is missing they won't be able to send plugplay notifications until the prefix is restarted.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
On prefix initialization plugplay.exe service is not automatically started, as the service has just been registered, and devices notifications do not work at all.
loader/wine.inf.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/loader/wine.inf.in b/loader/wine.inf.in index c0251934dfc..3af8dabca64 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -178,7 +178,7 @@ AddService=RpcSs,0,RpcSsService AddService=Spooler,0,SpoolerService AddService=StiSvc,0,StiService AddService=TermService,0,TerminalServices -AddService=PlugPlay,0,PlugPlayService +AddService=PlugPlay,0x800,PlugPlayService AddService=FontCache3.0.0.0,0,WPFFontCacheService AddService=LanmanServer,0,LanmanServerService AddService=FontCache,0,FontCacheService @@ -197,7 +197,7 @@ AddService=RpcSs,0,RpcSsService AddService=Spooler,0,SpoolerService AddService=StiSvc,0,StiService AddService=TermService,0,TerminalServices -AddService=PlugPlay,0,PlugPlayService +AddService=PlugPlay,0x800,PlugPlayService AddService=FontCache3.0.0.0,0,WPFFontCacheService AddService=LanmanServer,0,LanmanServerService AddService=FontCache,0,FontCacheService @@ -216,7 +216,7 @@ AddService=RpcSs,0,RpcSsService AddService=Spooler,0,SpoolerService AddService=StiSvc,0,StiService AddService=TermService,0,TerminalServices -AddService=PlugPlay,0,PlugPlayService +AddService=PlugPlay,0x800,PlugPlayService AddService=FontCache3.0.0.0,0,WPFFontCacheService AddService=LanmanServer,0,LanmanServerService AddService=FontCache,0,FontCacheService @@ -235,7 +235,7 @@ AddService=RpcSs,0,RpcSsService AddService=Spooler,0,SpoolerService AddService=StiSvc,0,StiService AddService=TermService,0,TerminalServices -AddService=PlugPlay,0,PlugPlayService +AddService=PlugPlay,0x800,PlugPlayService AddService=FontCache3.0.0.0,0,WPFFontCacheService AddService=LanmanServer,0,LanmanServerService AddService=FontCache,0,FontCacheService