Robert Shearman : rpcrt4: Dereference the memory for pointers in
NdrNonEncapsulatedUnionUnmarshall.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon May 15 09:42:52 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 345c92643e3f1993412851fa0c895506d5f211a3
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=345c92643e3f1993412851fa0c895506d5f211a3
Author: Robert Shearman <rob at codeweavers.com>
Date: Mon May 15 13:35:17 2006 +0100
rpcrt4: Dereference the memory for pointers in NdrNonEncapsulatedUnionUnmarshall.
Pointers in a non-encapsulated union behave like embedded pointers, so
don't rely on the NdrPointer* functions doing the right thing in this
case and call the Pointer* functions directly.
---
dlls/rpcrt4/ndr_marshall.c | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 5681430..3d34b8a 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -3113,16 +3113,20 @@ unsigned char * WINAPI NdrNonEncapsulat
NDR_MARSHALL m = NdrMarshaller[*desc & NDR_TABLE_MASK];
if (m)
{
+ unsigned char *saved_buffer = NULL;
switch(*desc)
{
case RPC_FC_RP:
case RPC_FC_UP:
case RPC_FC_OP:
case RPC_FC_FP:
- pMemory = *(void**)pMemory;
+ saved_buffer = pStubMsg->Buffer;
+ pStubMsg->Buffer += 4; /* for pointer ID */
+ PointerMarshall(pStubMsg, saved_buffer, *(unsigned char **)pMemory, desc);
break;
+ default:
+ m(pStubMsg, pMemory, desc);
}
- m(pStubMsg, pMemory, desc);
}
else FIXME("no marshaller for embedded type %02x\n", *desc);
}
@@ -3210,6 +3214,7 @@ unsigned char * WINAPI NdrNonEncapsulat
NDR_UNMARSHALL m = NdrUnmarshaller[*desc & NDR_TABLE_MASK];
if (m)
{
+ unsigned char *saved_buffer = NULL;
switch(*desc)
{
case RPC_FC_RP:
@@ -3217,9 +3222,14 @@ unsigned char * WINAPI NdrNonEncapsulat
case RPC_FC_OP:
case RPC_FC_FP:
**(void***)ppMemory = NULL;
+ ALIGN_POINTER(pStubMsg->Buffer, 4);
+ saved_buffer = pStubMsg->Buffer;
+ pStubMsg->Buffer += 4; /* for pointer ID */
+ PointerUnmarshall(pStubMsg, saved_buffer, *(unsigned char ***)ppMemory, desc, fMustAlloc);
break;
+ default:
+ m(pStubMsg, ppMemory, desc, fMustAlloc);
}
- return m(pStubMsg, (unsigned char **)*ppMemory, desc, fMustAlloc);
}
else FIXME("no marshaller for embedded type %02x\n", *desc);
}
@@ -3263,10 +3273,13 @@ void WINAPI NdrNonEncapsulatedUnionBuffe
case RPC_FC_UP:
case RPC_FC_OP:
case RPC_FC_FP:
- pMemory = *(void**)pMemory;
+ ALIGN_LENGTH(pStubMsg->BufferLength, 4);
+ pStubMsg->BufferLength += 4; /* for pointer ID */
+ PointerBufferSize(pStubMsg, *(unsigned char **)pMemory, desc);
break;
+ default:
+ m(pStubMsg, pMemory, desc);
}
- m(pStubMsg, pMemory, desc);
}
else FIXME("no buffersizer for embedded type %02x\n", *desc);
}
More information about the wine-cvs
mailing list