rpc_J_PL1.diff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



License: X11-MIT

Changelog:

* dlls/rpcrt4: rpcss_np_client;
  include/wine: rpcss_shared.h;
  programs/rpcss: rpcss.h, rpcss_main.c, rpcss_np_server.c:
  Greg Turner <gmturner007@ameritech.net>
- rename NAME_RPCSS_NAMED_PIPE to RPCSS_NAMED_PIPE_NAME for consistiency
- add RPCSS_NP_VARIANT, RPCSS_NP_SERVER_WORK_EVENT_NAME constants
- move some stuff where it should be
- add RPCSS_ where appropriate (everywhere :)

--
diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/dlls/rpcrt4/rpcss_np_client.c ./dlls/rpcrt4/rpcss_np_client.c
--- ../wine.test/dlls/rpcrt4/rpcss_np_client.c	2002-12-02 01:34:58.000000000 -0600
+++ .c	2002-12-02 01:35:38.000000000 -0600
@@ -52,7 +52,7 @@
 
     /* try to open the client side of the named pipe. */
     the_pipe = CreateFileA(
-      NAME_RPCSS_NAMED_PIPE,           /* pipe name */
+      RPCSS_NAMED_PIPE_NAME,           /* pipe name */
       GENERIC_READ | GENERIC_WRITE,    /* r/w access */
       0,                               /* no sharing */
       NULL,                            /* no security attributes */
@@ -66,7 +66,7 @@
 
     if (GetLastError() != ERROR_PIPE_BUSY) {
       WARN("Unable to open named pipe %s (assuming unavailable).\n", 
-        debugstr_a(NAME_RPCSS_NAMED_PIPE));
+        debugstr_a(RPCSS_NAMED_PIPE_NAME));
       the_pipe = NULL;
       break;
     }
@@ -78,7 +78,7 @@
 
     /* wait for the named pipe.  We are only 
        willing to wait only 5 seconds.  It should be available /very/ soon. */
