Oops, forget to add these.
authorSaveliy Tretiakov <saveliyt@gmail.com>
Wed, 12 Apr 2006 19:18:22 +0000 (19:18 +0000)
committerSaveliy Tretiakov <saveliyt@gmail.com>
Wed, 12 Apr 2006 19:18:22 +0000 (19:18 +0000)
svn path=/trunk/; revision=21568

reactos/dll/win32/rpcrt4/ndr_contexth.c [new file with mode: 0644]
reactos/dll/win32/rpcrt4/ndr_contexth.h [new file with mode: 0644]

diff --git a/reactos/dll/win32/rpcrt4/ndr_contexth.c b/reactos/dll/win32/rpcrt4/ndr_contexth.c
new file mode 100644 (file)
index 0000000..66c9091
--- /dev/null
@@ -0,0 +1,206 @@
+/*\r
+ * Context Handle Functions\r
+ *\r
+ * Copyright 2006 Saveliy Tretiakov\r
+ *\r
+ * This library is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU Lesser General Public\r
+ * License as published by the Free Software Foundation; either\r
+ * version 2.1 of the License, or (at your option) any later version.\r
+ *\r
+ * This library is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+ * Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ */\r
+\r
+#include "rpc.h"\r
+#include "rpcndr.h"\r
+#include "wine/debug.h"\r
+\r
+#include "rpc_binding.h"\r
+#include "ndr_contexth.h"\r
+\r
+\r
+/***********************************************************************\r
+ *           NDRCContextBinding\r
+ */\r
+RPC_BINDING_HANDLE WINAPI NDRCContextBinding(NDR_CCONTEXT CContext)\r
+{\r
+    if(!CContext)\r
+               RpcRaiseException(ERROR_INVALID_HANDLE);\r
+\r
+    return (RPC_BINDING_HANDLE)((CContextHandle*)CContext)->Binding;\r
+}\r
+\r
+/***********************************************************************\r
+ *           NDRCContextMarshall\r
+ */\r
+void WINAPI NDRCContextMarshall(NDR_CCONTEXT CContext, void *pBuff )\r
+{\r
+       CContextHandle *ctx = (CContextHandle*)CContext;\r
+       memcpy(pBuff, &ctx->Ndr, sizeof(ContextHandleNdr));\r
+}\r
+\r
+/***********************************************************************\r
+ *           NdrClientContextMarshall\r
+ */\r
+void WINAPI NdrClientContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,\r
+                                     NDR_CCONTEXT ContextHandle,\r
+                                     int fCheck)\r
+{\r
+   \r
+       if(!ContextHandle) \r
+               RpcRaiseException(ERROR_INVALID_HANDLE);\r
+\r
+       NDRCContextMarshall(ContextHandle, pStubMsg->Buffer);\r
+       \r
+       pStubMsg->Buffer += sizeof(ContextHandleNdr);\r
+\r
+}\r
+\r
+/***********************************************************************\r
+ *           NDRCContextUnmarshall\r
+ */\r
+void WINAPI NDRCContextUnmarshall(NDR_CCONTEXT *pCContext, \r
+                                  RPC_BINDING_HANDLE hBinding,\r
+                                  void *pBuff, \r
+                                  unsigned long DataRepresentation )\r
+{\r
+       CContextHandle *ctx = (CContextHandle*)*pCContext;\r
+       ContextHandleNdr *ndr = (ContextHandleNdr*)pBuff;\r
+       RPC_STATUS status;\r
+\r
+       if(UuidIsNil(&ndr->uuid, &status)) \r
+       {\r
+               if(ctx)\r
+               {\r
+                       RPCRT4_DestroyBinding(ctx->Binding);\r
+                       HeapFree(GetProcessHeap(), 0, ctx);\r
+               }\r
+               *pCContext = NULL;\r
+       }\r
+       else \r
+       {\r
+               ctx = HeapAlloc(GetProcessHeap(), 0, sizeof(CContextHandle));\r
+               if(!ctx) RpcRaiseException(ERROR_OUTOFMEMORY);\r
+\r
+               status = RpcBindingCopy(hBinding, (RPC_BINDING_HANDLE*) &ctx->Binding);\r
+               if(status != RPC_S_OK) RpcRaiseException(status);\r
+               \r
+               memcpy(&ctx->Ndr, ndr, sizeof(ContextHandleNdr));\r
+               *pCContext = (NDR_CCONTEXT)ctx;\r
+       }\r
+}\r
+\r
+/***********************************************************************\r
+ *           NdrClientContextUnmarshall\r
+ */\r
+void WINAPI NdrClientContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,\r
+                                       NDR_CCONTEXT * pContextHandle,\r
+                                       RPC_BINDING_HANDLE BindHandle)\r
+{\r
+       if(!pContextHandle) \r
+               RpcRaiseException(ERROR_INVALID_HANDLE);\r
+\r
+       NDRCContextUnmarshall(pContextHandle,\r
+               ((CContextHandle*)pContextHandle)->Binding,\r
+               pStubMsg->Buffer, \r
+               pStubMsg->RpcMsg->DataRepresentation);\r
+       \r
+       pStubMsg->Buffer += sizeof(ContextHandleNdr);\r
+}\r
+\r
+/***********************************************************************\r
+ *           RpcSmDestroyClientContext\r
+ */\r
+RPC_STATUS WINAPI RpcSmDestroyClientContext(void** ContextHandle)\r
+{\r
+       CContextHandle *ctx = (CContextHandle*)ContextHandle;\r
+\r
+       if(!ctx)\r
+               return RPC_X_SS_CONTEXT_MISMATCH;\r
+\r
+       RPCRT4_DestroyBinding(ctx->Binding);\r
+       HeapFree(GetProcessHeap(), 0, ctx);\r
+       *ContextHandle = NULL;\r
+\r
+       return RPC_S_OK;\r
+}\r
+\r
+/***********************************************************************\r
+ *           RpcSsDestroyClientContext\r
+ */\r
+void WINAPI RpcSsDestroyClientContext(void** ContextHandle)\r
+{\r
+       RPC_STATUS status;\r
+\r
+       status = RpcSmDestroyClientContext(ContextHandle);\r
+\r
+       if(status != RPC_S_OK) \r
+               RpcRaiseException(status);\r
+}\r
+\r
+/***********************************************************************\r
+ *           NdrServerContextMarshall\r
+ */\r
+void WINAPI NdrServerContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,\r
+                                     NDR_SCONTEXT ContextHandle,\r
+                                     NDR_RUNDOWN RundownRoutine )\r
+{\r
+    FIXME("(%p, %p, %p): stub\n", pStubMsg, ContextHandle, RundownRoutine);\r
+}\r
+\r
+/***********************************************************************\r
+ *           NdrServerContextUnmarshall\r
+ */\r
+NDR_SCONTEXT WINAPI NdrServerContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg)\r
+{\r
+    FIXME("(%p): stub\n", pStubMsg);\r
+    return NULL;\r
+}\r
+\r
+/***********************************************************************\r
+ *           NdrContextHandleSize\r
+ */\r
+void WINAPI NdrContextHandleSize(PMIDL_STUB_MESSAGE pStubMsg,\r
+                                 unsigned char* pMemory,\r
+                                 PFORMAT_STRING pFormat)\r
+{\r
+    FIXME("(%p, %p, %p): stub\n", pStubMsg, pMemory, pFormat);\r
+}\r
+\r
+/***********************************************************************\r
+ *           NdrContextHandleInitialize\r
+ */\r
+NDR_SCONTEXT WINAPI NdrContextHandleInitialize(PMIDL_STUB_MESSAGE pStubMsg,\r
+                                               PFORMAT_STRING pFormat)\r
+{\r
+    FIXME("(%p, %p): stub\n", pStubMsg, pFormat);\r
+    return NULL;\r
+}\r
+\r
+/***********************************************************************\r
+ *           NdrServerContextNewMarshall\r
+ */\r
+void WINAPI NdrServerContextNewMarshall(PMIDL_STUB_MESSAGE pStubMsg,\r
+                                        NDR_SCONTEXT ContextHandle,\r
+                                        NDR_RUNDOWN RundownRoutine,\r
+                                        PFORMAT_STRING pFormat)\r
+{\r
+    FIXME("(%p, %p, %p, %p): stub\n", pStubMsg, ContextHandle, RundownRoutine, pFormat);\r
+}\r
+\r
+/***********************************************************************\r
+ *           NdrServerContextNewUnmarshall\r
+ */\r
+NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,\r
+                                                  PFORMAT_STRING pFormat)\r
+{\r
+    FIXME("(%p, %p): stub\n", pStubMsg, pFormat);\r
+    return NULL;\r
+}\r
diff --git a/reactos/dll/win32/rpcrt4/ndr_contexth.h b/reactos/dll/win32/rpcrt4/ndr_contexth.h
new file mode 100644 (file)
index 0000000..675ea07
--- /dev/null
@@ -0,0 +1,39 @@
+/*\r
+ * Context Handle Functions\r
+ *\r
+ * Copyright 2006 Saveliy Tretiakov\r
+ *\r
+ * This library is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU Lesser General Public\r
+ * License as published by the Free Software Foundation; either\r
+ * version 2.1 of the License, or (at your option) any later version.\r
+ *\r
+ * This library is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+ * Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ */\r
\r
\r
+#ifndef __WINE_NDR_CONTEXTH_H\r
+#define __WINE_NDR_CONTEXTH_H\r
+\r
+#include "wine/rpcss_shared.h"\r
+\r
+typedef struct _ContextHandleNdr\r
+{\r
+       UINT attributes;\r
+       UUID uuid;\r
+} ContextHandleNdr;\r
+\r
+typedef struct _CContextHandle\r
+{\r
+       RpcBinding *Binding;\r
+       ContextHandleNdr Ndr;\r
+} CContextHandle;\r
+\r
+#endif //__WINE_NDR_CONTEXTH_H\r