Sync to Wine-20050725:
Francois Gouget <fgouget@free.fr>
- Fix the NdrVaryingArrayUnmarshall prototype (reported by
  winapi_check).
- Assorted spelling fixes.
Robert Shearman <rob@codeweavers.com>
- Add stubs for most of the NDR marshaling functions.
- IRpcStubBuffer_Disconnect can be called more than once.
Mike McCormack <mike@codeweavers.com>
- Interlocked LONG* gcc warning fixes.
Stefan Huehner <stefan@huehner.org>
- Fix -Wmissing-declarations warnings.
- Fix some missing-declarations warnings.
Modified: trunk/reactos/lib/rpcrt4/cstub.c
Modified: trunk/reactos/lib/rpcrt4/ndr_marshall.c
Modified: trunk/reactos/lib/rpcrt4/ndr_ole.c
Modified: trunk/reactos/lib/rpcrt4/rpc_binding.c
Modified: trunk/reactos/lib/rpcrt4/rpc_binding.h
Modified: trunk/reactos/lib/rpcrt4/rpc_message.c
Modified: trunk/reactos/lib/rpcrt4/rpc_message.h
Modified: trunk/reactos/lib/rpcrt4/rpc_server.c
Modified: trunk/reactos/lib/rpcrt4/rpcrt4.spec
Modified: trunk/reactos/lib/rpcrt4/rpcrt4_main.c

