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.
This commit is contained in:
Robert Shearman 2005-11-29 10:41:34 +01:00 committed by Alexandre Julliard
parent 552f18211d
commit bb90b3e3cc
1 changed files with 9 additions and 3 deletions

View File

@ -254,13 +254,17 @@ unsigned char * WINAPI NdrInterfacePointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
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 NdrInterfacePointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg
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 NdrInterfacePointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->dwDestContext, pStubMsg->pvDestContext,
MSHLFLAGS_NORMAL);
TRACE("size=%ld\n", size);
if (size) pStubMsg->BufferLength += sizeof(DWORD) + size;
pStubMsg->BufferLength += sizeof(DWORD) + size;
}
/***********************************************************************