rpc_G_PL3

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

 



LICENSE: X11

CHANGELOG:

* dlls/rpcrt4: ndr_marshall.c, ndr_midl.c, rpc_message.c, rpc_server.c;
  include: rpcndr.h: Greg Turner <gmturner007@ameritech.net>
- clean up and add some comments
- add NDR Data representation constants
- propogate DataRepresentation into and out of packet headers
- Implement NdrServerInitializeNew

-- 
gmt

"The purpose of government is to rein in the rights of the people"
 --President Bill Clinton, MTV interview, 1993
diff -ur -x CVS -x 'bigdif*' ../wine.test/dlls/rpcrt4/ndr_marshall.c ./dlls/rpcrt4/ndr_marshall.c
--- ../wine.test/dlls/rpcrt4/ndr_marshall.c	2002-10-26 14:00:03.000000000 -0500
+++ ./dlls/rpcrt4/ndr_marshall.c	2002-10-26 14:36:47.000000000 -0500
@@ -105,7 +105,7 @@
   TRACE("(pStubMsg == ^%p, pMemory == ^%p, pFormat == ^%p)\n", pStubMsg, pMemory, pFormat);
 
   if (*pFormat == RPC_FC_C_CSTRING) {
-    /* we need 12 chars for the [maxlen, offset, len] DWORDS, + 1 byte for '\0' */
+    /* we need 12 octets for the [maxlen, offset, len] DWORDS, + 1 octet for '\0' */
     pStubMsg->BufferLength = strlen(pMemory) + 13 + BUFFER_PARANOIA;
   } else {
     ERR("Unhandled string type: %#x\n", *pFormat); 
@@ -139,6 +139,8 @@
 void WINAPI NdrConvert( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat )
 {
   FIXME("(pStubMsg == ^%p, pFormat == ^%p): stub.\n", pStubMsg, pFormat);
+  /* FIXME: since this stub doesn't do any converting, the proper behavior
+     is to raise an exception */
 }
 
 /***********************************************************************
@@ -147,4 +149,6 @@
 void WINAPI NdrConvert2( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, long NumberParams )
 {
   FIXME("(pStubMsg == ^%p, pFormat == ^%p, NumberParams == %ld): stub.\n", pStubMsg, pFormat, NumberParams);
+  /* FIXME: since this stub doesn't do any converting, the proper behavior
+     is to raise an exception */
 }
diff -ur -x CVS -x 'bigdif*' ../wine.test/dlls/rpcrt4/ndr_midl.c ./dlls/rpcrt4/ndr_midl.c
--- ../wine.test/dlls/rpcrt4/ndr_midl.c	2002-10-26 04:02:37.000000000 -0500
+++ ./dlls/rpcrt4/ndr_midl.c	2002-10-26 17:02:25.000000000 -0500
@@ -40,6 +40,7 @@
 
 #include "cpsf.h"
 #include "ndr_misc.h"
+#include "rpcndr.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
@@ -178,6 +179,8 @@
   TRACE("(pRpcMessage == ^%p, pStubMsg == ^%p, pStubDesc == ^%p, ProcNum == %d)\n",
     pRpcMessage, pStubMsg, pStubDesc, ProcNum);
 
+  assert( pRpcMessage && pStubMsg && pStubDesc );
+
   memset(pRpcMessage, 0, sizeof(RPC_MESSAGE));
   memset(pStubMsg, 0, sizeof(MIDL_STUB_MESSAGE));
 
@@ -198,7 +201,20 @@
 unsigned char* WINAPI NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
                                               PMIDL_STUB_DESC pStubDesc )
 {
-  FIXME("(pRpcMsg == ^%p, pStubMsg == ^%p, pStubDesc == ^%p): stub.\n", pRpcMsg, pStubMsg, pStubDesc);
+  TRACE("(pRpcMsg == ^%p, pStubMsg == ^%p, pStubDesc == ^%p)\n", pRpcMsg, pStubMsg, pStubDesc);
+
+  assert( pRpcMsg && pStubMsg && pStubDesc );
+
+  memset(pStubMsg, 0, sizeof(MIDL_STUB_MESSAGE));
+
+  pStubMsg->ReuseBuffer = TRUE;
+  pStubMsg->IsClient = FALSE;
+  pStubMsg->StubDesc = pStubDesc;
+  pStubMsg->pfnAllocate = pStubDesc->pfnAllocate;
+  pStubMsg->pfnFree = pStubDesc->pfnFree;
+  pStubMsg->RpcMsg = pRpcMsg;
+
+  /* FIXME: determine the proper return value */
   return NULL;
 }
 
