Typelib marshalling BSTRs

Robert Shearman R.J.Shearman at warwick.ac.uk
Fri Jul 18 15:33:03 CDT 2003


> Subject: Re: Typelib marshalling BSTRs
> From: Mike Hearn <mike at theoretic.com>
> To: Kelly Leahy <kellyleahy at swbell.net>
> Cc: wine-devel at winehq.com
> Date: 18 Jul 2003 17:24:07 +0100
>
> On Fri, 2003-07-18 at 17:08, Kelly Leahy wrote:
> > weird.  are the "type" and "flags" correct?
>
> They appear to be. Type 26 is VT_PTR, flags 1 == in param
>
> > 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.
>
> Yeah, I had a thinko. It's supposed to be an array of bstr, but even
> simply marshalling the first element correctly would be good :)

No, it is supposed to be OLECHAR which is different (in terms of VARIANT
types) to BSTR. BSTR implies a size field at the start of the array.

>   HRESULT GetIDsOfNames(
>     [in] REFIID riid,
>     [in, size_is(cNames)] LPOLESTR *rgszNames,
>     [in] UINT cNames,
>     [in] LCID lcid,
>     [out, size_is(cNames)] DISPID *rgDispId);
>
> Maybe the size_is() field should be noticed somewhere in the marshalling
> code. I don't know where such information would surface though, it's not
> in the flags, there is no PARAMFLAG constant for it.

There is no way of expressing size_of once the IDL is in TypeLib form. It is
effectively ignored. However, it is used in the proxy and stub functions
generated. I'm not sure what interface it is marshalling here, but your
error would appear to be elsewhere.

Using a test program which dumps type libraries, I can confirm that LPOLESTR
* is compiled to CHAR** on Windows. I can't quite seem why, but it appears
that the marshalling that is being done is correct, at least for the
information available to it.

Rob





More information about the wine-devel mailing list