ole32 : wrong check in compobj.c
Paul Vriens
Paul.Vriens at xs4all.nl
Mon Jan 10 11:27:48 CST 2005
On Mon, 2005-01-10 at 18:02, Robert Shearman wrote:
> Paul Vriens wrote:
>
> >Hi,
> >
> >while looking through the code I saw:
> >
> >if (model & COINIT_MULTITHREADED)
> >
> >this will never work as COINIT_MULTITHREADED = 0.
> >
> >
>
> Good catch.
>
> >The attached patch fixes the 3 occurrences of a check against COINIT_*.
> >
> >This patch however makes the COM_CreateApartment in compobj.c:
> >
> > 545 if (!(apt = COM_CurrentInfo()->apt))
> > 546 {
> > 547 apt = COM_CreateApartment(dwCoInit);
> > 548 if (!apt) return E_OUTOFMEMORY;
> > 549 }
> >
> >return E_OUTOFMEMORY, always (?). And that makes sure that we have
> >a mismatch between CoInitialize and CoUninitialize.
> >
> >So there's definitely something else wrong as well.
> >
> >Any idea ?
> >
> >
>
> The parameter to CoInitializeEx is of type COINIT and so the caller can also specify another flag like COINIT_DISABLE_OLE1DDE along with the apartment flag.
> So we either need to convert the values to booleans before we call the lower level COM_CreateApartment or we need to be more careful and change the comparisons to this:
> if ((dwCoInit & (COINIT_APARTMENTTHREADED|COINIT_MULTITHREADED) == COINIT_MULTITHREADED) ...
>
> >- if ((apt->model & COINIT_APARTMENTTHREADED) && apt->win) DestroyWindow(apt->win);
> >+ if ((apt->model == COINIT_APARTMENTTHREADED) && apt->win) DestroyWindow(apt->win);
> >
> >
>
> This change can be simplified to just check for the non-null apt->win.
>
> Rob
>
Any volunteers for this stuff? It's way over my head already :-).
I will try as much as I can, but I'm sure the real men have this nailed
in a sec.
Cheers,
Paul.
More information about the wine-devel
mailing list