Wine-20050111 vendor drop
Added: vendor/wine/dlls/rpcrt4/Wine-20050111/
Modified: vendor/wine/dlls/rpcrt4/Wine-20050111/ndr_midl.c
Modified: vendor/wine/dlls/rpcrt4/Wine-20050111/rpc_binding.c
Modified: vendor/wine/dlls/rpcrt4/Wine-20050111/rpc_message.c
Modified: vendor/wine/dlls/rpcrt4/Wine-20050111/rpc_server.c
Modified: vendor/wine/dlls/rpcrt4/Wine-20050111/rpcrt4.spec
Modified: vendor/wine/dlls/rpcrt4/Wine-20050111/rpcrt4_main.c
Modified: vendor/wine/dlls/rpcrt4/current/ndr_midl.c
Modified: vendor/wine/dlls/rpcrt4/current/rpc_binding.c
Modified: vendor/wine/dlls/rpcrt4/current/rpc_message.c
Modified: vendor/wine/dlls/rpcrt4/current/rpc_server.c
Modified: vendor/wine/dlls/rpcrt4/current/rpcrt4.spec
Modified: vendor/wine/dlls/rpcrt4/current/rpcrt4_main.c

Copied: vendor/wine/dlls/rpcrt4/Wine-20050111 (from rev 12927, vendor/wine/dlls/rpcrt4/current)

Modified: vendor/wine/dlls/rpcrt4/Wine-20050111/ndr_midl.c
--- vendor/wine/dlls/rpcrt4/current/ndr_midl.c	2005-01-11 20:23:48 UTC (rev 12927)
+++ vendor/wine/dlls/rpcrt4/Wine-20050111/ndr_midl.c	2005-01-12 19:26:13 UTC (rev 12978)
@@ -100,6 +100,13 @@
   HRESULT hr;
 
   TRACE("(%p,%p)\n", This, pStubMsg);
+
+  if (!pStubMsg->pRpcChannelBuffer)
+  {
+    WARN("Trying to use disconnected proxy %p\n", This);
+    RpcRaiseException(RPC_E_DISCONNECTED);
+  }
+
   pStubMsg->dwStubPhase = PROXY_SENDRECEIVE;
   hr = IRpcChannelBuffer_SendReceive(pStubMsg->pRpcChannelBuffer,
                                     (RPCOLEMESSAGE*)pStubMsg->RpcMsg,

Modified: vendor/wine/dlls/rpcrt4/Wine-20050111/rpc_binding.c
--- vendor/wine/dlls/rpcrt4/current/rpc_binding.c	2005-01-11 20:23:48 UTC (rev 12927)
+++ vendor/wine/dlls/rpcrt4/Wine-20050111/rpc_binding.c	2005-01-12 19:26:13 UTC (rev 12978)
@@ -96,7 +96,7 @@
 
 void RPCRT4_strfree(LPSTR src)
 {
-  if (src) HeapFree(GetProcessHeap(), 0, src);
+  HeapFree(GetProcessHeap(), 0, src);
 }
 
 RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPSTR Protseq, LPSTR NetworkAddr, LPSTR Endpoint, LPSTR NetworkOptions, RpcBinding* Binding)
@@ -147,7 +147,7 @@
                                          RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
         HeapFree(GetProcessHeap(), 0, pname);
         memset(&Connection->ovl, 0, sizeof(Connection->ovl));
