Commit 9dc2584b authored by Ove Kaaven's avatar Ove Kaaven Committed by Alexandre Julliard

ReuseBuffer should be FALSE for RPC clients.

Some cleanups and elimination of some duplicate code.
parent c3e724d0
...@@ -55,16 +55,7 @@ void WINAPI NdrProxyInitialize(void *This, ...@@ -55,16 +55,7 @@ void WINAPI NdrProxyInitialize(void *This,
HRESULT hr; HRESULT hr;
TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum); TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
memset(pRpcMsg, 0, sizeof(RPC_MESSAGE)); NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
memset(pStubMsg, 0, sizeof(MIDL_STUB_MESSAGE));
pRpcMsg->ProcNum = ProcNum;
pRpcMsg->RpcInterfaceInformation = pStubDescriptor->RpcInterfaceInformation;
pStubMsg->RpcMsg = pRpcMsg;
pStubMsg->IsClient = 1;
pStubMsg->ReuseBuffer = 1;
pStubMsg->pfnAllocate = pStubDescriptor->pfnAllocate;
pStubMsg->pfnFree = pStubDescriptor->pfnFree;
pStubMsg->StubDesc = pStubDescriptor;
if (This) StdProxy_GetChannel(This, &pStubMsg->pRpcChannelBuffer); if (This) StdProxy_GetChannel(This, &pStubMsg->pRpcChannelBuffer);
if (pStubMsg->pRpcChannelBuffer) { if (pStubMsg->pRpcChannelBuffer) {
hr = IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer, hr = IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
...@@ -139,18 +130,8 @@ void WINAPI NdrStubInitialize(PRPC_MESSAGE pRpcMsg, ...@@ -139,18 +130,8 @@ void WINAPI NdrStubInitialize(PRPC_MESSAGE pRpcMsg,
LPRPCCHANNELBUFFER pRpcChannelBuffer) LPRPCCHANNELBUFFER pRpcChannelBuffer)
{ {
TRACE("(%p,%p,%p,%p)\n", pRpcMsg, pStubMsg, pStubDescriptor, pRpcChannelBuffer); TRACE("(%p,%p,%p,%p)\n", pRpcMsg, pStubMsg, pStubDescriptor, pRpcChannelBuffer);
memset(pStubMsg, 0, sizeof(MIDL_STUB_MESSAGE)); NdrServerInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor);
pStubMsg->RpcMsg = pRpcMsg;
pStubMsg->IsClient = 0;
pStubMsg->ReuseBuffer = 1;
pStubMsg->pfnAllocate = pStubDescriptor->pfnAllocate;
pStubMsg->pfnFree = pStubDescriptor->pfnFree;
pStubMsg->StubDesc = pStubDescriptor;
pStubMsg->pRpcChannelBuffer = pRpcChannelBuffer; pStubMsg->pRpcChannelBuffer = pRpcChannelBuffer;
pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength;
pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
pStubMsg->Buffer = pStubMsg->BufferStart;
} }
/*********************************************************************** /***********************************************************************
...@@ -183,7 +164,7 @@ void WINAPI NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE ...@@ -183,7 +164,7 @@ void WINAPI NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE
memset(pRpcMessage, 0, sizeof(RPC_MESSAGE)); memset(pRpcMessage, 0, sizeof(RPC_MESSAGE));
memset(pStubMsg, 0, sizeof(MIDL_STUB_MESSAGE)); memset(pStubMsg, 0, sizeof(MIDL_STUB_MESSAGE));
pStubMsg->ReuseBuffer = TRUE; pStubMsg->ReuseBuffer = FALSE;
pStubMsg->IsClient = TRUE; pStubMsg->IsClient = TRUE;
pStubMsg->StubDesc = pStubDesc; pStubMsg->StubDesc = pStubDesc;
pStubMsg->pfnAllocate = pStubDesc->pfnAllocate; pStubMsg->pfnAllocate = pStubDesc->pfnAllocate;
...@@ -212,8 +193,9 @@ unsigned char* WINAPI NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_M ...@@ -212,8 +193,9 @@ unsigned char* WINAPI NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_M
pStubMsg->pfnAllocate = pStubDesc->pfnAllocate; pStubMsg->pfnAllocate = pStubDesc->pfnAllocate;
pStubMsg->pfnFree = pStubDesc->pfnFree; pStubMsg->pfnFree = pStubDesc->pfnFree;
pStubMsg->RpcMsg = pRpcMsg; pStubMsg->RpcMsg = pRpcMsg;
pStubMsg->Buffer = pRpcMsg->Buffer; pStubMsg->Buffer = pStubMsg->BufferStart = pRpcMsg->Buffer;
pStubMsg->BufferLength = pRpcMsg->BufferLength; pStubMsg->BufferLength = pRpcMsg->BufferLength;
pStubMsg->BufferEnd = pStubMsg->Buffer + pStubMsg->BufferLength;
/* FIXME: determine the proper return value */ /* FIXME: determine the proper return value */
return NULL; return NULL;
...@@ -235,8 +217,9 @@ unsigned char *WINAPI NdrGetBuffer(MIDL_STUB_MESSAGE *stubmsg, unsigned long buf ...@@ -235,8 +217,9 @@ unsigned char *WINAPI NdrGetBuffer(MIDL_STUB_MESSAGE *stubmsg, unsigned long buf
if (I_RpcGetBuffer(stubmsg->RpcMsg) != S_OK) if (I_RpcGetBuffer(stubmsg->RpcMsg) != S_OK)
return NULL; return NULL;
stubmsg->Buffer = stubmsg->BufferStart = stubmsg->RpcMsg->Buffer;
stubmsg->BufferLength = stubmsg->RpcMsg->BufferLength; stubmsg->BufferLength = stubmsg->RpcMsg->BufferLength;
stubmsg->BufferEnd = stubmsg->BufferStart = 0; stubmsg->BufferEnd = stubmsg->Buffer + stubmsg->BufferLength;
return (stubmsg->Buffer = (unsigned char *)stubmsg->RpcMsg->Buffer); return (stubmsg->Buffer = (unsigned char *)stubmsg->RpcMsg->Buffer);
} }
/*********************************************************************** /***********************************************************************
...@@ -247,7 +230,7 @@ void WINAPI NdrFreeBuffer(MIDL_STUB_MESSAGE *pStubMsg) ...@@ -247,7 +230,7 @@ void WINAPI NdrFreeBuffer(MIDL_STUB_MESSAGE *pStubMsg)
TRACE("(pStubMsg == ^%p): wild guess.\n", pStubMsg); TRACE("(pStubMsg == ^%p): wild guess.\n", pStubMsg);
I_RpcFreeBuffer(pStubMsg->RpcMsg); I_RpcFreeBuffer(pStubMsg->RpcMsg);
pStubMsg->BufferLength = 0; pStubMsg->BufferLength = 0;
pStubMsg->Buffer = (unsigned char *)(pStubMsg->RpcMsg->Buffer = NULL); pStubMsg->Buffer = pStubMsg->BufferEnd = (unsigned char *)(pStubMsg->RpcMsg->Buffer = NULL);
} }
/************************************************************************ /************************************************************************
...@@ -270,7 +253,7 @@ unsigned char *WINAPI NdrSendReceive( MIDL_STUB_MESSAGE *stubmsg, unsigned char ...@@ -270,7 +253,7 @@ unsigned char *WINAPI NdrSendReceive( MIDL_STUB_MESSAGE *stubmsg, unsigned char
ERR("Ambiguous buffer doesn't match rpc message buffer. No action taken.\n"); ERR("Ambiguous buffer doesn't match rpc message buffer. No action taken.\n");
return NULL; return NULL;
} }
/* not sure where MS does this; for now I'll stick it here */ /* not sure where MS does this; for now I'll stick it here */
stubmsg->RpcMsg->DataRepresentation = NDR_LOCAL_DATA_REPRESENTATION; stubmsg->RpcMsg->DataRepresentation = NDR_LOCAL_DATA_REPRESENTATION;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment