wine/dlls/rpcrt4 ndr_ole.c

Alexandre Julliard julliard at wine.codeweavers.com
Tue Nov 29 05:04:50 CST 2005


ChangeSet ID:	21518
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/29 05:04:49

Modified files:
	dlls/rpcrt4    : ndr_ole.c 

Log message:
	Robert Shearman <rob at codeweavers.com>
	Raise exceptions on failures.
	Replace references of pStubMsg->BufferEnd with RpcMsg->Buffer +
	pStubMsg->BufferLength.
	Fix buffer calculation when no interface data is marshaled to the
	stream.

Patch: http://cvs.winehq.org/patch.py?id=21518

Old revision  New revision  Changes     Path
 1.16          1.17          +9 -3       wine/dlls/rpcrt4/ndr_ole.c

Index: wine/dlls/rpcrt4/ndr_ole.c
diff -u -p wine/dlls/rpcrt4/ndr_ole.c:1.16 wine/dlls/rpcrt4/ndr_ole.c:1.17
--- wine/dlls/rpcrt4/ndr_ole.c:1.16	29 Nov 2005 11: 4:49 -0000
+++ wine/dlls/rpcrt4/ndr_ole.c	29 Nov 2005 11: 4:49 -0000
@@ -254,13 +254,17 @@ unsigned char * WINAPI NdrInterfacePoint
   TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
   pStubMsg->MaxCount = 0;
   if (!LoadCOM()) return NULL;
-  if (pStubMsg->Buffer + sizeof(DWORD) < pStubMsg->BufferEnd) {
+  if (pStubMsg->Buffer + sizeof(DWORD) < (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) {
     stream = RpcStream_Create(pStubMsg, TRUE);
     if (stream) {
       hr = COM_MarshalInterface(stream, riid, (LPUNKNOWN)pMemory,
                                 pStubMsg->dwDestContext, pStubMsg->pvDestContext,
                                 MSHLFLAGS_NORMAL);
       IStream_Release(stream);
+      if (FAILED(hr)) {
+        IUnknown_Release((LPUNKNOWN)pMemory);
+        RpcRaiseException(hr);
+      }
     }
   }
   return NULL;
@@ -280,11 +284,13 @@ unsigned char * WINAPI NdrInterfacePoint
   TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
   if (!LoadCOM()) return NULL;
   *(LPVOID*)ppMemory = NULL;
-  if (pStubMsg->Buffer + sizeof(DWORD) < pStubMsg->BufferEnd) {
+  if (pStubMsg->Buffer + sizeof(DWORD) < (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) {
     stream = RpcStream_Create(pStubMsg, FALSE);
     if (stream) {
       hr = COM_UnmarshalInterface(stream, &IID_NULL, (LPVOID*)ppMemory);
       IStream_Release(stream);
+      if (FAILED(hr))
+        RpcRaiseException(hr);
     }
   }
   return NULL;
@@ -307,7 +313,7 @@ void WINAPI NdrInterfacePointerBufferSiz
                             pStubMsg->dwDestContext, pStubMsg->pvDestContext,
                             MSHLFLAGS_NORMAL);
   TRACE("size=%ld\n", size);
-  if (size) pStubMsg->BufferLength += sizeof(DWORD) + size;
+  pStubMsg->BufferLength += sizeof(DWORD) + size;
 }
 
 /***********************************************************************



More information about the wine-cvs mailing list