@@ -253,6 +269,9 @@
     ERR("Ambiguous buffer doesn't match rpc message buffer.  No action taken.\n");
     return NULL;
   }
+  
+  /* not sure where MS does this; for now I'll stick it here */
+  stubmsg->RpcMsg->DataRepresentation = NDR_LOCAL_DATA_REPRESENTATION;
 
   if (I_RpcSendReceive(stubmsg->RpcMsg) != RPC_S_OK) {
     WARN("I_RpcSendReceive did not return success.\n");
diff -ur -x CVS -x 'bigdif*' ../wine.test/dlls/rpcrt4/rpc_message.c ./dlls/rpcrt4/rpc_message.c
--- ../wine.test/dlls/rpcrt4/rpc_message.c	2002-10-25 21:17:10.000000000 -0500
+++ ./dlls/rpcrt4/rpc_message.c	2002-10-26 20:11:33.000000000 -0500
@@ -102,6 +102,10 @@
     MAKELONG(sif->InterfaceId.SyntaxVersion.MinorVersion, sif->InterfaceId.SyntaxVersion.MajorVersion) :
     MAKELONG(cif->InterfaceId.SyntaxVersion.MinorVersion, cif->InterfaceId.SyntaxVersion.MajorVersion);
   hdr.opnum = pMsg->ProcNum;
+  /* only the low-order 3 octets of the DataRepresentation go in the header */
+  hdr.drep[0] = LOBYTE(LOWORD(pMsg->DataRepresentation));
+  hdr.drep[1] = HIBYTE(LOWORD(pMsg->DataRepresentation));
+  hdr.drep[2] = LOBYTE(HIWORD(pMsg->DataRepresentation));
   hdr.len = pMsg->BufferLength;
 
   /* transmit packet */
diff -ur -x CVS -x 'bigdif*' ../wine.test/dlls/rpcrt4/rpc_server.c ./dlls/rpcrt4/rpc_server.c
--- ../wine.test/dlls/rpcrt4/rpc_server.c	2002-10-26 04:02:37.000000000 -0500
+++ ./dlls/rpcrt4/rpc_server.c	2002-10-26 21:01:15.000000000 -0500
@@ -144,6 +144,12 @@
          }
          func = sif->If->DispatchTable->DispatchTable[msg.ProcNum];
        }
+       
+       /* put in the drep. FIXME: is this more universally applicable?
+          perhaps we should move this outward... */
+       msg.DataRepresentation = 
+         MAKELONG( MAKEWORD(hdr.drep[0], hdr.drep[1]),
+                   MAKEWORD(hdr.drep[2], 0));
 
        /* dispatch */
        if (func) func(&msg);
diff -ur -x CVS -x 'bigdif*' ../wine.test/include/rpcndr.h ./include/rpcndr.h
--- ../wine.test/include/rpcndr.h	2002-10-26 04:02:37.000000000 -0500
+++ ./include/rpcndr.h	2002-10-26 15:23:39.000000000 -0500
@@ -26,6 +26,16 @@
 
 #include "rpc.h"
 
+#define NDR_LITTLE_ENDIAN              ((UINT32) 0x00000010)
+#define NDR_BIG_ENDIAN                 ((UINT32) 0x00000000)
+
+/*   Character Representation: ASCII
+ *   Integer Representation:   Little Endian
+ *   FP Representation:        IEEE
+ */
+#define NDR_LOCAL_DATA_REPRESENTATION ((UINT32) 0x00000010)
+#define NDR_LOCAL_ENDIAN              NDR_LITTLE_ENDIAN
+
 #define TARGET_IS_NT40_OR_LATER 1
 #define TARGET_IS_NT351_OR_WIN95_OR_LATER 1
 

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

  Powered by Linux