Module: wine Branch: master Commit: d9fd33e3a9533b0d3afb11e0d67dc8ffea41193f URL: http://source.winehq.org/git/wine.git/?a=commit;h=d9fd33e3a9533b0d3afb11e0d6...
Author: Piotr Caban piotr@codeweavers.com Date: Mon Mar 15 23:38:24 2010 +0100
oleaut32: Improve TypeInfos with changed TypeKind handling.
---
dlls/oleaut32/tests/typelib.c | 25 ++++++++++++++++++++++--- dlls/oleaut32/typelib2.c | 31 ++++++++++++++++++++++++------- 2 files changed, 46 insertions(+), 10 deletions(-)
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index 452ab7d..02a7027 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -1087,6 +1087,9 @@ static void test_CreateTypeLib(void) { ok(hres == S_OK, "got %08x\n", hres); ok(hreftype == 3, "hreftype = %d\n", hreftype);
+ hres = ITypeInfo_GetRefTypeOfImplType(interface1, -1, &hreftype); + ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres); + memset(&funcdesc, 0, sizeof(FUNCDESC)); funcdesc.funckind = FUNC_PUREVIRTUAL; funcdesc.invkind = INVOKE_PROPERTYGET; @@ -1237,6 +1240,9 @@ static void test_CreateTypeLib(void) { ok(hres == S_OK, "got %08x\n", hres); ok(hreftype == 2, "hreftype = %d\n", hreftype);
+ hres = ITypeInfo_GetRefTypeOfImplType(interface2, -1, &hreftype); + ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres); + hres = ICreateTypeInfo_SetImplTypeFlags(createti, 0, IMPLTYPEFLAG_FDEFAULT); ok(hres == TYPE_E_BADMODULEKIND, "got %08x\n", hres);
@@ -1309,6 +1315,9 @@ static void test_CreateTypeLib(void) { ok(hres == S_OK, "got %08x\n", hres); ok(hreftype == 1, "hreftype = %d\n", hreftype);
+ hres = ITypeInfo_GetRefTypeOfImplType(ti, -1, &hreftype); + ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres); + ITypeInfo_Release(ti);
ICreateTypeInfo_Release(createti); @@ -1316,6 +1325,12 @@ static void test_CreateTypeLib(void) { hres = ICreateTypeLib_CreateTypeInfo(createtl, dualW, TKIND_INTERFACE, &createti); ok(hres == S_OK, "got %08x\n", hres);
+ hres = ICreateTypeInfo_SetTypeFlags(createti, TYPEFLAG_FDUAL); + ok(hres == S_OK, "got %08x\n", hres); + + hres = ICreateTypeInfo_AddFuncDesc(createti, 0, &funcdesc); + ok(hres == S_OK, "got %08x\n", hres); + hres = ICreateTypeInfo_AddRefTypeInfo(createti, dispatch, &hreftype); ok(hres == S_OK, "got %08x\n", hres);
@@ -1329,15 +1344,19 @@ static void test_CreateTypeLib(void) { ok(hres == S_OK, "got %08x\n", hres); ok(typeattr->cbSizeInstance == 4, "cbSizeInstance = %d\n", typeattr->cbSizeInstance); ok(typeattr->typekind == 3, "typekind = %d\n", typeattr->typekind); - ok(typeattr->cFuncs == 0, "cFuncs = %d\n", typeattr->cFuncs); + ok(typeattr->cFuncs == 1, "cFuncs = %d\n", typeattr->cFuncs); ok(typeattr->cVars == 0, "cVars = %d\n", typeattr->cVars); ok(typeattr->cImplTypes == 1, "cImplTypes = %d\n", typeattr->cImplTypes); - ok(typeattr->cbSizeVft == 28, "cbSizeVft = %d\n", typeattr->cbSizeVft); + ok(typeattr->cbSizeVft == 32, "cbSizeVft = %d\n", typeattr->cbSizeVft); ok(typeattr->cbAlignment == 4, "cbAlignment = %d\n", typeattr->cbAlignment); - ok(typeattr->wTypeFlags == TYPEFLAG_FDISPATCHABLE, "wTypeFlags = %d\n", typeattr->wTypeFlags); + ok(typeattr->wTypeFlags == (TYPEFLAG_FDISPATCHABLE|TYPEFLAG_FDUAL), "wTypeFlags = %d\n", typeattr->wTypeFlags); ok(typeattr->wMajorVerNum == 0, "wMajorVerNum = %d\n", typeattr->wMajorVerNum); ok(typeattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", typeattr->wMinorVerNum);
+ hres = ITypeInfo_GetRefTypeOfImplType(ti, -1, &hreftype); + ok(hres == S_OK, "got %08x\n", hres); + ok(hreftype == -2, "got %08x\n", hreftype); + ITypeInfo_ReleaseTypeAttr(ti, typeattr);
ITypeInfo_Release(ti); diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c index dd42ab4..99fc07f 100644 --- a/dlls/oleaut32/typelib2.c +++ b/dlls/oleaut32/typelib2.c @@ -1640,6 +1640,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc( int *typedata; int i, num_defaults = 0; int decoded_size; + TYPEKIND tkind; HRESULT hres;
TRACE("(%p,%d,%p)\n", iface, index, pFuncDesc); @@ -1653,7 +1654,9 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc( pFuncDesc->cParamsOpt, pFuncDesc->oVft, pFuncDesc->cScodes, pFuncDesc->elemdescFunc.tdesc.vt, pFuncDesc->wFuncFlags);
- switch(This->typeinfo->typekind&0xf) { + tkind = This->typeinfo->typekind&0x10?TKIND_INTERFACE:This->typeinfo->typekind&0xf; + + switch(tkind) { case TKIND_MODULE: if(pFuncDesc->funckind != FUNC_STATIC) return TYPE_E_BADMODULEKIND; @@ -1814,15 +1817,16 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddImplType( ref->flags = 0; ref->oCustData = -1; ref->onext = -1; - } else if ((This->typeinfo->typekind & 15) == TKIND_DISPATCH) { - FIXME("dispatch case unhandled.\n"); - } else if ((This->typeinfo->typekind & 15) == TKIND_INTERFACE) { + } else if ((This->typeinfo->typekind & 15) == TKIND_INTERFACE || + (This->typeinfo->typekind&0x10)) { if (This->typeinfo->cImplTypes && index==1) return TYPE_E_BADMODULEKIND;
if( index != 0) return TYPE_E_ELEMENTNOTFOUND;
This->typeinfo->datatype1 = hRefType; + } else if ((This->typeinfo->typekind & 15) == TKIND_DISPATCH) { + FIXME("dispatch case unhandled.\n"); } else { FIXME("AddImplType unsupported on typekind %d\n", This->typeinfo->typekind & 15); return E_OUTOFMEMORY; @@ -2779,7 +2783,10 @@ static HRESULT WINAPI ITypeInfo2_fnGetTypeAttr(
(*ppTypeAttr)->lcid = This->typelib->typelib_header.lcid; (*ppTypeAttr)->cbSizeInstance = This->typeinfo->size; - (*ppTypeAttr)->typekind = This->typeinfo->typekind&0xf; + if(This->typeinfo->typekind & 0x10) + (*ppTypeAttr)->typekind = TKIND_INTERFACE; + else + (*ppTypeAttr)->typekind = This->typeinfo->typekind&0xf; (*ppTypeAttr)->cFuncs = This->typeinfo->cElement&0xffff; (*ppTypeAttr)->cVars = This->typeinfo->cElement>>16; (*ppTypeAttr)->cImplTypes = This->typeinfo->cImplTypes; @@ -2872,8 +2879,13 @@ static HRESULT WINAPI ITypeInfo2_fnGetRefTypeOfImplType( return E_INVALIDARG;
if(index == -1) { - FIXME("Dual interfaces not handled yet\n"); - return E_NOTIMPL; + if((This->typeinfo->typekind&0xf)==TKIND_DISPATCH + && (This->typeinfo->flags&TYPEFLAG_FDUAL)) { + *pRefType = -2; /* FIXME: is it correct? */ + return S_OK; + } + + return TYPE_E_ELEMENTNOTFOUND; }
if(index >= This->typeinfo->cImplTypes) @@ -3014,6 +3026,11 @@ static HRESULT WINAPI ITypeInfo2_fnGetRefTypeInfo( if(!ppTInfo) return E_INVALIDARG;
+ if(hRefType == -2) { + FIXME("Negative hreftype not handled yet\n"); + return E_NOTIMPL; + } + if(hRefType&1) { ITypeLib *tl; MSFT_ImpInfo *impinfo;