Rob Shearman : rpcrt4: Support calculating the size in memory of range types embedded in complex types .

Alexandre Julliard julliard at winehq.org
Fri Jul 4 13:59:17 CDT 2008


Module: wine
Branch: master
Commit: 517844e054039bbd1aff0a8911051a7f1ffa59c0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=517844e054039bbd1aff0a8911051a7f1ffa59c0

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Thu Jul  3 23:26:43 2008 +0100

rpcrt4: Support calculating the size in memory of range types embedded in complex types.

---

 dlls/rpcrt4/ndr_marshall.c |   52 ++++++++++++++++++++++++++++++++++---------
 1 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 4e7643a..1501402 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -2114,7 +2114,17 @@ void WINAPI NdrSimpleStructFree(PMIDL_STUB_MESSAGE pStubMsg,
 }
 
 
-static unsigned long EmbeddedComplexSize(const MIDL_STUB_MESSAGE *pStubMsg,
+#include "pshpack1.h"
+typedef struct
+{
+    unsigned char type;
+    unsigned char flags_type; /* flags in upper nibble, type in lower nibble */
+    ULONG low_value;
+    ULONG high_value;
+} NDR_RANGE;
+#include "poppack.h"
+
+static unsigned long EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg,
                                          PFORMAT_STRING pFormat)
 {
   switch (*pFormat) {
@@ -2128,6 +2138,36 @@ static unsigned long EmbeddedComplexSize(const MIDL_STUB_MESSAGE *pStubMsg,
     return *(const WORD*)&pFormat[2];
   case RPC_FC_USER_MARSHAL:
     return *(const WORD*)&pFormat[4];
+  case RPC_FC_RANGE: {
+    switch (((const NDR_RANGE *)pFormat)->flags_type & 0xf) {
+    case RPC_FC_BYTE:
+    case RPC_FC_CHAR:
+    case RPC_FC_SMALL:
+    case RPC_FC_USMALL:
+        return sizeof(UCHAR);
+    case RPC_FC_WCHAR:
+    case RPC_FC_SHORT:
+    case RPC_FC_USHORT:
+        return sizeof(USHORT);
+    case RPC_FC_LONG:
+    case RPC_FC_ULONG:
+    case RPC_FC_ENUM32:
+        return sizeof(ULONG);
+    case RPC_FC_FLOAT:
+        return sizeof(float);
+    case RPC_FC_DOUBLE:
+        return sizeof(double);
+    case RPC_FC_HYPER:
+        return sizeof(ULONGLONG);
+    case RPC_FC_ERROR_STATUS_T:
+        return sizeof(error_status_t);
+    case RPC_FC_ENUM16:
+        return sizeof(UINT);
+    default:
+        ERR("unknown type 0x%x\n", ((const NDR_RANGE *)pFormat)->flags_type & 0xf);
+        RpcRaiseException(RPC_X_BAD_STUB_DATA);
+    }
+  }
   case RPC_FC_NON_ENCAPSULATED_UNION:
     pFormat += 2;
     if (pStubMsg->fHasNewCorrDesc)
@@ -5710,16 +5750,6 @@ void WINAPI NdrXmitOrRepAsFree(PMIDL_STUB_MESSAGE pStubMsg,
     FIXME("stub\n");
 }
 
-#include "pshpack1.h"
-typedef struct
-{
-    unsigned char type;
-    unsigned char flags_type; /* flags in upper nibble, type in lower nibble */
-    ULONG low_value;
-    ULONG high_value;
-} NDR_RANGE;
-#include "poppack.h"
-
 /***********************************************************************
  *           NdrRangeMarshall [internal]
  */




More information about the wine-cvs mailing list