Modified: trunk/reactos/lib/rpcrt4/cstub.c
--- trunk/reactos/lib/rpcrt4/cstub.c	2005-08-12 17:43:23 UTC (rev 17336)
+++ trunk/reactos/lib/rpcrt4/cstub.c	2005-08-12 17:50:33 UTC (rev 17337)
@@ -100,8 +100,7 @@
   TRACE("(%p)->Release()\n",This);
 
   if (!--(This->RefCount)) {
-    if(This->pvServerObject)
-        IUnknown_Release(This->pvServerObject);
+    IRpcStubBuffer_Disconnect(iface);
     if(This->pPSFactory)
         IPSFactoryBuffer_Release(This->pPSFactory);
     HeapFree(GetProcessHeap(),0,This);
@@ -123,7 +122,11 @@
 {
   CStdStubBuffer *This = (CStdStubBuffer *)iface;
   TRACE("(%p)->Disconnect()\n",This);
-  This->pvServerObject = NULL;
+  if (This->pvServerObject)
+  {
+    IUnknown_Release(This->pvServerObject);
+    This->pvServerObject = NULL;
+  }
 }
 
 HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface,

Modified: trunk/reactos/lib/rpcrt4/ndr_marshall.c
--- trunk/reactos/lib/rpcrt4/ndr_marshall.c	2005-08-12 17:43:23 UTC (rev 17336)
+++ trunk/reactos/lib/rpcrt4/ndr_marshall.c	2005-08-12 17:50:33 UTC (rev 17337)
@@ -114,16 +114,23 @@
   NdrPointerMarshall, NdrPointerMarshall,
   /* 0x15 */
   NdrSimpleStructMarshall, NdrSimpleStructMarshall,
-  0, 0, 0,
+  NdrConformantStructMarshall, NdrConformantStructMarshall,
+  NdrConformantVaryingStructMarshall,
   NdrComplexStructMarshall,
   /* 0x1b */
-  NdrConformantArrayMarshall, 0, 0, 0, 0, 0,
+  NdrConformantArrayMarshall, 
+  NdrConformantVaryingArrayMarshall,
+  NdrFixedArrayMarshall, NdrFixedArrayMarshall,
+  NdrVaryingArrayMarshall, NdrVaryingArrayMarshall,
   NdrComplexArrayMarshall,
   /* 0x22 */
   NdrConformantStringMarshall, 0, 0,
   NdrConformantStringMarshall, 0, 0, 0, 0,
   /* 0x2a */
-  0, 0, 0, 0, 0,
+  NdrEncapsulatedUnionMarshall,
+  NdrNonEncapsulatedUnionMarshall,
+  0,
+  NdrXmitOrRepAsMarshall, NdrXmitOrRepAsMarshall,
   /* 0x2f */
   NdrInterfacePointerMarshall,
   /* 0xb0 */
@@ -140,16 +147,23 @@
   NdrPointerUnmarshall, NdrPointerUnmarshall,
   /* 0x15 */
   NdrSimpleStructUnmarshall, NdrSimpleStructUnmarshall,
-  0, 0, 0,
+  NdrConformantStructUnmarshall, NdrConformantStructUnmarshall,
+  NdrConformantVaryingStructUnmarshall,
   NdrComplexStructUnmarshall,
   /* 0x1b */
-  NdrConformantArrayUnmarshall, 0, 0, 0, 0, 0,
+  NdrConformantArrayUnmarshall, 
+  NdrConformantVaryingArrayUnmarshall,
+  NdrFixedArrayUnmarshall, NdrFixedArrayUnmarshall,
+  NdrVaryingArrayUnmarshall, NdrVaryingArrayUnmarshall,
   NdrComplexArrayUnmarshall,
   /* 0x22 */
   NdrConformantStringUnmarshall, 0, 0,
   NdrConformantStringUnmarshall, 0, 0, 0, 0,
   /* 0x2a */
-  0, 0, 0, 0, 0,
+  NdrEncapsulatedUnionUnmarshall,
+  NdrNonEncapsulatedUnionUnmarshall,
+  0,
+  NdrXmitOrRepAsUnmarshall, NdrXmitOrRepAsUnmarshall,
   /* 0x2f */
   NdrInterfacePointerUnmarshall,
   /* 0xb0 */
@@ -166,16 +180,23 @@
   NdrPointerBufferSize, NdrPointerBufferSize,
   /* 0x15 */
   NdrSimpleStructBufferSize, NdrSimpleStructBufferSize,
-  0, 0, 0,
+  NdrConformantStructBufferSize, NdrConformantStructBufferSize,
+  NdrConformantVaryingStructBufferSize,
   NdrComplexStructBufferSize,
   /* 0x1b */
-  NdrConformantArrayBufferSize, 0, 0, 0, 0, 0,
+  NdrConformantArrayBufferSize, 
+  NdrConformantVaryingArrayBufferSize,
+  NdrFixedArrayBufferSize, NdrFixedArrayBufferSize,
+  NdrVaryingArrayBufferSize, NdrVaryingArrayBufferSize,
   NdrComplexArrayBufferSize,
   /* 0x22 */
   NdrConformantStringBufferSize, 0, 0,
   NdrConformantStringBufferSize, 0, 0, 0, 0,
   /* 0x2a */
-  0, 0, 0, 0, 0,
+  NdrEncapsulatedUnionBufferSize,
+  NdrNonEncapsulatedUnionBufferSize,
+  0,
+  NdrXmitOrRepAsBufferSize, NdrXmitOrRepAsBufferSize,
   /* 0x2f */
   NdrInterfacePointerBufferSize,
   /* 0xb0 */
@@ -218,15 +239,23 @@
   NdrPointerFree, NdrPointerFree,
   /* 0x15 */
   NdrSimpleStructFree, NdrSimpleStructFree,
-  0, 0, 0,
+  NdrConformantStructFree, NdrConformantStructFree,
+  NdrConformantVaryingStructFree,
   NdrComplexStructFree,
   /* 0x1b */
-  NdrConformantArrayFree, 0, 0, 0, 0, 0,
+  NdrConformantArrayFree, 
+  NdrConformantVaryingArrayFree,
+  NdrFixedArrayFree, NdrFixedArrayFree,
+  NdrVaryingArrayFree, NdrVaryingArrayFree,
   NdrComplexArrayFree,
   /* 0x22 */
-  0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0,
+  0, 0, 0, 0, 0,
   /* 0x2a */
-  0, 0, 0, 0, 0,
+  NdrEncapsulatedUnionFree,
+  NdrNonEncapsulatedUnionFree,
+  0,
+  NdrXmitOrRepAsFree, NdrXmitOrRepAsFree,
   /* 0x2f */
   NdrInterfacePointerFree,
   /* 0xb0 */
@@ -2191,3 +2220,447 @@
   /* FIXME: since this stub doesn't do any converting, the proper behavior
      is to raise an exception */
 }
