working together on stdole.tlb and a end to dcom9x

Filip Navara xnavara at
Sat Aug 28 21:42:04 CDT 2004

Nyef wrote:

>The ICreateTypeLib2 interface is used to create the new-style MSFT typelibs.
>The older ICreateTypeLib interface is used for the old-style typelibs. While
>the newer interface also implements the older one, when you ask for the old
>interface with CreateTypeLib() you get a completely different implementation.
Ok, I studied the code more and now I understand the the difference 
(SLTG vs. MSFT libraries). Thanks for explaining.

>I don't see why it necessarily follows that stdole32 wouldn't work as an MSFT
>typelib, but the implementation of ICreateTypeInfo2 is badly incomplete in
>places, and I would trust it to completely mess up any semi-complex type
>library you attempt to create with it. Specifically, any type library that
>involves functions or variables.
You're pretty much right. I tried to create *very* simple 
HelloWorld-type type library with it and and it reported me bunch of 
"stub!" messages and crashed. I also found a bug in implementation of 
ITypeLib2_fnGetTypeInfoOfGuid (in fact both implementations, the one in 
typelib.c and the second in typelib2.c). It should reference the typelib 
it's called on. This ensures that later call 
ITypeInfo_GetContainingTypeLib will not return bogus pointer if the 
original caller already released the TypeLib. See the attached test. If 
any COM hacker around can fix it, it would be nice.


-------------- next part --------------
#include <windows.h>
#include <oaidl.h>
#include <stdio.h>

#define ok(x,y) if (!(x)) printf(y); else printf("ok\n")

int main()
    LPTYPELIB ptlibStdOle;
    LPTYPEINFO ptinfoIUnknown;
    HRESULT result;

    result = LoadTypeLib(OLESTR("stdole32.tlb"), &ptlibStdOle);
    ok(result == S_OK, "can't load stdole32.tlb");

    /* continue only if stdole32.tlb is present. */
    if (result == S_OK)
        ok(ptlibStdOle->AddRef() == 2, "invalid reference count\n");
        /* GetTypeInfoOfGuid adds refernece to typelib */
        result = ptlibStdOle->GetTypeInfoOfGuid(IID_IUnknown, &ptinfoIUnknown);
        ok(result == S_OK, "can't get type info about IUnknown");
        ok(ptlibStdOle->Release() == 2, "invalid reference count\n");
        ok(ptinfoIUnknown->Release() == 0, "invalid reference count\n");
        ok(ptlibStdOle->Release() == 0, "invalid reference count\n");

More information about the wine-devel mailing list