-        Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
+        Connection->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
         if (!ConnectNamedPipe(Connection->conn, &Connection->ovl)) {
           WARN("Couldn't ConnectNamedPipe (error was %ld)\n", GetLastError());
           if (GetLastError() == ERROR_PIPE_CONNECTED) {
@@ -171,7 +171,7 @@
                                          RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
         HeapFree(GetProcessHeap(), 0, pname);
         memset(&Connection->ovl, 0, sizeof(Connection->ovl));
-        Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
+        Connection->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
         if (!ConnectNamedPipe(Connection->conn, &Connection->ovl)) {
           WARN("Couldn't ConnectNamedPipe (error was %ld)\n", GetLastError());
           if (GetLastError() == ERROR_PIPE_CONNECTED) {
@@ -223,7 +223,7 @@
         /* pipe is connected; change to message-read mode. */
         dwMode = PIPE_READMODE_MESSAGE; 
         SetNamedPipeHandleState(conn, &dwMode, NULL, NULL);
-        Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
+        Connection->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
         Connection->conn = conn;
       }
       /* protseq=ncacn_np: named pipes */
@@ -257,7 +257,7 @@
         /* pipe is connected; change to message-read mode. */
         dwMode = PIPE_READMODE_MESSAGE;
         SetNamedPipeHandleState(conn, &dwMode, NULL, NULL);
-        Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
+        Connection->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
         Connection->conn = conn;
       } else {
         ERR("protseq %s not supported\n", Connection->Protseq);

Modified: vendor/wine/dlls/rpcrt4/Wine-20050111/rpc_message.c
--- vendor/wine/dlls/rpcrt4/current/rpc_message.c	2005-01-11 20:23:48 UTC (rev 12927)
+++ vendor/wine/dlls/rpcrt4/Wine-20050111/rpc_message.c	2005-01-12 19:26:13 UTC (rev 12978)
@@ -447,8 +447,7 @@
      * it, we'll leave deallocating the original buffer to the RPC server */
     pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->BufferLength);
   } else {
-    if (pMsg->Buffer)
-        HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
+    HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
     pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->BufferLength);
   }
   TRACE("Buffer=%p\n", pMsg->Buffer);
@@ -463,9 +462,7 @@
 {
   TRACE("(%p) Buffer=%p\n", pMsg, pMsg->Buffer);
   /* FIXME: pfnFree? */
-  if (pMsg->Buffer != NULL) {
-    HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
-  }
+  HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
   pMsg->Buffer = NULL;
   return S_OK;
 }

Modified: vendor/wine/dlls/rpcrt4/Wine-20050111/rpc_server.c
--- vendor/wine/dlls/rpcrt4/current/rpc_server.c	2005-01-11 20:23:48 UTC (rev 12927)
+++ vendor/wine/dlls/rpcrt4/Wine-20050111/rpc_server.c	2005-01-12 19:26:13 UTC (rev 12978)
@@ -422,7 +422,7 @@
 #endif
     msg = NULL;
   }
-  if (msg) HeapFree(GetProcessHeap(), 0, msg);
+  HeapFree(GetProcessHeap(), 0, msg);
   RPCRT4_DestroyConnection(conn);
   return 0;
 }
@@ -542,8 +542,8 @@
 
   EnterCriticalSection(&listen_cs);
   if (! ++listen_count) {
-    if (!mgr_event) mgr_event = CreateEventA(NULL, TRUE, FALSE, NULL);
-    if (!server_sem) server_sem = CreateSemaphoreA(NULL, 0, MAX_THREADS, NULL);
+    if (!mgr_event) mgr_event = CreateEventW(NULL, TRUE, FALSE, NULL);
+    if (!server_sem) server_sem = CreateSemaphoreW(NULL, 0, MAX_THREADS, NULL);
     if (!worker_tls) worker_tls = TlsAlloc();
     std_listen = TRUE;
     server_thread = CreateThread(NULL, 0, RPCRT4_server_thread, NULL, 0, NULL);

Modified: vendor/wine/dlls/rpcrt4/Wine-20050111/rpcrt4.spec
--- vendor/wine/dlls/rpcrt4/current/rpcrt4.spec	2005-01-11 20:23:48 UTC (rev 12927)
+++ vendor/wine/dlls/rpcrt4/Wine-20050111/rpcrt4.spec	2005-01-12 19:26:13 UTC (rev 12978)
@@ -1,5 +1,5 @@
-@ stub DceErrorInqTextA
-@ stub DceErrorInqTextW
+@ stdcall DceErrorInqTextA (long ptr)
+@ stdcall DceErrorInqTextW (long ptr)
 @ stdcall -private DllRegisterServer() RPCRT4_DllRegisterServer
 
 @ stub MesBufferHandleReset

Modified: vendor/wine/dlls/rpcrt4/Wine-20050111/rpcrt4_main.c
--- vendor/wine/dlls/rpcrt4/current/rpcrt4_main.c	2005-01-11 20:23:48 UTC (rev 12927)
+++ vendor/wine/dlls/rpcrt4/Wine-20050111/rpcrt4_main.c	2005-01-12 19:26:13 UTC (rev 12978)
@@ -748,3 +748,53 @@
 
     return TRUE;
 }