+
+/***********************************************************************
+ *           NdrConformantStructMarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrConformantStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrConformantStructUnmarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char **ppMemory,
+                                PFORMAT_STRING pFormat,
+                                unsigned char fMustAlloc)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrConformantStructBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrConformantStructMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrConformantStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return 0;
+}
+
+/***********************************************************************
+ *           NdrConformantStructFree [RPCRT4.@]
+ */
+void WINAPI NdrConformantStructFree(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrConformantVaryingStructMarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrConformantVaryingStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrConformantVaryingStructUnmarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char **ppMemory,
+                                PFORMAT_STRING pFormat,
+                                unsigned char fMustAlloc)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrConformantVaryingStructBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrConformantVaryingStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrConformantVaryingStructMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrConformantVaryingStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return 0;
+}
+
+/***********************************************************************
+ *           NdrConformantVaryingStructFree [RPCRT4.@]
+ */
+void WINAPI NdrConformantVaryingStructFree(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrFixedArrayMarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrFixedArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrFixedArrayUnmarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrFixedArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char **ppMemory,
+                                PFORMAT_STRING pFormat,
+                                unsigned char fMustAlloc)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrFixedArrayBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrFixedArrayMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrFixedArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return 0;
+}
+
+/***********************************************************************
+ *           NdrFixedArrayFree [RPCRT4.@]
+ */
+void WINAPI NdrFixedArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrVaryingArrayMarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrVaryingArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrVaryingArrayUnmarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrVaryingArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char **ppMemory,
+                                PFORMAT_STRING pFormat,
+                                unsigned char fMustAlloc)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrVaryingArrayBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrVaryingArrayMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrVaryingArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return 0;
+}
+
+/***********************************************************************
+ *           NdrVaryingArrayFree [RPCRT4.@]
+ */
+void WINAPI NdrVaryingArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrEncapsulatedUnionMarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrEncapsulatedUnionUnmarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char **ppMemory,
+                                PFORMAT_STRING pFormat,
+                                unsigned char fMustAlloc)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrEncapsulatedUnionBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrEncapsulatedUnionMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return 0;
+}
+
+/***********************************************************************
+ *           NdrEncapsulatedUnionFree [RPCRT4.@]
+ */
+void WINAPI NdrEncapsulatedUnionFree(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrNonEncapsulatedUnionMarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrNonEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrNonEncapsulatedUnionUnmarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrNonEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char **ppMemory,
+                                PFORMAT_STRING pFormat,
+                                unsigned char fMustAlloc)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrNonEncapsulatedUnionBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrNonEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrNonEncapsulatedUnionMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrNonEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return 0;
+}
+
+/***********************************************************************
+ *           NdrNonEncapsulatedUnionFree [RPCRT4.@]
+ */
+void WINAPI NdrNonEncapsulatedUnionFree(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrByteCountPointerMarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrByteCountPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrByteCountPointerUnmarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrByteCountPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char **ppMemory,
+                                PFORMAT_STRING pFormat,
+                                unsigned char fMustAlloc)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrByteCountPointerBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrByteCountPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrByteCountPointerMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrByteCountPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return 0;
+}
+
+/***********************************************************************
+ *           NdrByteCountPointerFree [RPCRT4.@]
+ */
+void WINAPI NdrByteCountPointerFree(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrXmitOrRepAsMarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrXmitOrRepAsMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrXmitOrRepAsUnmarshall [RPCRT4.@]
+ */
+unsigned char *  WINAPI NdrXmitOrRepAsUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char **ppMemory,
+                                PFORMAT_STRING pFormat,
+                                unsigned char fMustAlloc)
+{
+    FIXME("stub\n");
+    return NULL;
+}
+
+/***********************************************************************
+ *           NdrXmitOrRepAsBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrXmitOrRepAsBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrXmitOrRepAsMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrXmitOrRepAsMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+    return 0;
+}
+
+/***********************************************************************
+ *           NdrXmitOrRepAsFree [RPCRT4.@]
+ */
+void WINAPI NdrXmitOrRepAsFree(PMIDL_STUB_MESSAGE pStubMsg,
+                                unsigned char *pMemory,
+                                PFORMAT_STRING pFormat)
+{
+    FIXME("stub\n");
+}
+
+/***********************************************************************
+ *           NdrClientContextMarshall
+ */
+void WINAPI NdrClientContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                     NDR_CCONTEXT ContextHandle,
+                                     int fCheck)
+{
+    FIXME("(%p, %p, %d): stub\n", pStubMsg, ContextHandle, fCheck);
+}
+
+/***********************************************************************
+ *           NdrClientContextUnmarshall
+ */
+void WINAPI NdrClientContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+                                  NDR_CCONTEXT * pContextHandle,
+                                  RPC_BINDING_HANDLE BindHandle)
+{
+    FIXME("(%p, %p, %p): stub\n", pStubMsg, pContextHandle, BindHandle);
+}

