[PATCH 1/3] plugplay: Avoid requiring rpcss.exe for PnP RPC notifications.

Rémi Bernon rbernon at codeweavers.com
Tue Jan 25 03:55:48 CST 2022


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

Still not sure what the difference between ncacn_np and ncalrpc is, but
this seems to just work. The services manager also uses ncacn_np instead
of ncalrpc. I don't think we want to rely on rpcss.exe, for these PnP
notifications, as it creates an additional service dependency which is
going to be hard to solve.

FWIW, relying on rpcss.exe also causes some prefix shutdown issues, as
the PnP device removal involves sending some notifications. As rpcss.exe
usually exits at the same time, plugplay.exe is then waiting on it and
may block if it's not responding anymore.

This was resolved for a while by wineserver killing and reaping the
services after its shutdown timeout, but caused an additional 1s delay,
and later with 7f749d58d9cbb0b3d54f2db75dbd88695b20901a, by the service
manager terminating all the service processes on shutdown instead.

For proper service shutdown, the manager should instead wait for the
services to exit, and in this case not relying on rpcss.exe will help
plugplay exit itself quickly.

 dlls/ntoskrnl.exe/pnp.c   | 2 +-
 dlls/sechost/service.c    | 2 +-
 include/wine/plugplay.idl | 1 +
 programs/plugplay/main.c  | 2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c
index 6d53d79267e..8d3481b2a72 100644
--- a/dlls/ntoskrnl.exe/pnp.c
+++ b/dlls/ntoskrnl.exe/pnp.c
@@ -1084,7 +1084,7 @@ 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 protseq[] = L"ncacn_np";
     UNICODE_STRING driver_nameU;
     RPC_WSTR binding_str;
     NTSTATUS status;
diff --git a/dlls/sechost/service.c b/dlls/sechost/service.c
index e6f4eb75db0..4dfb40b4bac 100644
--- a/dlls/sechost/service.c
+++ b/dlls/sechost/service.c
@@ -1988,7 +1988,7 @@ struct device_notify_registration
 static DWORD WINAPI device_notify_proc( void *arg )
 {
     WCHAR endpoint[] = L"\\pipe\\wine_plugplay";
-    WCHAR protseq[] = L"ncalrpc";
+    WCHAR protseq[] = L"ncacn_np";
     RPC_WSTR binding_str;
     DWORD err = ERROR_SUCCESS;
     struct device_notify_registration *registration;
diff --git a/include/wine/plugplay.idl b/include/wine/plugplay.idl
index 8123b733ad1..a3e7b04bf30 100644
--- a/include/wine/plugplay.idl
+++ b/include/wine/plugplay.idl
@@ -20,6 +20,7 @@ import "wtypes.idl";
 
 [
     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..366be9c2b46 100644
--- a/programs/plugplay/main.c
+++ b/programs/plugplay/main.c
@@ -200,7 +200,7 @@ 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 protseq[] = "ncacn_np";
     SERVICE_STATUS status;
     RPC_STATUS err;
 
-- 
2.34.1




More information about the wine-devel mailing list