Problem with ITypeInfo

Dmitry Timoshkov dmitry at baikal.ru
Sun Aug 8 00:55:52 CDT 2004


"jack" <jack at itma.pwr.wroc.pl> wrote:

> @@ -3265,6 +3266,7 @@
>   return NULL;
>        }
>        *ppTypeInfoImpl = (ITypeInfoImpl*)ITypeInfo_Constructor();
> +      pTypeLibImpl->ref++;

Are you sure you need this piece of the patch? It causes the following
test program to fail:

#define COBJMACROS

#include <stdarg.h>
#include <stdio.h>
#include <assert.h>

#include "windef.h"
#include "winbase.h"
#include "oleauto.h"

static void load_type_lib(LPCWSTR type_lib)
{
    ITypeLib *iface;
    TLIBATTR *pTLibAttr;
    HRESULT hResult;
    ULONG ref_count;
//    DWORD dwWritten;

    printf("Loading: \"%ws\"\n", type_lib);

    hResult = LoadTypeLib(type_lib, &iface);
    printf("LoadTypeLib() = %08lx\n", hResult);
    assert(hResult == S_OK);

    hResult = ITypeLib2_GetLibAttr(iface, &pTLibAttr);
    printf("GetLibAttr() = %08lx\n", hResult);
    assert(hResult == S_OK);

//    fflush(stdout);
//    WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), pTLibAttr, sizeof(*pTLibAttr), &dwWritten, NULL);
//    printf("\n\n");

    ITypeLib2_ReleaseTLibAttr(iface, pTLibAttr);

    ref_count = ITypeLib2_Release(iface);
    printf("ITypeLib2_Release() = %lu\n", ref_count);
    assert(ref_count == 0);
}

int main(void)
{
//    load_type_lib(L"olepro32.dll");
//    load_type_lib(L"msvbvm60.dll");
    load_type_lib(L"stdole32.tlb");
    return 0;
}

-- 
Dmitry.




More information about the wine-devel mailing list