[OLE #94] Correctly marshal NULL ppUnk refptrs in
NdrPointerMarshall
Mike Hearn
mh at codeweavers.com
Mon Jun 6 11:06:17 CDT 2005
On Mon, 2005-06-06 at 10:26 -0500, Robert Shearman wrote:
> > 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
> >+ case RPC_FC_RP: /* ref pointer (always non-null but may point to
> null) */
> > break;
> > case RPC_FC_UP: /* unique pointer */
> > case RPC_FC_OP: /* object pointer - same as unique here */
> >
> >
> >
>
> This looks wrong. A ref pointer shouldn't be treated as a unique
> pointer in any circumstances AFAIK. I'll add this case to my mini test
> suite to confirm or deny this hypothesis.
This is wire-sizing, the full code is:
switch (type) {
case RPC_FC_RP:
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];
if (m) m(pStubMsg, Pointer, desc);
else FIXME("no buffersizer for data type=%02x\n", *desc);
In this case, we need to reserve space for a refptr on the wire to be
able to tell the difference between NULL and non-NULL. So it reserves 4
bytes in the buffer.
More information about the wine-devel
mailing list