+
+/* DceErrorInqText
+ *
+ * Notes
+ * 1. On passing a NULL pointer the code does bomb out.
+ * 2. The size of the required buffer is not defined in the documentation.
+ *    It appears to be 256.
+ * 3. The function is defined to return RPC_S_INVALID_ARG but I don't know
+ *    of any value for which it does.
+ * 4. The MSDN documentation currently declares that the second argument is
+ *    unsigned char *, even for the W version.  I don't believe it.
+ */
+
+#define MAX_RPC_ERROR_TEXT 256
+
+RPC_STATUS RPC_ENTRY DceErrorInqTextW (unsigned long e, unsigned short *buffer)
+{
+    DWORD count;
+    count = FormatMessageW (FORMAT_MESSAGE_FROM_SYSTEM |
+                FORMAT_MESSAGE_IGNORE_INSERTS,
+                NULL, e, 0, buffer, MAX_RPC_ERROR_TEXT, NULL);
+    if (!count)
+    {
+        count = FormatMessageW (FORMAT_MESSAGE_FROM_SYSTEM |
+                FORMAT_MESSAGE_IGNORE_INSERTS,
+                NULL, RPC_S_NOT_RPC_ERROR, 0, buffer, MAX_RPC_ERROR_TEXT, NULL);
+        if (!count)
+        {
+            ERR ("Failed to translate error");
+            return RPC_S_INVALID_ARG;
+        }
+    }
+    return RPC_S_OK;
+}
+
+RPC_STATUS RPC_ENTRY DceErrorInqTextA (unsigned long e, unsigned char *buffer)
+{
+    RPC_STATUS status;
+    WCHAR bufferW [MAX_RPC_ERROR_TEXT];
+    if ((status = DceErrorInqTextW (e, bufferW)) == RPC_S_OK)
+    {
+        if (!WideCharToMultiByte(CP_ACP, 0, bufferW, -1, buffer, MAX_RPC_ERROR_TEXT,
+                NULL, NULL))
+        {
+            ERR ("Failed to translate error");
+            status = RPC_S_INVALID_ARG;
+        }
+    }
+    return status;
+}

Modified: vendor/wine/dlls/rpcrt4/current/ndr_midl.c
--- vendor/wine/dlls/rpcrt4/current/ndr_midl.c	2005-01-12 19:25:54 UTC (rev 12977)
+++ vendor/wine/dlls/rpcrt4/current/ndr_midl.c	2005-01-12 19:26:13 UTC (rev 12978)
@@ -100,6 +100,13 @@
   HRESULT hr;
 
   TRACE("(%p,%p)\n", This, pStubMsg);
+
+  if (!pStubMsg->pRpcChannelBuffer)
+  {
+    WARN("Trying to use disconnected proxy %p\n", This);
+    RpcRaiseException(RPC_E_DISCONNECTED);
+  }
+
   pStubMsg->dwStubPhase = PROXY_SENDRECEIVE;
   hr = IRpcChannelBuffer_SendReceive(pStubMsg->pRpcChannelBuffer,
                                     (RPCOLEMESSAGE*)pStubMsg->RpcMsg,

Modified: vendor/wine/dlls/rpcrt4/current/rpc_binding.c
--- vendor/wine/dlls/rpcrt4/current/rpc_binding.c	2005-01-12 19:25:54 UTC (rev 12977)
+++ vendor/wine/dlls/rpcrt4/current/rpc_binding.c	2005-01-12 19:26:13 UTC (rev 12978)
@@ -96,7 +96,7 @@
 
 void RPCRT4_strfree(LPSTR src)
 {
-  if (src) HeapFree(GetProcessHeap(), 0, src);
+  HeapFree(GetProcessHeap(), 0, src);
 }
 
 RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPSTR Protseq, LPSTR NetworkAddr, LPSTR Endpoint, LPSTR NetworkOptions, RpcBinding* Binding)