Modified: trunk/reactos/lib/rpcrt4/ndr_ole.c
--- trunk/reactos/lib/rpcrt4/ndr_ole.c	2005-08-12 17:43:23 UTC (rev 17336)
+++ trunk/reactos/lib/rpcrt4/ndr_ole.c	2005-08-12 17:50:33 UTC (rev 17337)
@@ -223,7 +223,7 @@
   return (LPSTREAM)This;
 }
 
-const IID* get_ip_iid(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
+static const IID* get_ip_iid(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 {
   const IID *riid;
   if (!pFormat) return &IID_IUnknown;

Modified: trunk/reactos/lib/rpcrt4/rpc_binding.c
--- trunk/reactos/lib/rpcrt4/rpc_binding.c	2005-08-12 17:43:23 UTC (rev 17336)
+++ trunk/reactos/lib/rpcrt4/rpc_binding.c	2005-08-12 17:50:33 UTC (rev 17337)
@@ -312,7 +312,7 @@
   return err;
 }
 
-RPC_STATUS RPCRT4_AllocBinding(RpcBinding** Binding, BOOL server)
+static RPC_STATUS RPCRT4_AllocBinding(RpcBinding** Binding, BOOL server)
 {
   RpcBinding* NewBinding;
 

Modified: trunk/reactos/lib/rpcrt4/rpc_binding.h
--- trunk/reactos/lib/rpcrt4/rpc_binding.h	2005-08-12 17:43:23 UTC (rev 17336)
+++ trunk/reactos/lib/rpcrt4/rpc_binding.h	2005-08-12 17:50:33 UTC (rev 17337)
@@ -41,7 +41,7 @@
 /* don't know what MS's structure looks like */
 typedef struct _RpcBinding
 {
-  DWORD refs;
+  LONG refs;
   struct _RpcBinding* Next;
   BOOL server;
   UUID ObjectUuid;

Modified: trunk/reactos/lib/rpcrt4/rpc_message.c
--- trunk/reactos/lib/rpcrt4/rpc_message.c	2005-08-12 17:43:23 UTC (rev 17336)
+++ trunk/reactos/lib/rpcrt4/rpc_message.c	2005-08-12 17:50:33 UTC (rev 17337)
@@ -41,10 +41,11 @@
 #include "rpc_binding.h"
 #include "rpc_misc.h"
 #include "rpc_defs.h"
+#include "rpc_message.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(rpc);
 
-DWORD RPCRT4_GetHeaderSize(RpcPktHdr *Header)
+static DWORD RPCRT4_GetHeaderSize(RpcPktHdr *Header)
 {
   static const DWORD header_sizes[] = {
     sizeof(Header->request), 0, sizeof(Header->response),
@@ -67,7 +68,7 @@
   return ret;
 }
 
-VOID RPCRT4_BuildCommonHeader(RpcPktHdr *Header, unsigned char PacketType,
+static VOID RPCRT4_BuildCommonHeader(RpcPktHdr *Header, unsigned char PacketType,
                               unsigned long DataRepresentation)
 {
   Header->common.rpc_ver = RPC_VER_MAJOR;
@@ -83,7 +84,7 @@
   /* Flags and fragment length are computed in RPCRT4_Send. */
 }                              
 
-RpcPktHdr *RPCRT4_BuildRequestHeader(unsigned long DataRepresentation,
+static RpcPktHdr *RPCRT4_BuildRequestHeader(unsigned long DataRepresentation,
                                      unsigned long BufferLength,
                                      unsigned short ProcNum,
                                      UUID *ObjectUuid)
@@ -113,7 +114,7 @@
   return header;
 }
 
-RpcPktHdr *RPCRT4_BuildResponseHeader(unsigned long DataRepresentation,
+static RpcPktHdr *RPCRT4_BuildResponseHeader(unsigned long DataRepresentation,
                                       unsigned long BufferLength)
 {
   RpcPktHdr *header;

Modified: trunk/reactos/lib/rpcrt4/rpc_message.h
--- trunk/reactos/lib/rpcrt4/rpc_message.h	2005-08-12 17:43:23 UTC (rev 17336)
+++ trunk/reactos/lib/rpcrt4/rpc_message.h	2005-08-12 17:50:33 UTC (rev 17337)
@@ -24,9 +24,6 @@
 #include "wine/rpcss_shared.h"
 #include "rpc_defs.h"
 
-VOID RPCRT4_BuildCommonHeader(RpcPktHdr *Header, unsigned char PacketType, unsigned long DataRepresentation);
-RpcPktHdr *RPCRT4_BuildRequestHeader(unsigned long DataRepresentation, unsigned long BufferLength, unsigned short ProcNum, UUID *ObjectUuid);
-RpcPktHdr *RPCRT4_BuildResponseHeader(unsigned long DataRepresentation, unsigned long BufferLength);
 RpcPktHdr *RPCRT4_BuildFaultHeader(unsigned long DataRepresentation, RPC_STATUS Status);
 RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, RPC_SYNTAX_IDENTIFIER *AbstractId, RPC_SYNTAX_IDENTIFIER *TransferId);
 RpcPktHdr *RPCRT4_BuildBindNackHeader(unsigned long DataRepresentation, unsigned char RpcVersion, unsigned char RpcVersionMinor);

Modified: trunk/reactos/lib/rpcrt4/rpc_server.c
--- trunk/reactos/lib/rpcrt4/rpc_server.c	2005-08-12 17:43:23 UTC (rev 17336)
+++ trunk/reactos/lib/rpcrt4/rpc_server.c	2005-08-12 17:50:33 UTC (rev 17337)
@@ -117,7 +117,7 @@
 static RpcPacket* spacket_tail;
 static HANDLE server_sem;
 
-static DWORD worker_count, worker_free, worker_tls;
+static LONG worker_count, worker_free, worker_tls;
 
 static UUID uuid_nil;
 

Modified: trunk/reactos/lib/rpcrt4/rpcrt4.spec
--- trunk/reactos/lib/rpcrt4/rpcrt4.spec	2005-08-12 17:43:23 UTC (rev 17336)
+++ trunk/reactos/lib/rpcrt4/rpcrt4.spec	2005-08-12 17:50:33 UTC (rev 17337)
@@ -150,17 +150,17 @@
 @ stdcall NdrAllocate(ptr long)
 @ stub NdrAsyncClientCall
 @ stub NdrAsyncServerCall
-@ stub NdrByteCountPointerBufferSize
-@ stub NdrByteCountPointerFree
-@ stub NdrByteCountPointerMarshall
-@ stub NdrByteCountPointerUnmarshall
+@ stdcall NdrByteCountPointerBufferSize(ptr ptr ptr)
+@ stdcall NdrByteCountPointerFree(ptr ptr ptr)
+@ stdcall NdrByteCountPointerMarshall(ptr ptr ptr)
+@ stdcall NdrByteCountPointerUnmarshall(ptr ptr ptr long)
 @ stub NdrCStdStubBuffer2_Release
 @ stdcall NdrCStdStubBuffer_Release(ptr ptr)
 @ stdcall NdrClearOutParameters(ptr ptr ptr)
 @ varargs NdrClientCall2(ptr ptr)
 @ stub NdrClientCall
-@ stub NdrClientContextMarshall
-@ stub NdrClientContextUnmarshall
+@ stdcall NdrClientContextMarshall(ptr ptr long)
+@ stdcall NdrClientContextUnmarshall(ptr ptr ptr)
 @ stub NdrClientInitialize
 @ stdcall NdrClientInitializeNew(ptr ptr ptr long)
 @ stdcall NdrComplexArrayBufferSize(ptr ptr ptr)
@@ -182,21 +182,21 @@
 @ stdcall NdrConformantStringMarshall(ptr ptr ptr)
 @ stdcall NdrConformantStringMemorySize(ptr ptr)
 @ stdcall NdrConformantStringUnmarshall(ptr ptr ptr long)
-@ stub NdrConformantStructBufferSize
-@ stub NdrConformantStructFree
-@ stub NdrConformantStructMarshall
-@ stub NdrConformantStructMemorySize
-@ stub NdrConformantStructUnmarshall
+@ stdcall NdrConformantStructBufferSize(ptr ptr ptr)
+@ stdcall NdrConformantStructFree(ptr ptr ptr)
+@ stdcall NdrConformantStructMarshall(ptr ptr ptr)
+@ stdcall NdrConformantStructMemorySize(ptr ptr)
+@ stdcall NdrConformantStructUnmarshall(ptr ptr ptr long)
 @ stdcall NdrConformantVaryingArrayBufferSize(ptr ptr ptr)
 @ stdcall NdrConformantVaryingArrayFree(ptr ptr ptr)
 @ stdcall NdrConformantVaryingArrayMarshall(ptr ptr ptr)
 @ stdcall NdrConformantVaryingArrayMemorySize(ptr ptr)
 @ stdcall NdrConformantVaryingArrayUnmarshall(ptr ptr ptr long)
-@ stub NdrConformantVaryingStructBufferSize
-@ stub NdrConformantVaryingStructFree
-@ stub NdrConformantVaryingStructMarshall
-@ stub NdrConformantVaryingStructMemorySize
-@ stub NdrConformantVaryingStructUnmarshall
+@ stdcall NdrConformantVaryingStructBufferSize(ptr ptr ptr)
+@ stdcall NdrConformantVaryingStructFree(ptr ptr ptr)
+@ stdcall NdrConformantVaryingStructMarshall(ptr ptr ptr)
+@ stdcall NdrConformantVaryingStructMemorySize(ptr ptr)
+@ stdcall NdrConformantVaryingStructUnmarshall(ptr ptr ptr long)
 @ stub NdrContextHandleInitialize
 @ stub NdrContextHandleSize
 @ stdcall NdrConvert2(ptr ptr long)
@@ -210,16 +210,16 @@
 @ stdcall NdrDllGetClassObject(ptr ptr ptr ptr ptr ptr)
 @ stdcall NdrDllRegisterProxy(long ptr ptr)
 @ stdcall NdrDllUnregisterProxy(long ptr ptr)
-@ stub NdrEncapsulatedUnionBufferSize
-@ stub NdrEncapsulatedUnionFree
-@ stub NdrEncapsulatedUnionMarshall
-@ stub NdrEncapsulatedUnionMemorySize
-@ stub NdrEncapsulatedUnionUnmarshall
-@ stub NdrFixedArrayBufferSize
-@ stub NdrFixedArrayFree
-@ stub NdrFixedArrayMarshall
-@ stub NdrFixedArrayMemorySize
-@ stub NdrFixedArrayUnmarshall
+@ stdcall NdrEncapsulatedUnionBufferSize(ptr ptr ptr)
+@ stdcall NdrEncapsulatedUnionFree(ptr ptr ptr)
+@ stdcall NdrEncapsulatedUnionMarshall(ptr ptr ptr)
+@ stdcall NdrEncapsulatedUnionMemorySize(ptr ptr)
+@ stdcall NdrEncapsulatedUnionUnmarshall(ptr ptr ptr long)
+@ stdcall NdrFixedArrayBufferSize(ptr ptr ptr)
+@ stdcall NdrFixedArrayFree(ptr ptr ptr)
+@ stdcall NdrFixedArrayMarshall(ptr ptr ptr)
+@ stdcall NdrFixedArrayMemorySize(ptr ptr)
+@ stdcall NdrFixedArrayUnmarshall(ptr ptr ptr long)
 @ stdcall NdrFreeBuffer(ptr)
 @ stub NdrFullPointerFree
 @ stub NdrFullPointerInsertRefId
@@ -236,11 +236,11 @@
 @ stub NdrGetSimpleTypeMemorySize # wxp
 @ stub NdrGetTypeFlags # wxp
 @ stub NdrGetUserMarshallInfo
-@ stub NdrHardStructBufferSize
-@ stub NdrHardStructFree
-@ stub NdrHardStructMarshall
-@ stub NdrHardStructMemorySize
-@ stub NdrHardStructUnmarshall
+@ stub NdrHardStructBufferSize #(ptr ptr ptr)
+@ stub NdrHardStructFree #(ptr ptr ptr)
+@ stub NdrHardStructMarshall #(ptr ptr ptr)
+@ stub NdrHardStructMemorySize #(ptr ptr)
+@ stub NdrHardStructUnmarshall #(ptr ptr ptr long)
 @ stdcall NdrInterfacePointerBufferSize(ptr ptr ptr)
 @ stdcall NdrInterfacePointerFree(ptr ptr ptr)
 @ stdcall NdrInterfacePointerMarshall(ptr ptr ptr)
@@ -261,15 +261,15 @@
 @ stub NdrMesTypeEncode2
 @ stub NdrMesTypeEncode
 @ stub NdrMesTypeFree2
-@ stub NdrNonConformantStringBufferSize
-@ stub NdrNonConformantStringMarshall
-@ stub NdrNonConformantStringMemorySize
-@ stub NdrNonConformantStringUnmarshall
-@ stub NdrNonEncapsulatedUnionBufferSize
-@ stub NdrNonEncapsulatedUnionFree
-@ stub NdrNonEncapsulatedUnionMarshall
-@ stub NdrNonEncapsulatedUnionMemorySize
-@ stub NdrNonEncapsulatedUnionUnmarshall
+@ stub NdrNonConformantStringBufferSize #(ptr ptr ptr)
+@ stub NdrNonConformantStringMarshall #(ptr ptr ptr)
+@ stub NdrNonConformantStringMemorySize #(ptr ptr)
+@ stub NdrNonConformantStringUnmarshall #(ptr ptr ptr long)
+@ stdcall NdrNonEncapsulatedUnionBufferSize(ptr ptr ptr)
+@ stdcall NdrNonEncapsulatedUnionFree(ptr ptr ptr)
+@ stdcall NdrNonEncapsulatedUnionMarshall(ptr ptr ptr)
+@ stdcall NdrNonEncapsulatedUnionMemorySize(ptr ptr)
+@ stdcall NdrNonEncapsulatedUnionUnmarshall(ptr ptr ptr long)
 @ stub NdrNsGetBuffer
 @ stub NdrNsSendReceive
 @ stdcall NdrOleAllocate(long)
@@ -341,16 +341,16 @@
 @ stdcall NdrUserMarshalMemorySize(ptr ptr)
 @ stub NdrUserMarshalSimpleTypeConvert
 @ stdcall NdrUserMarshalUnmarshall(ptr ptr ptr long)
-@ stub NdrVaryingArrayBufferSize
-@ stub NdrVaryingArrayFree
-@ stub NdrVaryingArrayMarshall
-@ stub NdrVaryingArrayMemorySize
-@ stub NdrVaryingArrayUnmarshall
-@ stub NdrXmitOrRepAsBufferSize
-@ stub NdrXmitOrRepAsFree
-@ stub NdrXmitOrRepAsMarshall
-@ stub NdrXmitOrRepAsMemorySize
-@ stub NdrXmitOrRepAsUnmarshall
+@ stdcall NdrVaryingArrayBufferSize(ptr ptr ptr)
+@ stdcall NdrVaryingArrayFree(ptr ptr ptr)
+@ stdcall NdrVaryingArrayMarshall(ptr ptr ptr)
+@ stdcall NdrVaryingArrayMemorySize(ptr ptr)
+@ stdcall NdrVaryingArrayUnmarshall(ptr ptr ptr long)
+@ stdcall NdrXmitOrRepAsBufferSize(ptr ptr ptr)
+@ stdcall NdrXmitOrRepAsFree(ptr ptr ptr)
+@ stdcall NdrXmitOrRepAsMarshall(ptr ptr ptr)
+@ stdcall NdrXmitOrRepAsMemorySize(ptr ptr)
+@ stdcall NdrXmitOrRepAsUnmarshall(ptr ptr ptr long)
 @ stub NdrpCreateProxy # wxp
 @ stub NdrpCreateStub # wxp
 @ stub NdrpGetProcFormatString # wxp

Modified: trunk/reactos/lib/rpcrt4/rpcrt4_main.c
--- trunk/reactos/lib/rpcrt4/rpcrt4_main.c	2005-08-12 17:43:23 UTC (rev 17336)
+++ trunk/reactos/lib/rpcrt4/rpcrt4_main.c	2005-08-12 17:50:33 UTC (rev 17337)
@@ -57,7 +57,7 @@
  *
  * - ORPC is RPC for OLE; once we have a working RPC framework, we can
  *   use it to implement out-of-process OLE client/server communications.
- *   ATM there is maybe a disconnect between the marshalling in the OLE DLL's
+ *   ATM there is maybe a disconnect between the marshalling in the OLE DLLs
  *   and the marshalling going on here [TODO: well, is there or not?]
  * 
  * - In-source API Documentation, at least for those functions which we have