Typelib marshalling BSTRs

Kelly Leahy kellyleahy at swbell.net
Fri Jul 18 11:08:17 CDT 2003


> Hi,
>
> Well, I've made pretty good progress, but am a bit stuck with this
> problem. Basically:
>
> 003d:trace:ole:TL_Marshal   parameter 1
> 003d:trace:ole:TL_Marshal    name   : L"rgszNames"
> 003d:trace:ole:TL_Marshal    type   : 26
> 003d:trace:ole:TL_Marshal    flags  : 01
> 003d:trace:ole:TL_MarshalType    dereferencing PTR 0x52edf7d0 =>
> 0x54331260
> 003d:trace:ole:TL_MarshalType    dereferencing PTR 0x54331260 =>
> 0x54331270
> 003d:trace:ole:TL_MarshalType    marshaling byte 100
>

weird.  are the "type" and "flags" correct?

> As you can see, it's marshalling IDispatch across apartment boundaries,
> but it gets this parameter wrong. The double dereference seems correct,
> but marshalling a byte is not - I think it should be a BSTR.
>
> rgszNames is a parameter of IDispatch::GetIDsFromNames, which is defined
> as an OLECHAR FAR* FAR*
>

bstr isn't right, since it's an array of bstr (or more precisely array of
OLECHAR FAR* - which may also be causing problems) - though I may be wrong
if it marshals them one by one.  Shouldn't there be some special attributes
in the IDL for this stuff, like size_of() or something like that (I'm a bit
rusty)?

> I can't figure out where the typeinfo data for IDispatch is coming from
> though, hence my stuckness. BTW, is this line really correct:
>
> TL_Unmarshal(pStm, pInfo, pDesc, PARAMFLAG_FIN, args, &argc, pChannel,
> &is_iid);
>
> shouldn't it be:
>
> TL_Unmarshal(pStm, pInfo, pDesc, PARAMFLAG_FIN, (DWORD*)&args[0], &argc,
> pChannel, &is_iid);
>

these should be identical in terms of the code that gets compiles, though
the second form may eliminate some warnings by using the typecast.
Incidentally, you could just use (DWORD*)args to have the same effect.

Kelly




More information about the wine-devel mailing list