Bill Medland billmedland at shaw.ca
Thu May 3 09:29:15 CDT 2007

On Thu, 2007-03-05 at 07:49 +0200, Marcus Meissner wrote:
> On Wed, May 02, 2007 at 03:32:59PM -0700, Bill Medland wrote:
> > Does anyone know where a call to OLE2A is going to enter wine?
> > Presumably OLE2A returning null means that the thread ran out of stack
> > space?
> What is OLE2A? I do not see it mentioned anyewhere in the Wine source.
> Any more debugging output?
> Ciao, Marcus
Hi Marcus, thanks for taking interest.

A little late now, I think.  The problem is not where I thought it was.

OLE2A is a Microsoft macro used to convert e.g. a BSTR to a char *,
allocating memory on the stack and calling one of the wide-to-narrow

Our program was behaving quite strangely, throwing an exception from
some code that should not throw an exception.

I traced it down to some code that did an OLE2A on a BSTR, called strlen
on the return and then passed the same narrow string to a function.
The problem occurred when the OLE2A returned a null pointer.  Due to an
oversight I thought the BSTR was non-null and assumed that somehow the
underlying alloca must be returning null (i.e. was detecting out-of-

Now I discover that the BSTR itself was also NULL so that makes sense.

I presume what happens is all that magic that traps the segment
violation on strlen(0) didn't quite handle whatever optimised code was
being generated for our case.

However what I am also investigating is where the original NULL BSTR
came from; possibly a defect in VariantChangeTypeEx.


More information about the wine-devel mailing list