rpcrt4: Re-implement part of the conformant varying structure processing routines using array_* functions.

This commit is contained in:
Rob Shearman 2008-08-10 11:14:30 +01:00 committed by Alexandre Julliard
parent b2305adc3c
commit 2652ddfeba

View File

@ -1780,7 +1780,7 @@ static inline void array_compute_and_size_conformance(
static inline void array_buffer_size( static inline void array_buffer_size(
unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory,
PFORMAT_STRING pFormat) PFORMAT_STRING pFormat, unsigned char fHasPointers)
{ {
DWORD size; DWORD size;
DWORD esize; DWORD esize;
@ -1800,7 +1800,8 @@ static inline void array_buffer_size(
/* conformance value plus array */ /* conformance value plus array */
safe_buffer_length_increment(pStubMsg, size); safe_buffer_length_increment(pStubMsg, size);
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat); if (fHasPointers)
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
break; break;
case RPC_FC_CVARRAY: case RPC_FC_CVARRAY:
esize = *(const WORD*)(pFormat+2); esize = *(const WORD*)(pFormat+2);
@ -1816,7 +1817,8 @@ static inline void array_buffer_size(
size = safe_multiply(esize, pStubMsg->ActualCount); size = safe_multiply(esize, pStubMsg->ActualCount);
safe_buffer_length_increment(pStubMsg, size); safe_buffer_length_increment(pStubMsg, size);
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat); if (fHasPointers)
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
break; break;
case RPC_FC_C_CSTRING: case RPC_FC_C_CSTRING:
case RPC_FC_C_WSTRING: case RPC_FC_C_WSTRING:
@ -1878,7 +1880,7 @@ static inline void array_compute_and_write_conformance(
static inline void array_write_variance_and_marshall( static inline void array_write_variance_and_marshall(
unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory,
PFORMAT_STRING pFormat) PFORMAT_STRING pFormat, unsigned char fHasPointers)
{ {
DWORD size; DWORD size;
DWORD esize; DWORD esize;
@ -1895,10 +1897,12 @@ static inline void array_write_variance_and_marshall(
ALIGN_POINTER_CLEAR(pStubMsg->Buffer, alignment); ALIGN_POINTER_CLEAR(pStubMsg->Buffer, alignment);
size = safe_multiply(esize, pStubMsg->MaxCount); size = safe_multiply(esize, pStubMsg->MaxCount);
pStubMsg->BufferMark = pStubMsg->Buffer; if (fHasPointers)
pStubMsg->BufferMark = pStubMsg->Buffer;
safe_copy_to_buffer(pStubMsg, pMemory, size); safe_copy_to_buffer(pStubMsg, pMemory, size);
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat); if (fHasPointers)
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
break; break;
case RPC_FC_CVARRAY: case RPC_FC_CVARRAY:
esize = *(const WORD*)(pFormat+2); esize = *(const WORD*)(pFormat+2);
@ -1915,10 +1919,12 @@ static inline void array_write_variance_and_marshall(
size = safe_multiply(esize, pStubMsg->ActualCount); size = safe_multiply(esize, pStubMsg->ActualCount);
pStubMsg->BufferMark = pStubMsg->Buffer; if (fHasPointers)
pStubMsg->BufferMark = pStubMsg->Buffer;
safe_copy_to_buffer(pStubMsg, pMemory + pStubMsg->Offset, size); safe_copy_to_buffer(pStubMsg, pMemory + pStubMsg->Offset, size);
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat); if (fHasPointers)
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
break; break;
case RPC_FC_C_CSTRING: case RPC_FC_C_CSTRING:
case RPC_FC_C_WSTRING: case RPC_FC_C_WSTRING:
@ -1971,10 +1977,10 @@ static inline ULONG array_read_conformance(
} }
} }
static inline void array_read_variance_and_unmarshall( static inline ULONG array_read_variance_and_unmarshall(
unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory,
PFORMAT_STRING pFormat, unsigned char fMustAlloc, PFORMAT_STRING pFormat, unsigned char fMustAlloc,
unsigned char fUseBufferMemoryServer) unsigned char fUseBufferMemoryServer, unsigned char fUnmarshall)
{ {
ULONG bufsize, memsize; ULONG bufsize, memsize;
WORD esize; WORD esize;
@ -1994,23 +2000,28 @@ static inline void array_read_variance_and_unmarshall(
ALIGN_POINTER(pStubMsg->Buffer, alignment); ALIGN_POINTER(pStubMsg->Buffer, alignment);
if (fMustAlloc) if (fUnmarshall)
*ppMemory = NdrAllocate(pStubMsg, memsize);
else
{ {
if (fUseBufferMemoryServer && !pStubMsg->IsClient && !*ppMemory) if (fMustAlloc)
/* for servers, we just point straight into the RPC buffer */ *ppMemory = NdrAllocate(pStubMsg, memsize);
*ppMemory = pStubMsg->Buffer; else
{
if (fUseBufferMemoryServer && !pStubMsg->IsClient && !*ppMemory)
/* for servers, we just point straight into the RPC buffer */
*ppMemory = pStubMsg->Buffer;
}
saved_buffer = pStubMsg->Buffer;
safe_buffer_increment(pStubMsg, bufsize);
pStubMsg->BufferMark = saved_buffer;
EmbeddedPointerUnmarshall(pStubMsg, saved_buffer, *ppMemory, pFormat, fMustAlloc);
TRACE("copying %p to %p\n", saved_buffer, *ppMemory);
if (*ppMemory != saved_buffer)
memcpy(*ppMemory, saved_buffer, bufsize);
} }
return bufsize;
saved_buffer = pStubMsg->BufferMark = pStubMsg->Buffer;
safe_buffer_increment(pStubMsg, bufsize);
EmbeddedPointerUnmarshall(pStubMsg, saved_buffer, *ppMemory, pFormat, fMustAlloc);
TRACE("copying %p to %p\n", saved_buffer, *ppMemory);
if (*ppMemory != saved_buffer)
memcpy(*ppMemory, saved_buffer, bufsize);
break;
case RPC_FC_CVARRAY: case RPC_FC_CVARRAY:
esize = *(const WORD*)(pFormat+2); esize = *(const WORD*)(pFormat+2);
alignment = pFormat[1] + 1; alignment = pFormat[1] + 1;
@ -2023,19 +2034,25 @@ static inline void array_read_variance_and_unmarshall(
bufsize = safe_multiply(esize, pStubMsg->ActualCount); bufsize = safe_multiply(esize, pStubMsg->ActualCount);
memsize = safe_multiply(esize, pStubMsg->MaxCount); memsize = safe_multiply(esize, pStubMsg->MaxCount);
offset = pStubMsg->Offset;
if (!fMustAlloc && !*ppMemory) if (fUnmarshall)
fMustAlloc = TRUE; {
if (fMustAlloc) offset = pStubMsg->Offset;
*ppMemory = NdrAllocate(pStubMsg, memsize);
saved_buffer = pStubMsg->BufferMark = pStubMsg->Buffer;
safe_buffer_increment(pStubMsg, bufsize);
EmbeddedPointerUnmarshall(pStubMsg, saved_buffer, *ppMemory, pFormat, fMustAlloc); if (!fMustAlloc && !*ppMemory)
fMustAlloc = TRUE;
if (fMustAlloc)
*ppMemory = NdrAllocate(pStubMsg, memsize);
saved_buffer = pStubMsg->Buffer;
safe_buffer_increment(pStubMsg, bufsize);
memcpy(*ppMemory + offset, saved_buffer, bufsize); pStubMsg->BufferMark = saved_buffer;
break; EmbeddedPointerUnmarshall(pStubMsg, saved_buffer, *ppMemory, pFormat,
fMustAlloc);
memcpy(*ppMemory + offset, saved_buffer, bufsize);
}
return bufsize;
case RPC_FC_C_CSTRING: case RPC_FC_C_CSTRING:
case RPC_FC_C_WSTRING: case RPC_FC_C_WSTRING:
if (fc == RPC_FC_C_CSTRING) if (fc == RPC_FC_C_CSTRING)
@ -2062,29 +2079,32 @@ static inline void array_read_variance_and_unmarshall(
validate_string_data(pStubMsg, bufsize, esize); validate_string_data(pStubMsg, bufsize, esize);
if (fMustAlloc) if (fUnmarshall)
*ppMemory = NdrAllocate(pStubMsg, memsize);
else
{ {
if (fUseBufferMemoryServer && !pStubMsg->IsClient && if (fMustAlloc)
!*ppMemory && (pStubMsg->MaxCount == pStubMsg->ActualCount))
/* if the data in the RPC buffer is big enough, we just point straight
* into it */
*ppMemory = pStubMsg->Buffer;
else if (!*ppMemory)
*ppMemory = NdrAllocate(pStubMsg, memsize); *ppMemory = NdrAllocate(pStubMsg, memsize);
else
{
if (fUseBufferMemoryServer && !pStubMsg->IsClient &&
!*ppMemory && (pStubMsg->MaxCount == pStubMsg->ActualCount))
/* if the data in the RPC buffer is big enough, we just point
* straight into it */
*ppMemory = pStubMsg->Buffer;
else if (!*ppMemory)
*ppMemory = NdrAllocate(pStubMsg, memsize);
}
if (*ppMemory == pStubMsg->Buffer)
safe_buffer_increment(pStubMsg, bufsize);
else
safe_copy_from_buffer(pStubMsg, *ppMemory, bufsize);
if (*pFormat == RPC_FC_C_CSTRING)
TRACE("string=%s\n", debugstr_a((char*)*ppMemory));
else
TRACE("string=%s\n", debugstr_w((LPWSTR)*ppMemory));
} }
return bufsize;
if (*ppMemory == pStubMsg->Buffer)
safe_buffer_increment(pStubMsg, bufsize);
else
safe_copy_from_buffer(pStubMsg, *ppMemory, bufsize);
if (*pFormat == RPC_FC_C_CSTRING)
TRACE("string=%s\n", debugstr_a((char*)*ppMemory));
else
TRACE("string=%s\n", debugstr_w((LPWSTR)*ppMemory));
break;
default: default:
ERR("unknown array format 0x%x\n", fc); ERR("unknown array format 0x%x\n", fc);
RpcRaiseException(RPC_X_BAD_STUB_DATA); RpcRaiseException(RPC_X_BAD_STUB_DATA);
@ -2092,7 +2112,8 @@ static inline void array_read_variance_and_unmarshall(
} }
static inline void array_memory_size( static inline void array_memory_size(
unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat,
unsigned char fHasPointers)
{ {
ULONG bufsize, memsize; ULONG bufsize, memsize;
DWORD esize; DWORD esize;
@ -2110,10 +2131,12 @@ static inline void array_memory_size(
pStubMsg->MemorySize += memsize; pStubMsg->MemorySize += memsize;
ALIGN_POINTER(pStubMsg->Buffer, alignment); ALIGN_POINTER(pStubMsg->Buffer, alignment);
pStubMsg->BufferMark = pStubMsg->Buffer; if (fHasPointers)
pStubMsg->BufferMark = pStubMsg->Buffer;
safe_buffer_increment(pStubMsg, bufsize); safe_buffer_increment(pStubMsg, bufsize);
EmbeddedPointerMemorySize(pStubMsg, pFormat); if (fHasPointers)
EmbeddedPointerMemorySize(pStubMsg, pFormat);
break; break;
case RPC_FC_CVARRAY: case RPC_FC_CVARRAY:
esize = *(const WORD*)(pFormat+2); esize = *(const WORD*)(pFormat+2);
@ -2128,10 +2151,12 @@ static inline void array_memory_size(
pStubMsg->MemorySize += memsize; pStubMsg->MemorySize += memsize;
ALIGN_POINTER(pStubMsg->Buffer, alignment); ALIGN_POINTER(pStubMsg->Buffer, alignment);
pStubMsg->BufferMark = pStubMsg->Buffer; if (fHasPointers)
pStubMsg->BufferMark = pStubMsg->Buffer;
safe_buffer_increment(pStubMsg, bufsize); safe_buffer_increment(pStubMsg, bufsize);
EmbeddedPointerMemorySize(pStubMsg, pFormat); if (fHasPointers)
EmbeddedPointerMemorySize(pStubMsg, pFormat);
break; break;
case RPC_FC_C_CSTRING: case RPC_FC_C_CSTRING:
case RPC_FC_C_WSTRING: case RPC_FC_C_WSTRING:
@ -2170,18 +2195,20 @@ static inline void array_memory_size(
static inline void array_free( static inline void array_free(
unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg,
unsigned char *pMemory, PFORMAT_STRING pFormat) unsigned char *pMemory, PFORMAT_STRING pFormat, unsigned char fHasPointers)
{ {
switch (fc) switch (fc)
{ {
case RPC_FC_CARRAY: case RPC_FC_CARRAY:
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0); pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
EmbeddedPointerFree(pStubMsg, pMemory, pFormat); if (fHasPointers)
EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
break; break;
case RPC_FC_CVARRAY: case RPC_FC_CVARRAY:
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0); pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0); pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
EmbeddedPointerFree(pStubMsg, pMemory, pFormat); if (fHasPointers)
EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
break; break;
case RPC_FC_C_CSTRING: case RPC_FC_C_CSTRING:
case RPC_FC_C_WSTRING: case RPC_FC_C_WSTRING:
@ -2226,11 +2253,15 @@ unsigned char *WINAPI NdrConformantStringMarshall(MIDL_STUB_MESSAGE *pStubMsg,
/* allow compiler to optimise inline function by passing constant into /* allow compiler to optimise inline function by passing constant into
* these functions */ * these functions */
if (pFormat[0] == RPC_FC_C_CSTRING) { if (pFormat[0] == RPC_FC_C_CSTRING) {
array_compute_and_write_conformance(RPC_FC_C_CSTRING, pStubMsg, pszMessage, pFormat); array_compute_and_write_conformance(RPC_FC_C_CSTRING, pStubMsg, pszMessage,
array_write_variance_and_marshall(RPC_FC_C_CSTRING, pStubMsg, pszMessage, pFormat); pFormat);
array_write_variance_and_marshall(RPC_FC_C_CSTRING, pStubMsg, pszMessage,
pFormat, TRUE /* fHasPointers */);
} else { } else {
array_compute_and_write_conformance(RPC_FC_C_CSTRING, pStubMsg, pszMessage, pFormat); array_compute_and_write_conformance(RPC_FC_C_WSTRING, pStubMsg, pszMessage,
array_write_variance_and_marshall(RPC_FC_C_CSTRING, pStubMsg, pszMessage, pFormat); pFormat);
array_write_variance_and_marshall(RPC_FC_C_WSTRING, pStubMsg, pszMessage,
pFormat, TRUE /* fHasPointers */);
} }
return NULL; return NULL;
@ -2252,11 +2283,15 @@ void WINAPI NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
/* allow compiler to optimise inline function by passing constant into /* allow compiler to optimise inline function by passing constant into
* these functions */ * these functions */
if (pFormat[0] == RPC_FC_C_CSTRING) { if (pFormat[0] == RPC_FC_C_CSTRING) {
array_compute_and_size_conformance(RPC_FC_C_CSTRING, pStubMsg, pMemory, pFormat); array_compute_and_size_conformance(RPC_FC_C_CSTRING, pStubMsg, pMemory,
array_buffer_size(RPC_FC_C_CSTRING, pStubMsg, pMemory, pFormat); pFormat);
array_buffer_size(RPC_FC_C_CSTRING, pStubMsg, pMemory, pFormat,
TRUE /* fHasPointers */);
} else { } else {
array_compute_and_size_conformance(RPC_FC_C_WSTRING, pStubMsg, pMemory, pFormat); array_compute_and_size_conformance(RPC_FC_C_WSTRING, pStubMsg, pMemory,
array_buffer_size(RPC_FC_C_WSTRING, pStubMsg, pMemory, pFormat); pFormat);
array_buffer_size(RPC_FC_C_WSTRING, pStubMsg, pMemory, pFormat,
TRUE /* fHasPointers */);
} }
} }
@ -2277,10 +2312,12 @@ ULONG WINAPI NdrConformantStringMemorySize( PMIDL_STUB_MESSAGE pStubMsg,
* these functions */ * these functions */
if (pFormat[0] == RPC_FC_C_CSTRING) { if (pFormat[0] == RPC_FC_C_CSTRING) {
array_read_conformance(RPC_FC_C_CSTRING, pStubMsg, pFormat); array_read_conformance(RPC_FC_C_CSTRING, pStubMsg, pFormat);
array_memory_size(RPC_FC_C_CSTRING, pStubMsg, pFormat); array_memory_size(RPC_FC_C_CSTRING, pStubMsg, pFormat,
TRUE /* fHasPointers */);
} else { } else {
array_read_conformance(RPC_FC_C_WSTRING, pStubMsg, pFormat); array_read_conformance(RPC_FC_C_WSTRING, pStubMsg, pFormat);
array_memory_size(RPC_FC_C_WSTRING, pStubMsg, pFormat); array_memory_size(RPC_FC_C_WSTRING, pStubMsg, pFormat,
TRUE /* fHasPointers */);
} }
return pStubMsg->MemorySize; return pStubMsg->MemorySize;
@ -2306,12 +2343,14 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg
array_read_conformance(RPC_FC_C_CSTRING, pStubMsg, pFormat); array_read_conformance(RPC_FC_C_CSTRING, pStubMsg, pFormat);
array_read_variance_and_unmarshall(RPC_FC_C_CSTRING, pStubMsg, ppMemory, array_read_variance_and_unmarshall(RPC_FC_C_CSTRING, pStubMsg, ppMemory,
pFormat, fMustAlloc, pFormat, fMustAlloc,
TRUE /* fUseBufferMemoryServer */); TRUE /* fUseBufferMemoryServer */,
TRUE /* fUnmarshall */);
} else { } else {
array_read_conformance(RPC_FC_C_WSTRING, pStubMsg, pFormat); array_read_conformance(RPC_FC_C_WSTRING, pStubMsg, pFormat);
array_read_variance_and_unmarshall(RPC_FC_C_WSTRING, pStubMsg, ppMemory, array_read_variance_and_unmarshall(RPC_FC_C_WSTRING, pStubMsg, ppMemory,
pFormat, fMustAlloc, pFormat, fMustAlloc,
TRUE /* fUseBufferMemoryServer */); TRUE /* fUseBufferMemoryServer */,
TRUE /* fUnmarshall */);
} }
return NULL; return NULL;
@ -3266,7 +3305,7 @@ unsigned char * WINAPI NdrComplexStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->ActualCount = count; pStubMsg->ActualCount = count;
pStubMsg->Offset = offset; pStubMsg->Offset = offset;
array_write_variance_and_marshall(conf_array[0], pStubMsg, pMemory, array_write_variance_and_marshall(conf_array[0], pStubMsg, pMemory,
conf_array); conf_array, TRUE /* fHasPointers */);
} }
pStubMsg->Memory = OldMemory; pStubMsg->Memory = OldMemory;
@ -3356,7 +3395,8 @@ unsigned char * WINAPI NdrComplexStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
memset(pMemory, 0, array_size); memset(pMemory, 0, array_size);
array_read_variance_and_unmarshall(conf_array[0], pStubMsg, &pMemory, array_read_variance_and_unmarshall(conf_array[0], pStubMsg, &pMemory,
conf_array, FALSE, conf_array, FALSE,
FALSE /* fUseBufferMemoryServer */); FALSE /* fUseBufferMemoryServer */,
TRUE /* fUnmarshall */);
} }
if (pointer_buffer_mark_set) if (pointer_buffer_mark_set)
@ -3434,7 +3474,8 @@ void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->MaxCount = max_count; pStubMsg->MaxCount = max_count;
pStubMsg->ActualCount = count; pStubMsg->ActualCount = count;
pStubMsg->Offset = offset; pStubMsg->Offset = offset;
array_buffer_size(conf_array[0], pStubMsg, pMemory, conf_array); array_buffer_size(conf_array[0], pStubMsg, pMemory, conf_array,
TRUE /* fHasPointers */);
} }
pStubMsg->Memory = OldMemory; pStubMsg->Memory = OldMemory;
@ -3488,7 +3529,8 @@ ULONG WINAPI NdrComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->MaxCount = max_count; pStubMsg->MaxCount = max_count;
pStubMsg->ActualCount = count; pStubMsg->ActualCount = count;
pStubMsg->Offset = offset; pStubMsg->Offset = offset;
array_memory_size(conf_array[0], pStubMsg, conf_array); array_memory_size(conf_array[0], pStubMsg, conf_array,
TRUE /* fHasPointers */);
} }
return size; return size;
@ -3518,7 +3560,8 @@ void WINAPI NdrComplexStructFree(PMIDL_STUB_MESSAGE pStubMsg,
pMemory = ComplexFree(pStubMsg, pMemory, pFormat, pointer_desc); pMemory = ComplexFree(pStubMsg, pMemory, pFormat, pointer_desc);
if (conf_array) if (conf_array)
array_free(conf_array[0], pStubMsg, pMemory, conf_array); array_free(conf_array[0], pStubMsg, pMemory, conf_array,
TRUE /* fHasPointers */);
pStubMsg->Memory = OldMemory; pStubMsg->Memory = OldMemory;
} }
@ -3539,7 +3582,8 @@ unsigned char * WINAPI NdrConformantArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
array_compute_and_write_conformance(RPC_FC_CARRAY, pStubMsg, pMemory, array_compute_and_write_conformance(RPC_FC_CARRAY, pStubMsg, pMemory,
pFormat); pFormat);
array_write_variance_and_marshall(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat); array_write_variance_and_marshall(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat,
TRUE /* fHasPointers */);
return NULL; return NULL;
} }
@ -3562,7 +3606,8 @@ unsigned char * WINAPI NdrConformantArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
array_read_conformance(RPC_FC_CARRAY, pStubMsg, pFormat); array_read_conformance(RPC_FC_CARRAY, pStubMsg, pFormat);
array_read_variance_and_unmarshall(RPC_FC_CARRAY, pStubMsg, ppMemory, pFormat, array_read_variance_and_unmarshall(RPC_FC_CARRAY, pStubMsg, ppMemory, pFormat,
fMustAlloc, fMustAlloc,
TRUE /* fUseBufferMemoryServer */); TRUE /* fUseBufferMemoryServer */,
TRUE /* fUnmarshall */);
return NULL; return NULL;
} }
@ -3582,7 +3627,8 @@ void WINAPI NdrConformantArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
} }
array_compute_and_size_conformance(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat); array_compute_and_size_conformance(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat);
array_buffer_size(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat); array_buffer_size(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat,
TRUE /* fHasPointers */);
} }
/*********************************************************************** /***********************************************************************
@ -3599,7 +3645,7 @@ ULONG WINAPI NdrConformantArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
} }
array_read_conformance(RPC_FC_CARRAY, pStubMsg, pFormat); array_read_conformance(RPC_FC_CARRAY, pStubMsg, pFormat);
array_memory_size(RPC_FC_CARRAY, pStubMsg, pFormat); array_memory_size(RPC_FC_CARRAY, pStubMsg, pFormat, TRUE /* fHasPointers */);
return pStubMsg->MemorySize; return pStubMsg->MemorySize;
} }
@ -3618,7 +3664,8 @@ void WINAPI NdrConformantArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
RpcRaiseException(RPC_X_BAD_STUB_DATA); RpcRaiseException(RPC_X_BAD_STUB_DATA);
} }
array_free(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat); array_free(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat,
TRUE /* fHasPointers */);
} }
@ -3641,7 +3688,7 @@ unsigned char* WINAPI NdrConformantVaryingArrayMarshall( PMIDL_STUB_MESSAGE pStu
array_compute_and_write_conformance(RPC_FC_CVARRAY, pStubMsg, pMemory, array_compute_and_write_conformance(RPC_FC_CVARRAY, pStubMsg, pMemory,
pFormat); pFormat);
array_write_variance_and_marshall(RPC_FC_CVARRAY, pStubMsg, pMemory, array_write_variance_and_marshall(RPC_FC_CVARRAY, pStubMsg, pMemory,
pFormat); pFormat, TRUE /* fHasPointers */);
return NULL; return NULL;
} }
@ -3667,7 +3714,8 @@ unsigned char* WINAPI NdrConformantVaryingArrayUnmarshall( PMIDL_STUB_MESSAGE pS
array_read_conformance(RPC_FC_CVARRAY, pStubMsg, pFormat); array_read_conformance(RPC_FC_CVARRAY, pStubMsg, pFormat);
array_read_variance_and_unmarshall(RPC_FC_CVARRAY, pStubMsg, ppMemory, array_read_variance_and_unmarshall(RPC_FC_CVARRAY, pStubMsg, ppMemory,
pFormat, fMustAlloc, pFormat, fMustAlloc,
TRUE /* fUseBufferMemoryServer */); TRUE /* fUseBufferMemoryServer */,
TRUE /* fUnmarshall */);
return NULL; return NULL;
} }
@ -3689,7 +3737,8 @@ void WINAPI NdrConformantVaryingArrayFree( PMIDL_STUB_MESSAGE pStubMsg,
return; return;
} }
array_free(RPC_FC_CVARRAY, pStubMsg, pMemory, pFormat); array_free(RPC_FC_CVARRAY, pStubMsg, pMemory, pFormat,
TRUE /* fHasPointers */);
} }
@ -3710,7 +3759,8 @@ void WINAPI NdrConformantVaryingArrayBufferSize( PMIDL_STUB_MESSAGE pStubMsg,
array_compute_and_size_conformance(RPC_FC_CVARRAY, pStubMsg, pMemory, array_compute_and_size_conformance(RPC_FC_CVARRAY, pStubMsg, pMemory,
pFormat); pFormat);
array_buffer_size(RPC_FC_CVARRAY, pStubMsg, pMemory, pFormat); array_buffer_size(RPC_FC_CVARRAY, pStubMsg, pMemory, pFormat,
TRUE /* fHasPointers */);
} }
@ -3730,7 +3780,8 @@ ULONG WINAPI NdrConformantVaryingArrayMemorySize( PMIDL_STUB_MESSAGE pStubMsg,
} }
array_read_conformance(RPC_FC_CVARRAY, pStubMsg, pFormat); array_read_conformance(RPC_FC_CVARRAY, pStubMsg, pFormat);
array_memory_size(RPC_FC_CVARRAY, pStubMsg, pFormat); array_memory_size(RPC_FC_CVARRAY, pStubMsg, pFormat,
TRUE /* fHasPointers */);
return pStubMsg->MemorySize; return pStubMsg->MemorySize;
} }
@ -4541,7 +4592,6 @@ unsigned char * WINAPI NdrConformantVaryingStructMarshall(PMIDL_STUB_MESSAGE pS
{ {
const NDR_CVSTRUCT_FORMAT *pCVStructFormat = (const NDR_CVSTRUCT_FORMAT *)pFormat; const NDR_CVSTRUCT_FORMAT *pCVStructFormat = (const NDR_CVSTRUCT_FORMAT *)pFormat;
PFORMAT_STRING pCVArrayFormat; PFORMAT_STRING pCVArrayFormat;
ULONG esize, bufsize;
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
@ -4555,43 +4605,10 @@ unsigned char * WINAPI NdrConformantVaryingStructMarshall(PMIDL_STUB_MESSAGE pS
pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description + pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description +
pCVStructFormat->offset_to_array_description; pCVStructFormat->offset_to_array_description;
switch (*pCVArrayFormat)
{
case RPC_FC_CVARRAY:
esize = *(const WORD*)(pCVArrayFormat+2);
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size, array_compute_and_write_conformance(*pCVArrayFormat, pStubMsg,
pCVArrayFormat + 4, 0); pMemory + pCVStructFormat->memory_size,
pCVArrayFormat = ComputeVariance(pStubMsg, pMemory + pCVStructFormat->memory_size, pCVArrayFormat);
pCVArrayFormat, 0);
break;
case RPC_FC_C_CSTRING:
TRACE("string=%s\n", debugstr_a((char*)pMemory + pCVStructFormat->memory_size));
pStubMsg->ActualCount = strlen((char*)pMemory + pCVStructFormat->memory_size)+1;
esize = sizeof(char);
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
pCVArrayFormat + 2, 0);
else
pStubMsg->MaxCount = pStubMsg->ActualCount;
break;
case RPC_FC_C_WSTRING:
TRACE("string=%s\n", debugstr_w((LPWSTR)pMemory + pCVStructFormat->memory_size));
pStubMsg->ActualCount = strlenW((LPWSTR)pMemory + pCVStructFormat->memory_size)+1;
esize = sizeof(WCHAR);
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
pCVArrayFormat + 2, 0);
else
pStubMsg->MaxCount = pStubMsg->ActualCount;
break;
default:
ERR("invalid array format type %x\n", *pCVArrayFormat);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return NULL;
}
WriteConformance(pStubMsg);
ALIGN_POINTER_CLEAR(pStubMsg->Buffer, pCVStructFormat->alignment + 1); ALIGN_POINTER_CLEAR(pStubMsg->Buffer, pCVStructFormat->alignment + 1);
@ -4601,12 +4618,9 @@ unsigned char * WINAPI NdrConformantVaryingStructMarshall(PMIDL_STUB_MESSAGE pS
pStubMsg->BufferMark = pStubMsg->Buffer; pStubMsg->BufferMark = pStubMsg->Buffer;
safe_copy_to_buffer(pStubMsg, pMemory, pCVStructFormat->memory_size); safe_copy_to_buffer(pStubMsg, pMemory, pCVStructFormat->memory_size);
WriteVariance(pStubMsg); array_write_variance_and_marshall(*pCVArrayFormat, pStubMsg,
pMemory + pCVStructFormat->memory_size,
bufsize = safe_multiply(esize, pStubMsg->ActualCount); pCVArrayFormat, FALSE /* fHasPointers */);
/* write array part */
safe_copy_to_buffer(pStubMsg, pMemory + pCVStructFormat->memory_size, bufsize);
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat); EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
@ -4623,9 +4637,10 @@ unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE
{ {
const NDR_CVSTRUCT_FORMAT *pCVStructFormat = (const NDR_CVSTRUCT_FORMAT *)pFormat; const NDR_CVSTRUCT_FORMAT *pCVStructFormat = (const NDR_CVSTRUCT_FORMAT *)pFormat;
PFORMAT_STRING pCVArrayFormat; PFORMAT_STRING pCVArrayFormat;
ULONG esize, bufsize; ULONG memsize, bufsize;
unsigned char cvarray_type;
unsigned char *saved_buffer, *saved_array_buffer; unsigned char *saved_buffer, *saved_array_buffer;
ULONG offset;
unsigned char *array_memory;
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
@ -4639,32 +4654,9 @@ unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE
pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description + pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description +
pCVStructFormat->offset_to_array_description; pCVStructFormat->offset_to_array_description;
cvarray_type = *pCVArrayFormat;
switch (cvarray_type) memsize = array_read_conformance(*pCVArrayFormat, pStubMsg,
{ pCVArrayFormat);
case RPC_FC_CVARRAY:
esize = *(const WORD*)(pCVArrayFormat+2);
pCVArrayFormat = ReadConformance(pStubMsg, pCVArrayFormat + 4);
break;
case RPC_FC_C_CSTRING:
esize = sizeof(char);
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
pCVArrayFormat = ReadConformance(pStubMsg, pCVArrayFormat + 2);
else
pCVArrayFormat = ReadConformance(pStubMsg, NULL);
break;
case RPC_FC_C_WSTRING:
esize = sizeof(WCHAR);
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
pCVArrayFormat = ReadConformance(pStubMsg, pCVArrayFormat + 2);
else
pCVArrayFormat = ReadConformance(pStubMsg, NULL);
break;
default:
ERR("invalid array format type %x\n", *pCVArrayFormat);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return NULL;
}
ALIGN_POINTER(pStubMsg->Buffer, pCVStructFormat->alignment + 1); ALIGN_POINTER(pStubMsg->Buffer, pCVStructFormat->alignment + 1);
@ -4673,7 +4665,7 @@ unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE
/* work out how much memory to allocate if we need to do so */ /* work out how much memory to allocate if we need to do so */
if (!*ppMemory || fMustAlloc) if (!*ppMemory || fMustAlloc)
{ {
SIZE_T size = pCVStructFormat->memory_size + safe_multiply(esize, pStubMsg->MaxCount); SIZE_T size = pCVStructFormat->memory_size + memsize;
*ppMemory = NdrAllocate(pStubMsg, size); *ppMemory = NdrAllocate(pStubMsg, size);
} }
@ -4681,13 +4673,15 @@ unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE
saved_buffer = pStubMsg->BufferMark = pStubMsg->Buffer; saved_buffer = pStubMsg->BufferMark = pStubMsg->Buffer;
safe_buffer_increment(pStubMsg, pCVStructFormat->memory_size); safe_buffer_increment(pStubMsg, pCVStructFormat->memory_size);
pCVArrayFormat = ReadVariance(pStubMsg, pCVArrayFormat, pStubMsg->MaxCount); array_memory = *ppMemory + pCVStructFormat->memory_size;
bufsize = array_read_variance_and_unmarshall(*pCVArrayFormat, pStubMsg,
&array_memory, pCVArrayFormat,
FALSE /* fMustAlloc */,
FALSE /* fUseServerBufferMemory */,
FALSE /* fUnmarshall */);
bufsize = safe_multiply(esize, pStubMsg->ActualCount); /* save offset in case unmarshalling pointers changes it */
offset = pStubMsg->Offset;
if ((cvarray_type == RPC_FC_C_CSTRING) ||
(cvarray_type == RPC_FC_C_WSTRING))
validate_string_data(pStubMsg, bufsize, esize);
/* mark the start of the array data */ /* mark the start of the array data */
saved_array_buffer = pStubMsg->Buffer; saved_array_buffer = pStubMsg->Buffer;
@ -4699,11 +4693,12 @@ unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE
memcpy(*ppMemory, saved_buffer, pCVStructFormat->memory_size); memcpy(*ppMemory, saved_buffer, pCVStructFormat->memory_size);
/* copy the array data */ /* copy the array data */
TRACE("copying %p to %p\n", saved_array_buffer, *ppMemory + pCVStructFormat->memory_size); TRACE("copying %p to %p\n", saved_array_buffer, *ppMemory + pCVStructFormat->memory_size);
memcpy(*ppMemory + pCVStructFormat->memory_size, saved_array_buffer, bufsize); memcpy(*ppMemory + pCVStructFormat->memory_size + offset,
saved_array_buffer, bufsize);
if (cvarray_type == RPC_FC_C_CSTRING) if (*pCVArrayFormat == RPC_FC_C_CSTRING)
TRACE("string=%s\n", debugstr_a((char *)(*ppMemory + pCVStructFormat->memory_size))); TRACE("string=%s\n", debugstr_a((char *)(*ppMemory + pCVStructFormat->memory_size)));
else if (cvarray_type == RPC_FC_C_WSTRING) else if (*pCVArrayFormat == RPC_FC_C_WSTRING)
TRACE("string=%s\n", debugstr_w((WCHAR *)(*ppMemory + pCVStructFormat->memory_size))); TRACE("string=%s\n", debugstr_w((WCHAR *)(*ppMemory + pCVStructFormat->memory_size)));
return NULL; return NULL;
@ -4718,7 +4713,6 @@ void WINAPI NdrConformantVaryingStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
{ {
const NDR_CVSTRUCT_FORMAT *pCVStructFormat = (const NDR_CVSTRUCT_FORMAT *)pFormat; const NDR_CVSTRUCT_FORMAT *pCVStructFormat = (const NDR_CVSTRUCT_FORMAT *)pFormat;
PFORMAT_STRING pCVArrayFormat; PFORMAT_STRING pCVArrayFormat;
ULONG esize;
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
@ -4732,51 +4726,19 @@ void WINAPI NdrConformantVaryingStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description + pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description +
pCVStructFormat->offset_to_array_description; pCVStructFormat->offset_to_array_description;
switch (*pCVArrayFormat) array_compute_and_size_conformance(*pCVArrayFormat, pStubMsg,
{ pMemory + pCVStructFormat->memory_size,
case RPC_FC_CVARRAY: pCVArrayFormat);
esize = *(const WORD*)(pCVArrayFormat+2);
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
pCVArrayFormat + 4, 0);
pCVArrayFormat = ComputeVariance(pStubMsg, pMemory + pCVStructFormat->memory_size,
pCVArrayFormat, 0);
break;
case RPC_FC_C_CSTRING:
TRACE("string=%s\n", debugstr_a((char*)pMemory + pCVStructFormat->memory_size));
pStubMsg->ActualCount = strlen((char*)pMemory + pCVStructFormat->memory_size)+1;
esize = sizeof(char);
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
pCVArrayFormat + 2, 0);
else
pStubMsg->MaxCount = pStubMsg->ActualCount;
break;
case RPC_FC_C_WSTRING:
TRACE("string=%s\n", debugstr_w((LPWSTR)pMemory + pCVStructFormat->memory_size));
pStubMsg->ActualCount = strlenW((LPWSTR)pMemory + pCVStructFormat->memory_size)+1;
esize = sizeof(WCHAR);
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
pCVArrayFormat + 2, 0);
else
pStubMsg->MaxCount = pStubMsg->ActualCount;
break;
default:
ERR("invalid array format type %x\n", *pCVArrayFormat);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return;
}
SizeConformance(pStubMsg);
ALIGN_LENGTH(pStubMsg->BufferLength, pCVStructFormat->alignment + 1); ALIGN_LENGTH(pStubMsg->BufferLength, pCVStructFormat->alignment + 1);
TRACE("memory_size = %d\n", pCVStructFormat->memory_size); TRACE("memory_size = %d\n", pCVStructFormat->memory_size);
safe_buffer_length_increment(pStubMsg, pCVStructFormat->memory_size); safe_buffer_length_increment(pStubMsg, pCVStructFormat->memory_size);
SizeVariance(pStubMsg);
safe_buffer_length_increment(pStubMsg, safe_multiply(pStubMsg->MaxCount, esize)); array_buffer_size(*pCVArrayFormat, pStubMsg,
pMemory + pCVStructFormat->memory_size, pCVArrayFormat,
FALSE /* fHasPointers */);
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat); EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
} }
@ -4789,8 +4751,6 @@ ULONG WINAPI NdrConformantVaryingStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
{ {
const NDR_CVSTRUCT_FORMAT *pCVStructFormat = (const NDR_CVSTRUCT_FORMAT *)pFormat; const NDR_CVSTRUCT_FORMAT *pCVStructFormat = (const NDR_CVSTRUCT_FORMAT *)pFormat;
PFORMAT_STRING pCVArrayFormat; PFORMAT_STRING pCVArrayFormat;
ULONG esize;
unsigned char cvarray_type;
TRACE("(%p, %p)\n", pStubMsg, pFormat); TRACE("(%p, %p)\n", pStubMsg, pFormat);
@ -4804,46 +4764,21 @@ ULONG WINAPI NdrConformantVaryingStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description + pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description +
pCVStructFormat->offset_to_array_description; pCVStructFormat->offset_to_array_description;
cvarray_type = *pCVArrayFormat; array_read_conformance(*pCVArrayFormat, pStubMsg, pCVArrayFormat);
switch (cvarray_type)
{
case RPC_FC_CVARRAY:
esize = *(const WORD*)(pCVArrayFormat+2);
pCVArrayFormat = ReadConformance(pStubMsg, pCVArrayFormat + 4);
break;
case RPC_FC_C_CSTRING:
esize = sizeof(char);
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
pCVArrayFormat = ReadConformance(pStubMsg, pCVArrayFormat + 2);
else
pCVArrayFormat = ReadConformance(pStubMsg, NULL);
break;
case RPC_FC_C_WSTRING:
esize = sizeof(WCHAR);
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
pCVArrayFormat = ReadConformance(pStubMsg, pCVArrayFormat + 2);
else
pCVArrayFormat = ReadConformance(pStubMsg, NULL);
break;
default:
ERR("invalid array format type %x\n", *pCVArrayFormat);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return 0;
}
ALIGN_POINTER(pStubMsg->Buffer, pCVStructFormat->alignment + 1); ALIGN_POINTER(pStubMsg->Buffer, pCVStructFormat->alignment + 1);
TRACE("memory_size = %d\n", pCVStructFormat->memory_size); TRACE("memory_size = %d\n", pCVStructFormat->memory_size);
safe_buffer_increment(pStubMsg, pCVStructFormat->memory_size); safe_buffer_increment(pStubMsg, pCVStructFormat->memory_size);
pCVArrayFormat = ReadVariance(pStubMsg, pCVArrayFormat, pStubMsg->MaxCount); array_memory_size(*pCVArrayFormat, pStubMsg, pCVArrayFormat,
safe_buffer_increment(pStubMsg, safe_multiply(esize, pStubMsg->ActualCount)); FALSE /* fHasPointers */);
pStubMsg->MemorySize += pCVStructFormat->memory_size + safe_multiply(esize, pStubMsg->MaxCount); pStubMsg->MemorySize += pCVStructFormat->memory_size;
EmbeddedPointerMemorySize(pStubMsg, pFormat); EmbeddedPointerMemorySize(pStubMsg, pFormat);
return pCVStructFormat->memory_size + pStubMsg->MaxCount * esize; return pStubMsg->MemorySize;
} }
/*********************************************************************** /***********************************************************************
@ -4868,37 +4803,9 @@ void WINAPI NdrConformantVaryingStructFree(PMIDL_STUB_MESSAGE pStubMsg,
pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description + pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description +
pCVStructFormat->offset_to_array_description; pCVStructFormat->offset_to_array_description;
switch (*pCVArrayFormat) array_free(*pCVArrayFormat, pStubMsg,
{ pMemory + pCVStructFormat->memory_size, pCVArrayFormat,
case RPC_FC_CVARRAY: FALSE /* fHasPointers */);
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
pCVArrayFormat + 4, 0);
pCVArrayFormat = ComputeVariance(pStubMsg, pMemory + pCVStructFormat->memory_size,
pCVArrayFormat, 0);
break;
case RPC_FC_C_CSTRING:
TRACE("string=%s\n", debugstr_a((char*)pMemory + pCVStructFormat->memory_size));
pStubMsg->ActualCount = strlen((char*)pMemory + pCVStructFormat->memory_size)+1;
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
pCVArrayFormat + 2, 0);
else
pStubMsg->MaxCount = pStubMsg->ActualCount;
break;
case RPC_FC_C_WSTRING:
TRACE("string=%s\n", debugstr_w((LPWSTR)pMemory + pCVStructFormat->memory_size));
pStubMsg->ActualCount = strlenW((LPWSTR)pMemory + pCVStructFormat->memory_size)+1;
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
pCVArrayFormat + 2, 0);
else
pStubMsg->MaxCount = pStubMsg->ActualCount;
break;
default:
ERR("invalid array format type %x\n", *pCVArrayFormat);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return;
}
TRACE("memory_size = %d\n", pCVStructFormat->memory_size); TRACE("memory_size = %d\n", pCVStructFormat->memory_size);