#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
#define STD_OVERFLOW_CHECK(_Msg) do { \
- TRACE("buffer=%d/%ld\n", _Msg->Buffer - _Msg->BufferStart, _Msg->BufferLength); \
- if (_Msg->Buffer > _Msg->BufferEnd) ERR("buffer overflow %d bytes\n", _Msg->Buffer - _Msg->BufferEnd); \
+ TRACE("buffer=%d/%ld\n", _Msg->Buffer - (unsigned char *)_Msg->RpcMsg->Buffer, _Msg->BufferLength); \
+ if (_Msg->Buffer > (unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength) \
+ ERR("buffer overflow %d bytes\n", _Msg->Buffer - ((unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength)); \
} while (0)
#define NDR_TABLE_SIZE 128
#define NDR_TABLE_MASK 127
+static unsigned char *WINAPI NdrBaseTypeMarshall(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING);
+static unsigned char *WINAPI NdrBaseTypeUnmarshall(PMIDL_STUB_MESSAGE, unsigned char **, PFORMAT_STRING, unsigned char);
+static void WINAPI NdrBaseTypeBufferSize(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING);
+static void WINAPI NdrBaseTypeFree(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING);
+static unsigned long WINAPI NdrBaseTypeMemorySize(PMIDL_STUB_MESSAGE, PFORMAT_STRING);
+
NDR_MARSHALL NdrMarshaller[NDR_TABLE_SIZE] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- /* 0x10 */
0,
+ NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall,
+ NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall,
+ NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall,
+ NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall,
+ /* 0x10 */
+ NdrBaseTypeMarshall,
/* 0x11 */
NdrPointerMarshall, NdrPointerMarshall,
NdrPointerMarshall, NdrPointerMarshall,
/* 0x15 */
NdrSimpleStructMarshall, NdrSimpleStructMarshall,
- 0, 0, 0,
+ NdrConformantStructMarshall, NdrConformantStructMarshall,
+ NdrConformantVaryingStructMarshall,
NdrComplexStructMarshall,
/* 0x1b */
- NdrConformantArrayMarshall, 0, 0, 0, 0, 0,
+ NdrConformantArrayMarshall,
+ NdrConformantVaryingArrayMarshall,
+ NdrFixedArrayMarshall, NdrFixedArrayMarshall,
+ NdrVaryingArrayMarshall, NdrVaryingArrayMarshall,
NdrComplexArrayMarshall,
/* 0x22 */
NdrConformantStringMarshall, 0, 0,
- NdrConformantStringMarshall, 0, 0, 0, 0,
+ NdrConformantStringMarshall,
+ NdrNonConformantStringMarshall, 0, 0, 0,
/* 0x2a */
- 0, 0, 0, 0, 0,
+ NdrEncapsulatedUnionMarshall,
+ NdrNonEncapsulatedUnionMarshall,
+ 0,
+ NdrXmitOrRepAsMarshall, NdrXmitOrRepAsMarshall,
/* 0x2f */
NdrInterfacePointerMarshall,
/* 0xb0 */
NdrUserMarshalMarshall
};
NDR_UNMARSHALL NdrUnmarshaller[NDR_TABLE_SIZE] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- /* 0x10 */
0,
+ NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall,
+ NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall,
+ NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall,
+ NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall,
+ /* 0x10 */
+ NdrBaseTypeUnmarshall,
/* 0x11 */
NdrPointerUnmarshall, NdrPointerUnmarshall,
NdrPointerUnmarshall, NdrPointerUnmarshall,
/* 0x15 */
NdrSimpleStructUnmarshall, NdrSimpleStructUnmarshall,
- 0, 0, 0,
+ NdrConformantStructUnmarshall, NdrConformantStructUnmarshall,
+ NdrConformantVaryingStructUnmarshall,
NdrComplexStructUnmarshall,
/* 0x1b */
- NdrConformantArrayUnmarshall, 0, 0, 0, 0, 0,
+ NdrConformantArrayUnmarshall,
+ NdrConformantVaryingArrayUnmarshall,
+ NdrFixedArrayUnmarshall, NdrFixedArrayUnmarshall,
+ NdrVaryingArrayUnmarshall, NdrVaryingArrayUnmarshall,
NdrComplexArrayUnmarshall,
/* 0x22 */
NdrConformantStringUnmarshall, 0, 0,
- NdrConformantStringUnmarshall, 0, 0, 0, 0,
+ NdrConformantStringUnmarshall,
+ NdrNonConformantStringUnmarshall, 0, 0, 0,
/* 0x2a */
- 0, 0, 0, 0, 0,
+ NdrEncapsulatedUnionUnmarshall,
+ NdrNonEncapsulatedUnionUnmarshall,
+ 0,
+ NdrXmitOrRepAsUnmarshall, NdrXmitOrRepAsUnmarshall,
/* 0x2f */
NdrInterfacePointerUnmarshall,
/* 0xb0 */
NdrUserMarshalUnmarshall
};
NDR_BUFFERSIZE NdrBufferSizer[NDR_TABLE_SIZE] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- /* 0x10 */
0,
+ NdrBaseTypeBufferSize, NdrBaseTypeBufferSize, NdrBaseTypeBufferSize,
+ NdrBaseTypeBufferSize, NdrBaseTypeBufferSize, NdrBaseTypeBufferSize, NdrBaseTypeBufferSize,
+ NdrBaseTypeBufferSize, NdrBaseTypeBufferSize, NdrBaseTypeBufferSize, NdrBaseTypeBufferSize,
+ NdrBaseTypeBufferSize, NdrBaseTypeBufferSize, NdrBaseTypeBufferSize, NdrBaseTypeBufferSize,
+ /* 0x10 */
+ NdrBaseTypeBufferSize,
/* 0x11 */
NdrPointerBufferSize, NdrPointerBufferSize,
NdrPointerBufferSize, NdrPointerBufferSize,
/* 0x15 */
NdrSimpleStructBufferSize, NdrSimpleStructBufferSize,
- 0, 0, 0,
+ NdrConformantStructBufferSize, NdrConformantStructBufferSize,
+ NdrConformantVaryingStructBufferSize,
NdrComplexStructBufferSize,
/* 0x1b */
- NdrConformantArrayBufferSize, 0, 0, 0, 0, 0,
+ NdrConformantArrayBufferSize,
+ NdrConformantVaryingArrayBufferSize,
+ NdrFixedArrayBufferSize, NdrFixedArrayBufferSize,
+ NdrVaryingArrayBufferSize, NdrVaryingArrayBufferSize,
NdrComplexArrayBufferSize,
/* 0x22 */
NdrConformantStringBufferSize, 0, 0,
- NdrConformantStringBufferSize, 0, 0, 0, 0,
+ NdrConformantStringBufferSize,
+ NdrNonConformantStringBufferSize, 0, 0, 0,
/* 0x2a */
- 0, 0, 0, 0, 0,
+ NdrEncapsulatedUnionBufferSize,
+ NdrNonEncapsulatedUnionBufferSize,
+ 0,
+ NdrXmitOrRepAsBufferSize, NdrXmitOrRepAsBufferSize,
/* 0x2f */
NdrInterfacePointerBufferSize,
/* 0xb0 */
NdrUserMarshalBufferSize
};
NDR_MEMORYSIZE NdrMemorySizer[NDR_TABLE_SIZE] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- /* 0x10 */
0,
+ NdrBaseTypeMemorySize, NdrBaseTypeMemorySize, NdrBaseTypeMemorySize,
+ NdrBaseTypeMemorySize, NdrBaseTypeMemorySize, NdrBaseTypeMemorySize, NdrBaseTypeMemorySize,
+ NdrBaseTypeMemorySize, NdrBaseTypeMemorySize, NdrBaseTypeMemorySize, NdrBaseTypeMemorySize,
+ NdrBaseTypeMemorySize, NdrBaseTypeMemorySize, NdrBaseTypeMemorySize, NdrBaseTypeMemorySize,
+ /* 0x10 */
+ NdrBaseTypeMemorySize,
/* 0x11 */
NdrPointerMemorySize, NdrPointerMemorySize,
NdrPointerMemorySize, NdrPointerMemorySize,
NdrComplexArrayMemorySize,
/* 0x22 */
NdrConformantStringMemorySize, 0, 0,
- NdrConformantStringMemorySize, 0, 0, 0, 0,
+ NdrConformantStringMemorySize,
+ NdrNonConformantStringMemorySize, 0, 0, 0,
/* 0x2a */
0, 0, 0, 0, 0,
/* 0x2f */
NdrUserMarshalMemorySize
};
NDR_FREE NdrFreer[NDR_TABLE_SIZE] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- /* 0x10 */
0,
+ NdrBaseTypeFree, NdrBaseTypeFree, NdrBaseTypeFree,
+ NdrBaseTypeFree, NdrBaseTypeFree, NdrBaseTypeFree, NdrBaseTypeFree,
+ NdrBaseTypeFree, NdrBaseTypeFree, NdrBaseTypeFree, NdrBaseTypeFree,
+ NdrBaseTypeFree, NdrBaseTypeFree, NdrBaseTypeFree, NdrBaseTypeFree,
+ /* 0x10 */
+ NdrBaseTypeFree,
/* 0x11 */
NdrPointerFree, NdrPointerFree,
NdrPointerFree, NdrPointerFree,
/* 0x15 */
NdrSimpleStructFree, NdrSimpleStructFree,
- 0, 0, 0,
+ NdrConformantStructFree, NdrConformantStructFree,
+ NdrConformantVaryingStructFree,
NdrComplexStructFree,
/* 0x1b */
- NdrConformantArrayFree, 0, 0, 0, 0, 0,
+ NdrConformantArrayFree,
+ NdrConformantVaryingArrayFree,
+ NdrFixedArrayFree, NdrFixedArrayFree,
+ NdrVaryingArrayFree, NdrVaryingArrayFree,
NdrComplexArrayFree,
/* 0x22 */
- 0, 0, 0, 0, 0, 0, 0, 0,
- /* 0x2a */
+ 0, 0, 0,
0, 0, 0, 0, 0,
+ /* 0x2a */
+ NdrEncapsulatedUnionFree,
+ NdrNonEncapsulatedUnionFree,
+ 0,
+ NdrXmitOrRepAsFree, NdrXmitOrRepAsFree,
/* 0x2f */
NdrInterfacePointerFree,
/* 0xb0 */
return pFormat+4;
}
-PFORMAT_STRING ComputeConformance(MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pMemory,
- PFORMAT_STRING pFormat, ULONG_PTR def)
+static inline PFORMAT_STRING ReadVariance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
+{
+ pStubMsg->ActualCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
+ pStubMsg->Buffer += 4;
+ TRACE("unmarshalled variance is %ld\n", pStubMsg->ActualCount);
+ return pFormat+4;
+}
+
+PFORMAT_STRING ComputeConformanceOrVariance(
+ MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pMemory,
+ PFORMAT_STRING pFormat, ULONG_PTR def, ULONG *pCount)
{
BYTE dtype = pFormat[0] & 0xf;
- DWORD ofs = (DWORD)pFormat[2] | ((DWORD)pFormat[3] << 8);
+ short ofs = *(short *)&pFormat[2];
LPVOID ptr = NULL;
DWORD data = 0;
+ /* FIXME: is this correct? */
if (pFormat[0] == 0xff) {
/* null descriptor */
- pStubMsg->MaxCount = def;
+ *pCount = def;
goto finish_conf;
}
switch (pFormat[0] & 0xf0) {
case RPC_FC_NORMAL_CONFORMANCE:
- TRACE("normal conformance, ofs=%ld\n", ofs);
+ TRACE("normal conformance, ofs=%d\n", ofs);
ptr = pMemory + ofs;
break;
case RPC_FC_POINTER_CONFORMANCE:
- TRACE("pointer conformance, ofs=%ld\n", ofs);
+ TRACE("pointer conformance, ofs=%d\n", ofs);
ptr = pStubMsg->Memory + ofs;
break;
case RPC_FC_TOP_LEVEL_CONFORMANCE:
- TRACE("toplevel conformance, ofs=%ld\n", ofs);
+ TRACE("toplevel conformance, ofs=%d\n", ofs);
if (pStubMsg->StackTop) {
ptr = pStubMsg->StackTop + ofs;
}
else {
- /* -Os mode, MaxCount is already set */
+ /* -Os mode, *pCount is already set */
goto finish_conf;
}
break;
case RPC_FC_CONSTANT_CONFORMANCE:
data = ofs | ((DWORD)pFormat[1] << 16);
TRACE("constant conformance, val=%ld\n", data);
- pStubMsg->MaxCount = data;
+ *pCount = data;
goto finish_conf;
case RPC_FC_TOP_LEVEL_MULTID_CONFORMANCE:
- FIXME("toplevel multidimensional conformance, ofs=%ld\n", ofs);
+ FIXME("toplevel multidimensional conformance, ofs=%d\n", ofs);
if (pStubMsg->StackTop) {
ptr = pStubMsg->StackTop + ofs;
}
ptr = *(LPVOID*)ptr;
break;
case RPC_FC_CALLBACK:
+ {
+ unsigned char *old_stack_top = pStubMsg->StackTop;
+ pStubMsg->StackTop = ptr;
+
/* ofs is index into StubDesc->apfnExprEval */
- FIXME("handle callback\n");
+ TRACE("callback conformance into apfnExprEval[%d]\n", ofs);
+ pStubMsg->StubDesc->apfnExprEval[ofs](pStubMsg);
+
+ pStubMsg->StackTop = old_stack_top;
goto finish_conf;
+ }
default:
break;
}
done_conf_grab:
switch (pFormat[1]) {
case 0: /* no op */
- pStubMsg->MaxCount = data;
+ *pCount = data;
break;
case RPC_FC_DEREFERENCE:
/* already handled */
}
finish_conf:
- TRACE("resulting conformance is %ld\n", pStubMsg->MaxCount);
+ TRACE("resulting conformance is %ld\n", *pCount);
return pFormat+4;
}
}
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;
+ TRACE("string=%s\n", debugstr_a((char*)pMemory));
+ pStubMsg->BufferLength += strlen((char*)pMemory) + 13 + BUFFER_PARANOIA;
}
else if (*pFormat == RPC_FC_C_WSTRING) {
/* we need 12 octets for the [maxlen, offset, len] DWORDS, + 2 octets for L'\0' */
unsigned char** ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc )
{
unsigned long len, esize, ofs;
- unsigned char *pMem;
TRACE("(pStubMsg == ^%p, *pMemory == ^%p, pFormat == ^%p, fMustAlloc == %u)\n",
pStubMsg, *ppMemory, pFormat, fMustAlloc);
FIXME("sized string format=%d\n", pFormat[1]);
}
- if (fMustAlloc) {
+ if (fMustAlloc || !*ppMemory)
*ppMemory = NdrAllocate(pStubMsg, len*esize + BUFFER_PARANOIA);
- } else {
- if (pStubMsg->ReuseBuffer && !*ppMemory)
- /* for servers, we may just point straight into the RPC buffer, I think
- * (I guess that's what MS does since MIDL code doesn't try to free) */
- *ppMemory = pStubMsg->Buffer - ofs*esize;
- /* for clients, memory should be provided by caller */
- }
- if (len == 0) {
- *ppMemory = NULL;
- return NULL;
- }
-
- pMem = *ppMemory + ofs*esize;
-
- if (pMem != pStubMsg->Buffer)
- memcpy(pMem, pStubMsg->Buffer, len*esize);
+ memcpy(*ppMemory, pStubMsg->Buffer, len*esize);
pStubMsg->Buffer += len*esize;
if (*pFormat == RPC_FC_C_CSTRING) {
- TRACE("string=%s\n", debugstr_a(pMem));
+ TRACE("string=%s\n", debugstr_a((char*)*ppMemory));
}
else if (*pFormat == RPC_FC_C_WSTRING) {
- TRACE("string=%s\n", debugstr_w((LPWSTR)pMem));
+ TRACE("string=%s\n", debugstr_w((LPWSTR)*ppMemory));
}
return NULL; /* FIXME: is this always right? */
}
+/***********************************************************************
+ * NdrNonConformantStringMarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrNonConformantStringMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrNonConformantStringUnmarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrNonConformantStringUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char **ppMemory,
+ PFORMAT_STRING pFormat,
+ unsigned char fMustAlloc)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrNonConformantStringBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrNonConformantStringMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrNonConformantStringMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return 0;
+}
+
+static inline void dump_pointer_attr(unsigned char attr)
+{
+ if (attr & RPC_FC_P_ALLOCALLNODES)
+ TRACE(" RPC_FC_P_ALLOCALLNODES");
+ if (attr & RPC_FC_P_DONTFREE)
+ TRACE(" RPC_FC_P_DONTFREE");
+ if (attr & RPC_FC_P_ONSTACK)
+ TRACE(" RPC_FC_P_ONSTACK");
+ if (attr & RPC_FC_P_SIMPLEPOINTER)
+ TRACE(" RPC_FC_P_SIMPLEPOINTER");
+ if (attr & RPC_FC_P_DEREF)
+ TRACE(" RPC_FC_P_DEREF");
+ TRACE("\n");
+}
+
/***********************************************************************
* PointerMarshall
*/
NDR_MARSHALL m;
TRACE("(%p,%p,%p,%p)\n", pStubMsg, Buffer, Pointer, pFormat);
- TRACE("type=%d, attr=%d\n", type, attr);
+ TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
pFormat += 2;
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
else desc = pFormat + *(const SHORT*)pFormat;
TRACE("deref => %p\n", Pointer);
}
- *(LPVOID*)Buffer = 0;
-
switch (type) {
case RPC_FC_RP: /* ref pointer (always non-null) */
+#if 0 /* this causes problems for InstallShield so is disabled - we need more tests */
+ if (!Pointer)
+ RpcRaiseException(RPC_X_NULL_REF_POINTER);
+#endif
break;
case RPC_FC_UP: /* unique pointer */
+ case RPC_FC_OP: /* object pointer - same as unique here */
+ TRACE("writing %p to buffer\n", Pointer);
+ NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, (unsigned long)Pointer);
+ pStubMsg->Buffer += 4;
break;
+ case RPC_FC_FP:
default:
FIXME("unhandled ptr type=%02x\n", type);
+ RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
- m = NdrMarshaller[*desc & NDR_TABLE_MASK];
- if (m) m(pStubMsg, Pointer, desc);
- else FIXME("no marshaller for data type=%02x\n", *desc);
+ TRACE("calling marshaller for type 0x%x\n", (int)*desc);
+
+ if (Pointer) {
+ m = NdrMarshaller[*desc & NDR_TABLE_MASK];
+ if (m) m(pStubMsg, Pointer, desc);
+ else FIXME("no marshaller for data type=%02x\n", *desc);
+ }
STD_OVERFLOW_CHECK(pStubMsg);
}
unsigned type = pFormat[0], attr = pFormat[1];
PFORMAT_STRING desc;
NDR_UNMARSHALL m;
+ DWORD pointer_id = 0;
TRACE("(%p,%p,%p,%p,%d)\n", pStubMsg, Buffer, pPointer, pFormat, fMustAlloc);
- TRACE("type=%d, attr=%d\n", type, attr);
+ TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
pFormat += 2;
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
else desc = pFormat + *(const SHORT*)pFormat;
switch (type) {
case RPC_FC_RP: /* ref pointer (always non-null) */
+ pointer_id = ~0UL;
break;
case RPC_FC_UP: /* unique pointer */
+ pointer_id = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
+ pStubMsg->Buffer += 4;
break;
+ case RPC_FC_OP: /* object pointer - we must free data before overwriting it */
+ pointer_id = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
+ pStubMsg->Buffer += 4;
+ if (*pPointer)
+ FIXME("free object pointer %p\n", *pPointer);
+ break;
+ case RPC_FC_FP:
default:
FIXME("unhandled ptr type=%02x\n", type);
+ RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
- *pPointer = NULL;
+ if (pointer_id) {
+ m = NdrUnmarshaller[*desc & NDR_TABLE_MASK];
+ if (m) m(pStubMsg, pPointer, desc, fMustAlloc);
+ else FIXME("no unmarshaller for data type=%02x\n", *desc);
+ }
- m = NdrUnmarshaller[*desc & NDR_TABLE_MASK];
- if (m) m(pStubMsg, pPointer, desc, fMustAlloc);
- else FIXME("no unmarshaller for data type=%02x\n", *desc);
TRACE("pointer=%p\n", *pPointer);
}
switch (type) {
case RPC_FC_RP: /* ref pointer (always non-null) */
break;
- case RPC_FC_UP: /* unique pointer */
+ case RPC_FC_OP:
+ case RPC_FC_UP:
+ pStubMsg->BufferLength += 4;
+ /* NULL pointer has no further representation */
+ if (!Pointer)
+ return;
break;
+ case RPC_FC_FP:
default:
FIXME("unhandled ptr type=%02x\n", type);
+ RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
m = NdrBufferSizer[*desc & NDR_TABLE_MASK];
NDR_MEMORYSIZE m;
FIXME("(%p,%p,%p): stub\n", pStubMsg, Buffer, pFormat);
- TRACE("type=%d, attr=%d\n", type, attr);
+ TRACE("type=%d, attr=", type); dump_pointer_attr(attr);
pFormat += 2;
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
else desc = pFormat + *(const SHORT*)pFormat;
break;
default:
FIXME("unhandled ptr type=%02x\n", type);
+ RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
m = NdrMemorySizer[*desc & NDR_TABLE_MASK];
NDR_FREE m;
TRACE("(%p,%p,%p)\n", pStubMsg, Pointer, pFormat);
- TRACE("type=%d, attr=%d\n", type, attr);
+ TRACE("type=%d, attr=", type); dump_pointer_attr(attr);
if (attr & RPC_FC_P_DONTFREE) return;
pFormat += 2;
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
pStubMsg->BufferMark = pStubMsg->Buffer;
PointerMarshall(pStubMsg, pStubMsg->Buffer, pMemory, pFormat);
- pStubMsg->Buffer += 4;
STD_OVERFLOW_CHECK(pStubMsg);
pStubMsg->BufferMark = pStubMsg->Buffer;
PointerUnmarshall(pStubMsg, pStubMsg->Buffer, ppMemory, pFormat, fMustAlloc);
- pStubMsg->Buffer += 4;
return NULL;
}
PFORMAT_STRING pFormat)
{
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
- pStubMsg->BufferLength += 4;
PointerBufferSize(pStubMsg, pMemory, pFormat);
}
break;
case RPC_FC_LONG:
case RPC_FC_ULONG:
+ case RPC_FC_ENUM32:
TRACE("long=%ld <= %p\n", *(DWORD*)pMemory, pMemory);
memcpy(pStubMsg->Buffer, pMemory, 4);
pStubMsg->Buffer += 4;
case RPC_FC_ALIGNM8:
ALIGN_POINTER(pMemory, 7);
break;
+ case RPC_FC_STRUCTPAD2:
+ pMemory += 2;
+ break;
case RPC_FC_EMBEDDED_COMPLEX:
pMemory += pFormat[1];
pFormat += 2;
break;
case RPC_FC_LONG:
case RPC_FC_ULONG:
+ case RPC_FC_ENUM32:
memcpy(pMemory, pStubMsg->Buffer, 4);
TRACE("long=%ld => %p\n", *(DWORD*)pMemory, pMemory);
pStubMsg->Buffer += 4;
case RPC_FC_ALIGNM8:
ALIGN_POINTER(pMemory, 7);
break;
+ case RPC_FC_STRUCTPAD2:
+ pMemory += 2;
+ break;
case RPC_FC_EMBEDDED_COMPLEX:
pMemory += pFormat[1];
pFormat += 2;
break;
case RPC_FC_LONG:
case RPC_FC_ULONG:
+ case RPC_FC_ENUM32:
pStubMsg->BufferLength += 4;
pMemory += 4;
break;
case RPC_FC_ALIGNM8:
ALIGN_POINTER(pMemory, 7);
break;
+ case RPC_FC_STRUCTPAD2:
+ pMemory += 2;
+ break;
case RPC_FC_EMBEDDED_COMPLEX:
pMemory += pFormat[1];
pFormat += 2;
break;
case RPC_FC_LONG:
case RPC_FC_ULONG:
+ case RPC_FC_ENUM32:
pMemory += 4;
break;
case RPC_FC_POINTER:
case RPC_FC_ALIGNM8:
ALIGN_POINTER(pMemory, 7);
break;
+ case RPC_FC_STRUCTPAD2:
+ pMemory += 2;
+ break;
case RPC_FC_EMBEDDED_COMPLEX:
pMemory += pFormat[1];
pFormat += 2;
case RPC_FC_ALIGNM8:
ALIGN_LENGTH(size, 7);
break;
+ case RPC_FC_STRUCTPAD2:
+ size += 2;
+ break;
case RPC_FC_EMBEDDED_COMPLEX:
size += pFormat[1];
pFormat += 2;
pFormat = ReadConformance(pStubMsg, pFormat+4);
size = pStubMsg->MaxCount;
- if (fMustAlloc) {
+ if (fMustAlloc || !*ppMemory)
*ppMemory = NdrAllocate(pStubMsg, size*esize);
- memcpy(*ppMemory, pStubMsg->Buffer, size*esize);
- } else {
- if (pStubMsg->ReuseBuffer && !*ppMemory)
- /* for servers, we may just point straight into the RPC buffer, I think
- * (I guess that's what MS does since MIDL code doesn't try to free) */
- *ppMemory = pStubMsg->Buffer;
- else
- /* for clients, memory should be provided by caller */
- memcpy(*ppMemory, pStubMsg->Buffer, size*esize);
- }
+
+ memcpy(*ppMemory, pStubMsg->Buffer, size*esize);
pStubMsg->BufferMark = pStubMsg->Buffer;
pStubMsg->Buffer += size*esize;
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
size = pStubMsg->MaxCount;
- pStubMsg->BufferLength += size*esize;
+ /* conformance value plus array */
+ pStubMsg->BufferLength += sizeof(DWORD) + size*esize;
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
}
unsigned long WINAPI NdrConformantArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat)
{
- DWORD size = 0;
- FIXME("(%p,%p): stub\n", pStubMsg, pFormat);
+ DWORD size = 0, esize = *(const WORD*)(pFormat+2);
+ unsigned char *buffer;
+
+ TRACE("(%p,%p)\n", pStubMsg, pFormat);
if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]);
+ buffer = pStubMsg->Buffer;
pFormat = ReadConformance(pStubMsg, pFormat+4);
+ pStubMsg->Buffer = buffer;
size = pStubMsg->MaxCount;
- EmbeddedPointerMemorySize(pStubMsg, pFormat);
-
- return 0;
+ return size*esize;
}
/***********************************************************************
unsigned char* pMemory,
PFORMAT_STRING pFormat )
{
- FIXME( "stub\n" );
+ DWORD esize = *(const WORD*)(pFormat+2);
+
+ TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
+
+ if (pFormat[0] != RPC_FC_CVARRAY)
+ {
+ ERR("invalid format type %x\n", pFormat[0]);
+ RpcRaiseException(RPC_S_INTERNAL_ERROR);
+ return NULL;
+ }
+
+ pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
+ pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
+
+ NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->MaxCount);
+ pStubMsg->Buffer += 4;
+ NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->Offset);
+ pStubMsg->Buffer += 4;
+ NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->ActualCount);
+ pStubMsg->Buffer += 4;
+
+ memcpy(pStubMsg->Buffer, pMemory + pStubMsg->Offset, pStubMsg->ActualCount*esize);
+ pStubMsg->BufferMark = pStubMsg->Buffer;
+ pStubMsg->Buffer += pStubMsg->ActualCount*esize;
+
+ EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
+
+ STD_OVERFLOW_CHECK(pStubMsg);
+
return NULL;
}
PFORMAT_STRING pFormat,
unsigned char fMustAlloc )
{
- FIXME( "stub\n" );
+ DWORD offset;
+ DWORD esize = *(const WORD*)(pFormat+2);
+
+ TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
+
+ if (pFormat[0] != RPC_FC_CVARRAY)
+ {
+ ERR("invalid format type %x\n", pFormat[0]);
+ RpcRaiseException(RPC_S_INTERNAL_ERROR);
+ return NULL;
+ }
+ pFormat = ReadConformance(pStubMsg, pFormat);
+ offset = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
+ pStubMsg->Buffer += 4;
+ pFormat = ReadVariance(pStubMsg, pFormat);
+
+ if (!*ppMemory || fMustAlloc)
+ *ppMemory = NdrAllocate(pStubMsg, pStubMsg->MaxCount * esize);
+ memcpy(*ppMemory + offset, pStubMsg->Buffer, pStubMsg->ActualCount * esize);
+ pStubMsg->Buffer += pStubMsg->ActualCount * esize;
+
+ EmbeddedPointerUnmarshall(pStubMsg, ppMemory, pFormat, fMustAlloc);
+
return NULL;
}
void WINAPI NdrConformantVaryingArrayBufferSize( PMIDL_STUB_MESSAGE pStubMsg,
unsigned char* pMemory, PFORMAT_STRING pFormat )
{
- FIXME( "stub\n" );
+ DWORD esize = *(const WORD*)(pFormat+2);
+
+ TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
+
+ if (pFormat[0] != RPC_FC_CVARRAY)
+ {
+ ERR("invalid format type %x\n", pFormat[0]);
+ RpcRaiseException(RPC_S_INTERNAL_ERROR);
+ return;
+ }
+
+ /* compute size */
+ pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
+ /* compute length */
+ pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
+
+ /* conformance + offset + variance + array */
+ pStubMsg->BufferLength += 3*sizeof(DWORD) + pStubMsg->ActualCount*esize;
+
+ EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
}
/* FIXME: since this stub doesn't do any converting, the proper behavior
is to raise an exception */
}
+
+typedef struct _NDR_CSTRUCT_FORMAT
+{
+ unsigned char type;
+ unsigned char alignment;
+ unsigned short memory_size;
+ short offset_to_array_description;
+} NDR_CSTRUCT_FORMAT;
+
+/***********************************************************************
+ * NdrConformantStructMarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrConformantStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ const NDR_CSTRUCT_FORMAT * pCStructFormat = (NDR_CSTRUCT_FORMAT*)pFormat;
+ pFormat += sizeof(NDR_CSTRUCT_FORMAT);
+
+ TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
+
+ if ((pCStructFormat->type != RPC_FC_CPSTRUCT) && (pCStructFormat->type != RPC_FC_CSTRUCT))
+ {
+ ERR("invalid format type %x\n", pCStructFormat->type);
+ RpcRaiseException(RPC_S_INTERNAL_ERROR);
+ return NULL;
+ }
+
+ TRACE("memory_size = %d\n", pCStructFormat->memory_size);
+
+ /* copy constant sized part of struct */
+ memcpy(pStubMsg->Buffer, pMemory, pCStructFormat->memory_size);
+ pStubMsg->Buffer += pCStructFormat->memory_size;
+
+ if (pCStructFormat->offset_to_array_description)
+ {
+ PFORMAT_STRING pArrayFormat = (unsigned char*)&pCStructFormat->offset_to_array_description +
+ pCStructFormat->offset_to_array_description;
+ NdrConformantArrayMarshall(pStubMsg, pMemory + pCStructFormat->memory_size, pArrayFormat);
+ }
+ if (pCStructFormat->type == RPC_FC_CPSTRUCT)
+ EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrConformantStructUnmarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char **ppMemory,
+ PFORMAT_STRING pFormat,
+ unsigned char fMustAlloc)
+{
+ const NDR_CSTRUCT_FORMAT * pCStructFormat = (NDR_CSTRUCT_FORMAT*)pFormat;
+ pFormat += sizeof(NDR_CSTRUCT_FORMAT);
+
+ TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
+
+ if ((pCStructFormat->type != RPC_FC_CPSTRUCT) && (pCStructFormat->type != RPC_FC_CSTRUCT))
+ {
+ ERR("invalid format type %x\n", pCStructFormat->type);
+ RpcRaiseException(RPC_S_INTERNAL_ERROR);
+ return NULL;
+ }
+
+ TRACE("memory_size = %d\n", pCStructFormat->memory_size);
+
+ /* work out how much memory to allocate if we need to do so */
+ if (!*ppMemory || fMustAlloc)
+ {
+ SIZE_T size = pCStructFormat->memory_size;
+
+ if (pCStructFormat->offset_to_array_description)
+ {
+ unsigned char *buffer;
+ PFORMAT_STRING pArrayFormat = (unsigned char*)&pCStructFormat->offset_to_array_description +
+ pCStructFormat->offset_to_array_description;
+ buffer = pStubMsg->Buffer;
+ pStubMsg->Buffer += pCStructFormat->memory_size;
+ size += NdrConformantArrayMemorySize(pStubMsg, pArrayFormat);
+ pStubMsg->Buffer = buffer;
+ }
+ *ppMemory = NdrAllocate(pStubMsg, size);
+ }
+
+ /* now copy the data */
+ memcpy(*ppMemory, pStubMsg->Buffer, pCStructFormat->memory_size);
+ pStubMsg->Buffer += pCStructFormat->memory_size;
+ if (pCStructFormat->offset_to_array_description)
+ {
+ PFORMAT_STRING pArrayFormat = (unsigned char*)&pCStructFormat->offset_to_array_description +
+ pCStructFormat->offset_to_array_description;
+ unsigned char *pMemoryArray = *ppMemory + pCStructFormat->memory_size;
+ /* note that we pass fMustAlloc as 0 as we have already allocated the
+ * memory */
+ NdrConformantArrayUnmarshall(pStubMsg, &pMemoryArray, pArrayFormat, 0);
+ }
+ if (pCStructFormat->type == RPC_FC_CPSTRUCT)
+ EmbeddedPointerUnmarshall(pStubMsg, ppMemory, pFormat, fMustAlloc);
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrConformantStructBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ const NDR_CSTRUCT_FORMAT * pCStructFormat = (NDR_CSTRUCT_FORMAT*)pFormat;
+ pFormat += sizeof(NDR_CSTRUCT_FORMAT);
+ TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
+
+ if ((pCStructFormat->type != RPC_FC_CPSTRUCT) && (pCStructFormat->type != RPC_FC_CSTRUCT))
+ {
+ ERR("invalid format type %x\n", pCStructFormat->type);
+ RpcRaiseException(RPC_S_INTERNAL_ERROR);
+ return;
+ }
+
+ TRACE("memory_size = %d\n", pCStructFormat->memory_size);
+
+ /* add constant sized part of struct to buffer size */
+ pStubMsg->BufferLength += pCStructFormat->memory_size;
+
+ if (pCStructFormat->offset_to_array_description)
+ {
+ PFORMAT_STRING pArrayFormat = (unsigned char*)&pCStructFormat->offset_to_array_description +
+ pCStructFormat->offset_to_array_description;
+ NdrConformantArrayBufferSize(pStubMsg, pMemory + pCStructFormat->memory_size, pArrayFormat);
+ }
+ if (pCStructFormat->type == RPC_FC_CPSTRUCT)
+ EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
+}
+
+/***********************************************************************
+ * NdrConformantStructMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrConformantStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return 0;
+}
+
+/***********************************************************************
+ * NdrConformantStructFree [RPCRT4.@]
+ */
+void WINAPI NdrConformantStructFree(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrConformantVaryingStructMarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrConformantVaryingStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrConformantVaryingStructUnmarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char **ppMemory,
+ PFORMAT_STRING pFormat,
+ unsigned char fMustAlloc)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrConformantVaryingStructBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrConformantVaryingStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrConformantVaryingStructMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrConformantVaryingStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return 0;
+}
+
+/***********************************************************************
+ * NdrConformantVaryingStructFree [RPCRT4.@]
+ */
+void WINAPI NdrConformantVaryingStructFree(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrFixedArrayMarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrFixedArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrFixedArrayUnmarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrFixedArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char **ppMemory,
+ PFORMAT_STRING pFormat,
+ unsigned char fMustAlloc)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrFixedArrayBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrFixedArrayMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrFixedArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return 0;
+}
+
+/***********************************************************************
+ * NdrFixedArrayFree [RPCRT4.@]
+ */
+void WINAPI NdrFixedArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrVaryingArrayMarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrVaryingArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrVaryingArrayUnmarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrVaryingArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char **ppMemory,
+ PFORMAT_STRING pFormat,
+ unsigned char fMustAlloc)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrVaryingArrayBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrVaryingArrayMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrVaryingArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return 0;
+}
+
+/***********************************************************************
+ * NdrVaryingArrayFree [RPCRT4.@]
+ */
+void WINAPI NdrVaryingArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrEncapsulatedUnionMarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrEncapsulatedUnionUnmarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char **ppMemory,
+ PFORMAT_STRING pFormat,
+ unsigned char fMustAlloc)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrEncapsulatedUnionBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrEncapsulatedUnionMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return 0;
+}
+
+/***********************************************************************
+ * NdrEncapsulatedUnionFree [RPCRT4.@]
+ */
+void WINAPI NdrEncapsulatedUnionFree(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrNonEncapsulatedUnionMarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrNonEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrNonEncapsulatedUnionUnmarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrNonEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char **ppMemory,
+ PFORMAT_STRING pFormat,
+ unsigned char fMustAlloc)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrNonEncapsulatedUnionBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrNonEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrNonEncapsulatedUnionMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrNonEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return 0;
+}
+
+/***********************************************************************
+ * NdrNonEncapsulatedUnionFree [RPCRT4.@]
+ */
+void WINAPI NdrNonEncapsulatedUnionFree(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrByteCountPointerMarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrByteCountPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrByteCountPointerUnmarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrByteCountPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char **ppMemory,
+ PFORMAT_STRING pFormat,
+ unsigned char fMustAlloc)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrByteCountPointerBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrByteCountPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrByteCountPointerMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrByteCountPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return 0;
+}
+
+/***********************************************************************
+ * NdrByteCountPointerFree [RPCRT4.@]
+ */
+void WINAPI NdrByteCountPointerFree(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrXmitOrRepAsMarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrXmitOrRepAsMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrXmitOrRepAsUnmarshall [RPCRT4.@]
+ */
+unsigned char * WINAPI NdrXmitOrRepAsUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char **ppMemory,
+ PFORMAT_STRING pFormat,
+ unsigned char fMustAlloc)
+{
+ FIXME("stub\n");
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrXmitOrRepAsBufferSize [RPCRT4.@]
+ */
+void WINAPI NdrXmitOrRepAsBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrXmitOrRepAsMemorySize [RPCRT4.@]
+ */
+unsigned long WINAPI NdrXmitOrRepAsMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+ return 0;
+}
+
+/***********************************************************************
+ * NdrXmitOrRepAsFree [RPCRT4.@]
+ */
+void WINAPI NdrXmitOrRepAsFree(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("stub\n");
+}
+
+/***********************************************************************
+ * NdrBaseTypeMarshall [internal]
+ */
+static unsigned char *WINAPI NdrBaseTypeMarshall(
+ PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat);
+
+ switch(*pFormat)
+ {
+ case RPC_FC_BYTE:
+ case RPC_FC_CHAR:
+ case RPC_FC_SMALL:
+ case RPC_FC_USMALL:
+ *(UCHAR *)pStubMsg->Buffer = *(UCHAR *)pMemory;
+ pStubMsg->Buffer += sizeof(UCHAR);
+ TRACE("value: 0x%02x\n", *(UCHAR *)pMemory);
+ break;
+ case RPC_FC_WCHAR:
+ case RPC_FC_SHORT:
+ case RPC_FC_USHORT:
+ ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT) - 1);
+ *(USHORT *)pStubMsg->Buffer = *(USHORT *)pMemory;
+ pStubMsg->Buffer += sizeof(USHORT);
+ TRACE("value: 0x%04x\n", *(USHORT *)pMemory);
+ break;
+ case RPC_FC_LONG:
+ case RPC_FC_ULONG:
+ case RPC_FC_ERROR_STATUS_T:
+ ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG) - 1);
+ *(ULONG *)pStubMsg->Buffer = *(ULONG *)pMemory;
+ pStubMsg->Buffer += sizeof(ULONG);
+ TRACE("value: 0x%08lx\n", *(ULONG *)pMemory);
+ break;
+ case RPC_FC_FLOAT:
+ ALIGN_POINTER(pStubMsg->Buffer, sizeof(float) - 1);
+ *(float *)pStubMsg->Buffer = *(float *)pMemory;
+ pStubMsg->Buffer += sizeof(float);
+ break;
+ case RPC_FC_DOUBLE:
+ ALIGN_POINTER(pStubMsg->Buffer, sizeof(double) - 1);
+ *(double *)pStubMsg->Buffer = *(double *)pMemory;
+ pStubMsg->Buffer += sizeof(double);
+ break;
+ case RPC_FC_HYPER:
+ ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONGLONG) - 1);
+ *(ULONGLONG *)pStubMsg->Buffer = *(ULONGLONG *)pMemory;
+ pStubMsg->Buffer += sizeof(ULONGLONG);
+ TRACE("value: %s\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory));
+ break;
+ case RPC_FC_ENUM16:
+ case RPC_FC_ENUM32:
+ default:
+ FIXME("Unhandled base type: 0x%02x\n", *pFormat);
+ }
+
+ STD_OVERFLOW_CHECK(pStubMsg);
+
+ /* FIXME: what is the correct return value? */
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrBaseTypeUnmarshall [internal]
+ */
+static unsigned char *WINAPI NdrBaseTypeUnmarshall(
+ PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char **ppMemory,
+ PFORMAT_STRING pFormat,
+ unsigned char fMustAlloc)
+{
+ TRACE("pStubMsg: %p, ppMemory: %p, type: 0x%02x, fMustAlloc: %s\n", pStubMsg, ppMemory, *pFormat, fMustAlloc ? "true" : "false");
+
+ if (fMustAlloc || !*ppMemory)
+ *ppMemory = NdrAllocate(pStubMsg, NdrBaseTypeMemorySize(pStubMsg, pFormat));
+
+ TRACE("*ppMemory: %p\n", *ppMemory);
+
+ switch(*pFormat)
+ {
+ case RPC_FC_BYTE:
+ case RPC_FC_CHAR:
+ case RPC_FC_SMALL:
+ case RPC_FC_USMALL:
+ **(UCHAR **)ppMemory = *(UCHAR *)pStubMsg->Buffer;
+ pStubMsg->Buffer += sizeof(UCHAR);
+ TRACE("value: 0x%02x\n", **(UCHAR **)ppMemory);
+ break;
+ case RPC_FC_WCHAR:
+ case RPC_FC_SHORT:
+ case RPC_FC_USHORT:
+ ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT) - 1);
+ **(USHORT **)ppMemory = *(USHORT *)pStubMsg->Buffer;
+ pStubMsg->Buffer += sizeof(USHORT);
+ TRACE("value: 0x%04x\n", **(USHORT **)ppMemory);
+ break;
+ case RPC_FC_LONG:
+ case RPC_FC_ULONG:
+ case RPC_FC_ERROR_STATUS_T:
+ ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG) - 1);
+ **(ULONG **)ppMemory = *(ULONG *)pStubMsg->Buffer;
+ pStubMsg->Buffer += sizeof(ULONG);
+ TRACE("value: 0x%08lx\n", **(ULONG **)ppMemory);
+ break;
+ case RPC_FC_FLOAT:
+ ALIGN_POINTER(pStubMsg->Buffer, sizeof(float) - 1);
+ **(float **)ppMemory = *(float *)pStubMsg->Buffer;
+ pStubMsg->Buffer += sizeof(float);
+ TRACE("value: %f\n", **(float **)ppMemory);
+ break;
+ case RPC_FC_DOUBLE:
+ ALIGN_POINTER(pStubMsg->Buffer, sizeof(double) - 1);
+ **(double **)ppMemory = *(double*)pStubMsg->Buffer;
+ pStubMsg->Buffer += sizeof(double);
+ TRACE("value: %f\n", **(double **)ppMemory);
+ break;
+ case RPC_FC_HYPER:
+ ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONGLONG) - 1);
+ **(ULONGLONG **)ppMemory = *(ULONGLONG *)pStubMsg->Buffer;
+ pStubMsg->Buffer += sizeof(ULONGLONG);
+ TRACE("value: %s\n", wine_dbgstr_longlong(**(ULONGLONG **)ppMemory));
+ break;
+ case RPC_FC_ENUM16:
+ case RPC_FC_ENUM32:
+ default:
+ FIXME("Unhandled base type: 0x%02x\n", *pFormat);
+ }
+
+ /* FIXME: what is the correct return value? */
+
+ return NULL;
+}
+
+/***********************************************************************
+ * NdrBaseTypeBufferSize [internal]
+ */
+static void WINAPI NdrBaseTypeBufferSize(
+ PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat);
+
+ switch(*pFormat)
+ {
+ case RPC_FC_BYTE:
+ case RPC_FC_CHAR:
+ case RPC_FC_SMALL:
+ case RPC_FC_USMALL:
+ pStubMsg->BufferLength += sizeof(UCHAR);
+ break;
+ case RPC_FC_WCHAR:
+ case RPC_FC_SHORT:
+ case RPC_FC_USHORT:
+ ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(USHORT) - 1);
+ pStubMsg->BufferLength += sizeof(USHORT);
+ break;
+ case RPC_FC_LONG:
+ case RPC_FC_ULONG:
+ ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(ULONG) - 1);
+ pStubMsg->BufferLength += sizeof(ULONG);
+ break;
+ case RPC_FC_FLOAT:
+ ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(float) - 1);
+ pStubMsg->BufferLength += sizeof(float);
+ break;
+ case RPC_FC_DOUBLE:
+ ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(double) - 1);
+ pStubMsg->BufferLength += sizeof(double);
+ break;
+ case RPC_FC_HYPER:
+ ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(ULONGLONG) - 1);
+ pStubMsg->BufferLength += sizeof(ULONGLONG);
+ break;
+ case RPC_FC_ERROR_STATUS_T:
+ ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(error_status_t) - 1);
+ pStubMsg->BufferLength += sizeof(error_status_t);
+ break;
+ case RPC_FC_ENUM16:
+ case RPC_FC_ENUM32:
+ default:
+ FIXME("Unhandled base type: 0x%02x\n", *pFormat);
+ }
+}
+
+/***********************************************************************
+ * NdrBaseTypeMemorySize [internal]
+ */
+static unsigned long WINAPI NdrBaseTypeMemorySize(
+ PMIDL_STUB_MESSAGE pStubMsg,
+ PFORMAT_STRING pFormat)
+{
+ switch(*pFormat)
+ {
+ case RPC_FC_BYTE:
+ case RPC_FC_CHAR:
+ case RPC_FC_SMALL:
+ case RPC_FC_USMALL:
+ return sizeof(UCHAR);
+ case RPC_FC_WCHAR:
+ case RPC_FC_SHORT:
+ case RPC_FC_USHORT:
+ return sizeof(USHORT);
+ case RPC_FC_LONG:
+ case RPC_FC_ULONG:
+ return sizeof(ULONG);
+ case RPC_FC_FLOAT:
+ return sizeof(float);
+ case RPC_FC_DOUBLE:
+ return sizeof(double);
+ case RPC_FC_HYPER:
+ return sizeof(ULONGLONG);
+ case RPC_FC_ERROR_STATUS_T:
+ return sizeof(error_status_t);
+ case RPC_FC_ENUM16:
+ case RPC_FC_ENUM32:
+ default:
+ FIXME("Unhandled base type: 0x%02x\n", *pFormat);
+ return 0;
+ }
+}
+
+/***********************************************************************
+ * NdrBaseTypeFree [internal]
+ */
+static void WINAPI NdrBaseTypeFree(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ PFORMAT_STRING pFormat)
+{
+ TRACE("pStubMsg %p pMemory %p type 0x%02x\n", pStubMsg, pMemory, *pFormat);
+
+ /* nothing to do */
+}
+
+/***********************************************************************
+ * NdrClientContextMarshall
+ */
+void WINAPI NdrClientContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ NDR_CCONTEXT ContextHandle,
+ int fCheck)
+{
+ FIXME("(%p, %p, %d): stub\n", pStubMsg, ContextHandle, fCheck);
+}
+
+/***********************************************************************
+ * NdrClientContextUnmarshall
+ */
+void WINAPI NdrClientContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ NDR_CCONTEXT * pContextHandle,
+ RPC_BINDING_HANDLE BindHandle)
+{
+ FIXME("(%p, %p, %p): stub\n", pStubMsg, pContextHandle, BindHandle);
+}
+
+void WINAPI NdrServerContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ NDR_SCONTEXT ContextHandle,
+ NDR_RUNDOWN RundownRoutine )
+{
+ FIXME("(%p, %p, %p): stub\n", pStubMsg, ContextHandle, RundownRoutine);
+}
+
+NDR_SCONTEXT WINAPI NdrServerContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg)
+{
+ FIXME("(%p): stub\n", pStubMsg);
+ return NULL;
+}
+
+void WINAPI NdrContextHandleSize(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char* pMemory,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("(%p, %p, %p): stub\n", pStubMsg, pMemory, pFormat);
+}
+
+NDR_SCONTEXT WINAPI NdrContextHandleInitialize(PMIDL_STUB_MESSAGE pStubMsg,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("(%p, %p): stub\n", pStubMsg, pFormat);
+ return NULL;
+}
+
+void WINAPI NdrServerContextNewMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ NDR_SCONTEXT ContextHandle,
+ NDR_RUNDOWN RundownRoutine,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("(%p, %p, %p, %p): stub\n", pStubMsg, ContextHandle, RundownRoutine, pFormat);
+}
+
+NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ PFORMAT_STRING pFormat)
+{
+ FIXME("(%p, %p): stub\n", pStubMsg, pFormat);
+ return NULL;
+}
+
+RPC_BINDING_HANDLE WINAPI NDRCContextBinding(NDR_CCONTEXT CContext)
+{
+ FIXME("(%p): stub\n", CContext);
+ return NULL;
+}