From 4c0b0e0069e910082734b0a279e92f734c579fdd Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Mon, 15 May 2006 16:57:13 +0100 Subject: [PATCH] rpcrt4: Implement computing of conformance from a correlation descriptor for conformant strings. --- dlls/rpcrt4/ndr_marshall.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index 4f5d3369cbd..1bf38116258 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -530,19 +530,18 @@ finish_conf: unsigned char *WINAPI NdrConformantStringMarshall(MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pszMessage, PFORMAT_STRING pFormat) { - unsigned long len, esize; + unsigned long esize; TRACE("(pStubMsg == ^%p, pszMessage == ^%p, pFormat == ^%p)\n", pStubMsg, pszMessage, pFormat); - assert(pFormat); if (*pFormat == RPC_FC_C_CSTRING) { TRACE("string=%s\n", debugstr_a((char*)pszMessage)); - len = strlen((char*)pszMessage)+1; + pStubMsg->ActualCount = strlen((char*)pszMessage)+1; esize = 1; } else if (*pFormat == RPC_FC_C_WSTRING) { TRACE("string=%s\n", debugstr_w((LPWSTR)pszMessage)); - len = strlenW((LPWSTR)pszMessage)+1; + pStubMsg->ActualCount = strlenW((LPWSTR)pszMessage)+1; esize = 2; } else { @@ -551,19 +550,16 @@ unsigned char *WINAPI NdrConformantStringMarshall(MIDL_STUB_MESSAGE *pStubMsg, return NULL; } - if (pFormat[1] != RPC_FC_PAD) { - FIXME("sized string format=%d\n", pFormat[1]); - } - - assert( (pStubMsg->BufferLength >= (len*esize + 13)) && (pStubMsg->Buffer != NULL) ); - - pStubMsg->MaxCount = pStubMsg->ActualCount = len; + if (pFormat[1] == RPC_FC_STRING_SIZED) + pFormat = ComputeConformance(pStubMsg, pszMessage, pFormat + 2, 0); + else + pStubMsg->MaxCount = pStubMsg->ActualCount; pStubMsg->Offset = 0; WriteConformance(pStubMsg); WriteVariance(pStubMsg); - memcpy(pStubMsg->Buffer, pszMessage, len*esize); /* the string itself */ - pStubMsg->Buffer += len*esize; + memcpy(pStubMsg->Buffer, pszMessage, pStubMsg->ActualCount*esize); /* the string itself */ + pStubMsg->Buffer += pStubMsg->ActualCount*esize; STD_OVERFLOW_CHECK(pStubMsg); @@ -582,7 +578,6 @@ void WINAPI NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, SizeConformance(pStubMsg); SizeVariance(pStubMsg); - assert(pFormat); if (*pFormat == RPC_FC_C_CSTRING) { /* we need + 1 octet for '\0' */ TRACE("string=%s\n", debugstr_a((char*)pMemory)); @@ -597,10 +592,6 @@ void WINAPI NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, ERR("Unhandled string type: %#x\n", *pFormat); /* FIXME: raise an exception */ } - - if (pFormat[1] != RPC_FC_PAD) { - FIXME("sized string format=%d\n", pFormat[1]); - } } /************************************************************************ @@ -658,10 +649,6 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg esize = 0; } - if (pFormat[1] != RPC_FC_PAD) { - FIXME("sized string format=%d\n", pFormat[1]); - } - len = pStubMsg->ActualCount; if (fMustAlloc || !*ppMemory)