@@ -147,7 +147,7 @@
                                          RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
         HeapFree(GetProcessHeap(), 0, pname);
         memset(&Connection->ovl, 0, sizeof(Connection->ovl));
-        Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
+        Connection->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
         if (!ConnectNamedPipe(Connection->conn, &Connection->ovl)) {
           WARN("Couldn't ConnectNamedPipe (error was %ld)\n", GetLastError());
           if (GetLastError() == ERROR_PIPE_CONNECTED) {
@@ -171,7 +171,7 @@
                                          RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
         HeapFree(GetProcessHeap(), 0, pname);
         memset(&Connection->ovl, 0, sizeof(Connection->ovl));
-        Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
+        Connection->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
         if (!ConnectNamedPipe(Connection->conn, &Connection->ovl)) {
           WARN("Couldn't ConnectNamedPipe (error was %ld)\n", GetLastError());
           if (GetLastError() == ERROR_PIPE_CONNECTED) {
@@ -223,7 +223,7 @@
         /* pipe is connected; change to message-read mode. */
         dwMode = PIPE_READMODE_MESSAGE; 
         SetNamedPipeHandleState(conn, &dwMode, NULL, NULL);
-        Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
+        Connection->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
         Connection->conn = conn;
       }
       /* protseq=ncacn_np: named pipes */
@@ -257,7 +257,7 @@
         /* pipe is connected; change to message-read mode. */
         dwMode = PIPE_READMODE_MESSAGE;
         SetNamedPipeHandleState(conn, &dwMode, NULL, NULL);
-        Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
+        Connection->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
         Connection->conn = conn;
       } else {
         ERR("protseq %s not supported\n", Connection->Protseq);

Modified: vendor/wine/dlls/rpcrt4/current/rpc_message.c
--- vendor/wine/dlls/rpcrt4/current/rpc_message.c	2005-01-12 19:25:54 UTC (rev 12977)
+++ vendor/wine/dlls/rpcrt4/current/rpc_message.c	2005-01-12 19:26:13 UTC (rev 12978)
@@ -447,8 +447,7 @@
      * it, we'll leave deallocating the original buffer to the RPC server */
     pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->BufferLength);
   } else {
-    if (pMsg->Buffer)
-        HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
+    HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
     pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->BufferLength);
   }
   TRACE("Buffer=%p\n", pMsg->Buffer);
@@ -463,9 +462,7 @@
 {
   TRACE("(%p) Buffer=%p\n", pMsg, pMsg->Buffer);
   /* FIXME: pfnFree? */
-  if (pMsg->Buffer != NULL) {
-    HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
-  }
+  HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
   pMsg->Buffer = NULL;
   return S_OK;
 }

Modified: vendor/wine/dlls/rpcrt4/current/rpc_server.c
--- vendor/wine/dlls/rpcrt4/current/rpc_server.c	2005-01-12 19:25:54 UTC (rev 12977)
+++ vendor/wine/dlls/rpcrt4/current/rpc_server.c	2005-01-12 19:26:13 UTC (rev 12978)
@@ -422,7 +422,7 @@
 #endif
     msg = NULL;
   }
-  if (msg) HeapFree(GetProcessHeap(), 0, msg);
+  HeapFree(GetProcessHeap(), 0, msg);
   RPCRT4_DestroyConnection(conn);
   return 0;
 }
@@ -542,8 +542,8 @@
 
   EnterCriticalSection(&listen_cs);
   if (! ++listen_count) {
-    if (!mgr_event) mgr_event = CreateEventA(NULL, TRUE, FALSE, NULL);
-    if (!server_sem) server_sem = CreateSemaphoreA(NULL, 0, MAX_THREADS, NULL);
+    if (!mgr_event) mgr_event = CreateEventW(NULL, TRUE, FALSE, NULL);
+    if (!server_sem) server_sem = CreateSemaphoreW(NULL, 0, MAX_THREADS, NULL);
     if (!worker_tls) worker_tls = TlsAlloc();
     std_listen = TRUE;
     server_thread = CreateThread(NULL, 0, RPCRT4_server_thread, NULL, 0, NULL);

Modified: vendor/wine/dlls/rpcrt4/current/rpcrt4.spec
--- vendor/wine/dlls/rpcrt4/current/rpcrt4.spec	2005-01-12 19:25:54 UTC (rev 12977)
+++ vendor/wine/dlls/rpcrt4/current/rpcrt4.spec	2005-01-12 19:26:13 UTC (rev 12978)
@@ -1,5 +1,5 @@
-@ stub DceErrorInqTextA
-@ stub DceErrorInqTextW
+@ stdcall DceErrorInqTextA (long ptr)
+@ stdcall DceErrorInqTextW (long ptr)
 @ stdcall -private DllRegisterServer() RPCRT4_DllRegisterServer
 
 @ stub MesBufferHandleReset

Modified: vendor/wine/dlls/rpcrt4/current/rpcrt4_main.c
--- vendor/wine/dlls/rpcrt4/current/rpcrt4_main.c	2005-01-12 19:25:54 UTC (rev 12977)
+++ vendor/wine/dlls/rpcrt4/current/rpcrt4_main.c	2005-01-12 19:26:13 UTC (rev 12978)
@@ -748,3 +748,53 @@
 
     return TRUE;
 }
+
+/* DceErrorInqText
+ *
+ * Notes
+ * 1. On passing a NULL pointer the code does bomb out.
+ * 2. The size of the required buffer is not defined in the documentation.
+ *    It appears to be 256.
+ * 3. The function is defined to return RPC_S_INVALID_ARG but I don't know
+ *    of any value for which it does.
+ * 4. The MSDN documentation currently declares that the second argument is
+ *    unsigned char *, even for the W version.  I don't believe it.
+ */
+
+#define MAX_RPC_ERROR_TEXT 256
+
+RPC_STATUS RPC_ENTRY DceErrorInqTextW (unsigned long e, unsigned short *buffer)
+{
+    DWORD count;
+    count = FormatMessageW (FORMAT_MESSAGE_FROM_SYSTEM |
+                FORMAT_MESSAGE_IGNORE_INSERTS,
+                NULL, e, 0, buffer, MAX_RPC_ERROR_TEXT, NULL);
+    if (!count)
+    {
+        count = FormatMessageW (FORMAT_MESSAGE_FROM_SYSTEM |
+                FORMAT_MESSAGE_IGNORE_INSERTS,
+                NULL, RPC_S_NOT_RPC_ERROR, 0, buffer, MAX_RPC_ERROR_TEXT, NULL);
+        if (!count)
+        {
+            ERR ("Failed to translate error");
+            return RPC_S_INVALID_ARG;
+        }
+    }
+    return RPC_S_OK;
+}
+
+RPC_STATUS RPC_ENTRY DceErrorInqTextA (unsigned long e, unsigned char *buffer)
+{
+    RPC_STATUS status;
+    WCHAR bufferW [MAX_RPC_ERROR_TEXT];
+    if ((status = DceErrorInqTextW (e, bufferW)) == RPC_S_OK)
+    {
+        if (!WideCharToMultiByte(CP_ACP, 0, bufferW, -1, buffer, MAX_RPC_ERROR_TEXT,
+                NULL, NULL))
+        {
+            ERR ("Failed to translate error");
+            status = RPC_S_INVALID_ARG;
+        }
+    }
+    return status;
+}