Support marshalling of 'unique' strings.

svn path=/trunk/; revision=14482
This commit is contained in:
Eric Kohl 2005-04-03 19:15:14 +00:00
parent be04afc103
commit aed77eddbd

View file

@ -388,7 +388,12 @@ unsigned char *WINAPI NdrConformantStringMarshall(MIDL_STUB_MESSAGE *pStubMsg,
TRACE("(pStubMsg == ^%p, pszMessage == ^%p, pFormat == ^%p)\n", pStubMsg, pszMessage, pFormat);
assert(pFormat);
if (*pFormat == RPC_FC_C_CSTRING) {
if (pszMessage == NULL) {
TRACE("string=%s\n", debugstr_a(pszMessage));
len = 0;
esize = 0;
}
else if (*pFormat == RPC_FC_C_CSTRING) {
TRACE("string=%s\n", debugstr_a(pszMessage));
len = strlen(pszMessage)+1;
esize = 1;
@ -416,8 +421,10 @@ unsigned char *WINAPI NdrConformantStringMarshall(MIDL_STUB_MESSAGE *pStubMsg,
c += 8; /* offset: 0 */
NDR_LOCAL_UINT32_WRITE(c, len); /* actual length: (same) */
c += 4;
memcpy(c, pszMessage, len*esize); /* the string itself */
c += len*esize;
if (len != 0) {
memcpy(c, pszMessage, len*esize); /* the string itself */
c += len*esize;
}
pStubMsg->Buffer = c;
STD_OVERFLOW_CHECK(pStubMsg);
@ -435,7 +442,12 @@ void WINAPI NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(pStubMsg == ^%p, pMemory == ^%p, pFormat == ^%p)\n", pStubMsg, pMemory, pFormat);
assert(pFormat);
if (*pFormat == RPC_FC_C_CSTRING) {
if (pMemory == NULL) {
/* we need 12 octets for the [maxlen, offset, len] DWORDS */
TRACE("string=NULL\n");
pStubMsg->BufferLength += 12 + BUFFER_PARANOIA;
}
else if (*pFormat == RPC_FC_C_CSTRING) {
/* we need 12 octets for the [maxlen, offset, len] DWORDS, + 1 octet for '\0' */
TRACE("string=%s\n", debugstr_a(pMemory));
pStubMsg->BufferLength += strlen(pMemory) + 13 + BUFFER_PARANOIA;
@ -528,6 +540,11 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg
/* for clients, memory should be provided by caller */
}
if (len == 0) {
*ppMemory = NULL;
return NULL;
}
pMem = *ppMemory + ofs*esize;
if (pMem != pStubMsg->Buffer)
@ -572,6 +589,8 @@ void WINAPI PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
switch (type) {
case RPC_FC_RP: /* ref pointer (always non-null) */
break;
case RPC_FC_UP: /* unique pointer */
break;
default:
FIXME("unhandled ptr type=%02x\n", type);
}
@ -609,6 +628,8 @@ void WINAPI PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
switch (type) {
case RPC_FC_RP: /* ref pointer (always non-null) */
break;
case RPC_FC_UP: /* unique pointer */
break;
default:
FIXME("unhandled ptr type=%02x\n", type);
}
@ -645,6 +666,8 @@ void WINAPI PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
switch (type) {
case RPC_FC_RP: /* ref pointer (always non-null) */
break;
case RPC_FC_UP: /* unique pointer */
break;
default:
FIXME("unhandled ptr type=%02x\n", type);
}