-    if (! WaitNamedPipeA(NAME_RPCSS_NAMED_PIPE, MASTER_MUTEX_WAITNAMEDPIPE_TIMEOUT))
+    if (! WaitNamedPipeA(RPCSS_NAMED_PIPE_NAME, MASTER_MUTEX_WAITNAMEDPIPE_TIMEOUT))
     {
       ERR("Named pipe unavailable after waiting.  Something is probably wrong.\n");
       return NULL;
diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/include/wine/rpcss_shared.h ./include/wine/rpcss_shared.h
--- ../wine.test/include/wine/rpcss_shared.h	2002-12-02 01:34:58.000000000 -0600
+++ ./include/wine/rpcss_shared.h	2002-12-02 01:35:38.000000000 -0600
@@ -11,18 +11,21 @@
 #define RPCSS_STRINGIFY_MACRO(x) RPCSS_STRINGIFY_MACRO2(x)
 #define RPCSS_STRINGIFY_MACRO2(x) #x
 
+ /* changing this should allow simultanously running rpcss instances
+  * to remain separate; this should be good enough for wine packagers and
+  * forks, which might need to keep their rpcss servers isolated from those
+  * generated by the tarballs, or for crude multiuser experiments.
+  */
+#define RPCSS_NP_VARIANT "-wine-"
+
 #define STRINGIFIED_RPCSS_NP_PROTOCOL_VERSION \
   RPCSS_STRINGIFY_MACRO(RPCSS_NP_PROTOCOL_VERSION)
 
-/* only local communications are supported so far on this pipe.
-   until this changes, we can just use a constant pipe-name */
-#define NAME_RPCSS_NAMED_PIPE \
-  ("\\\\.\\pipe\\RpcssNP" STRINGIFIED_RPCSS_NP_PROTOCOL_VERSION)
-
-/* mutex is local only... perhaps this ought to be part of the pipe
-   protocol for remote wine<->wine connections? */
+#define RPCSS_NAMED_PIPE_NAME \
+  ("\\\\.\\pipe\\RpcssNP" RPCSS_NP_VARIANT STRINGIFIED_RPCSS_NP_PROTOCOL_VERSION)
+  
 #define RPCSS_MASTER_MUTEX_NAME \
-  ("RPCSSMasterMutex" STRINGIFIED_RPCSS_NP_PROTOCOL_VERSION)
+  ("RPCSSMasterMutex" RPCSS_NP_VARIANT STRINGIFIED_RPCSS_NP_PROTOCOL_VERSION)
 
 /* payloads above 1K are fragmented into multiple messages */
 #define VARDATA_PAYLOAD_BYTES 1024 
diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/programs/rpcss/rpcss.h ./programs/rpcss/rpcss.h
--- ../wine.test/programs/rpcss/rpcss.h	2002-12-02 01:34:58.000000000 -0600
+++ ./programs/rpcss/rpcss.h	2002-12-02 01:35:38.000000000 -0600
@@ -4,6 +4,12 @@
 #include "wine/rpcss_shared.h"
 #include "windows.h"
 
+/* the "MasterMutex" is coupled with the "ServerWorkEvent" on the (rpcss) server-
+   side to provide atomicity of message processing, and ensure only one rpcss
+   is alive at a time */
+#define RPCSS_NP_SERVER_WORK_EVENT_NAME \
+  ("RPCSSNPSrvWrkEvt" RPCSS_NP_VARIANT STRINGIFIED_RPCSS_NP_PROTOCOL_VERSION)
+
 /* in seconds */
 #define RPCSS_DEFAULT_MAX_LAZY_TIMEOUT 30
 
diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/programs/rpcss/rpcss_main.c ./programs/rpcss/rpcss_main.c
--- ../wine.test/programs/rpcss/rpcss_main.c	2002-12-02 01:34:58.000000000 -0600
+++ ./programs/rpcss/rpcss_main.c	2002-12-02 01:35:38.000000000 -0600
@@ -67,27 +67,19 @@
 static HANDLE master_mutex;
 static long max_lazy_timeout = RPCSS_DEFAULT_MAX_LAZY_TIMEOUT;
 
+/* when do we just give up and bail? (UTC) */
+static SYSTEMTIME lazy_timeout_time;
+
 HANDLE RPCSS_GetMasterMutex() 
 {
   return master_mutex;
 }
 
-void RPCSS_SetMaxLazyTimeout(long mlt)
-{
-  /* FIXME: this max ensures that no caller will decrease our wait time,
-     but could have other bad results.  fix: Store "next_max_lazy_timeout" 
-     and install it as neccesary next time we "do work"? */
-  max_lazy_timeout = max(RPCSS_GetLazyTimeRemaining(), mlt);
-}
-
 long RPCSS_GetMaxLazyTimeout()
 {
   return max_lazy_timeout;
 }
 
-/* when do we just give up and bail? (UTC) */
-static SYSTEMTIME lazy_timeout_time;
-
 #if defined(NONAMELESSSTRUCT)
   #define FILETIME_TO_ULARGEINT(filetime, ularge) \
     ( ularge.s.LowPart = filetime.dwLowDateTime, \
@@ -153,18 +145,23 @@
 #undef ULARGEINT_TO_FILETIME
 #undef TEN_MIL
 
-BOOL RPCSS_work()
+BOOL RPCSS_Work()
 {
   return RPCSS_NPDoWork();
 }
 
-BOOL RPCSS_Empty()
+void RPCSS_SetMaxLazyTimeout(long mlt)
 {
-  BOOL rslt = TRUE;
-
-  rslt = RPCSS_EpmapEmpty();
+  /* FIXME: this max ensures that no caller will decrease our wait time,
+     but could have other bad results.  fix: Store "next_max_lazy_timeout" 
+     and install it as neccesary next time we "do work"? */
+  max_lazy_timeout = max(RPCSS_GetLazyTimeRemaining(), mlt);
+}
 
-  return rslt;
+BOOL RPCSS_Empty()
+{
+  /* for now the only datastructure we check is the endpoint map */
+  return RPCSS_EpmapEmpty();
 }
 
 BOOL RPCSS_ReadyToDie()
@@ -222,7 +219,7 @@
     did_something_new = FALSE;
 
     while ( (! did_something_new) && (! RPCSS_ReadyToDie()) )
-      did_something_new = (RPCSS_work() || did_something_new);
+      did_something_new = (RPCSS_Work() || did_something_new);
 
     if ((! did_something_new) && RPCSS_ReadyToDie())
       break; /* that's it for us */
diff -ur -x CVS -x 'bigdif*' -x autom4te.cache ../wine.test/programs/rpcss/rpcss_np_server.c ./programs/rpcss/rpcss_np_server.c
--- ../wine.test/programs/rpcss/rpcss_np_server.c	2002-12-02 01:34:58.000000000 -0600
+++ ./programs/rpcss/rpcss_np_server.c	2002-12-02 01:35:38.000000000 -0600
@@ -163,7 +163,7 @@
 }
 
 /* each message gets its own thread.  this is it. */
-VOID HandlerThread(LPVOID lpvPipeHandle)
+VOID RPCSS_HandlerThread(LPVOID lpvPipeHandle)
 {
   RPCSS_NP_MESSAGE msg, vardata_payload_msg;
   char *c, *vardata = NULL;
@@ -250,7 +250,7 @@
   InterlockedDecrement(&srv_thread_count);
 }
 
-VOID NPMainWorkThread(LPVOID ignored)
+VOID RPCSS_NPMainWorkThread(LPVOID ignored)
 {
   BOOL connected;
   HANDLE hthread, master_mutex = RPCSS_GetMasterMutex();
@@ -273,7 +273,7 @@
       hthread = CreateThread( 
         NULL,                      /* no security attribute */ 
         0,                         /* default stack size */
-        (LPTHREAD_START_ROUTINE) HandlerThread, 
+        (LPTHREAD_START_ROUTINE) RPCSS_HandlerThread, 
         (LPVOID) np_server_end,    /* thread parameter */
         0,                         /* not suspended */
         &threadid                  /* returns thread ID  (not used) */
@@ -304,7 +304,7 @@
         } else {
 	  /* now create a new named pipe instance to listen on */
           np_server_end = CreateNamedPipe(
-            NAME_RPCSS_NAMED_PIPE,                                 /* pipe name */
+            RPCSS_NAMED_PIPE_NAME,                                 /* pipe name */
             PIPE_ACCESS_DUPLEX,                                    /* pipe open mode */
             PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, /* pipe-specific modes */
             PIPE_UNLIMITED_INSTANCES,                              /* maximum instances */
@@ -357,7 +357,7 @@
 
     /* try to open the client side of the named pipe. */
     the_pipe = CreateFileA(
-      NAME_RPCSS_NAMED_PIPE,           /* pipe name */
+      RPCSS_NAMED_PIPE_NAME,           /* pipe name */
       GENERIC_READ | GENERIC_WRITE,    /* r/w access */
       0,                               /* no sharing */
       NULL,                            /* no security attributes */
@@ -371,7 +371,7 @@
 
     if (GetLastError() != ERROR_PIPE_BUSY) {
       WINE_WARN("Unable to open named pipe %s (assuming unavailable).\n", 
-        wine_dbgstr_a(NAME_RPCSS_NAMED_PIPE));
+        wine_dbgstr_a(RPCSS_NAMED_PIPE_NAME));
       the_pipe = NULL;
       break;
     }
@@ -383,7 +383,7 @@
 
     /* wait for the named pipe.  We are only 
        willing to wait only 5 seconds.  It should be available /very/ soon. */
-    if (! WaitNamedPipeA(NAME_RPCSS_NAMED_PIPE, MASTER_MUTEX_WAITNAMEDPIPE_TIMEOUT))
+    if (! WaitNamedPipeA(RPCSS_NAMED_PIPE_NAME, MASTER_MUTEX_WAITNAMEDPIPE_TIMEOUT))
     {
       WINE_ERR("Named pipe unavailable after waiting.  Something is probably wrong.\n");
       return NULL;
@@ -410,6 +410,8 @@
 
   WINE_TRACE("(np == %p, msg == %p, reply == %p)\n", np, msg, reply);
 
+  if (msg->vardata_payload_size) return FALSE;
+
   if (! WriteFile(np, msg, sizeof(RPCSS_NP_MESSAGE), &count, NULL)) {
     WINE_ERR("write failed.\n");
     return FALSE;
@@ -478,7 +480,7 @@
     rslt = FALSE;
   }
   if (rslt) {
-    np_server_work_event = CreateEventA(NULL, FALSE, FALSE, "RpcNpServerWorkEvent");
+    np_server_work_event = CreateEventA(NULL, FALSE, FALSE, RPCSS_NP_SERVER_WORK_EVENT_NAME);
     if (np_server_work_event == NULL) {
       /* dunno what we can do then */
       WINE_ERR("Unable to create the np_server_work_event\n");
@@ -487,7 +489,7 @@
     InitializeCriticalSection(&np_server_cs);
 
     np_server_end = CreateNamedPipe(
-      NAME_RPCSS_NAMED_PIPE,                                   /* pipe name */
+      RPCSS_NAMED_PIPE_NAME,                                   /* pipe name */
       PIPE_ACCESS_DUPLEX,                                      /* pipe open mode */
       PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,   /* pipe-specific modes */
       PIPE_UNLIMITED_INSTANCES,                                /* maximum number of instances */
@@ -515,7 +517,7 @@
     hthread = CreateThread( 
       NULL,                      /* no security attribute */ 
       0,                         /* default stack size */
-      (LPTHREAD_START_ROUTINE) NPMainWorkThread,
+      (LPTHREAD_START_ROUTINE) RPCSS_NPMainWorkThread,
       (LPVOID) NULL,             /* thread parameter */
       0,                         /* not suspended */
       &threadid                  /* returns thread ID  (not used) */
-- 
gmt



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux