Module: wine Branch: master Commit: 3183786367401ab5cc1120c08cd5316c160aa5bb URL: http://source.winehq.org/git/wine.git/?a=commit;h=3183786367401ab5cc1120c08c...
Author: Piotr Caban piotr@codeweavers.com Date: Wed Feb 24 14:27:46 2010 +0100
oleaut32: Added implementation of ITypeInfo2_GetImplTypeFlags.
---
dlls/oleaut32/tests/typelib.c | 37 +++++++++++++++++++++++++++++++++++++ dlls/oleaut32/typelib2.c | 26 ++++++++++++++++++++++++-- 2 files changed, 61 insertions(+), 2 deletions(-)
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index d1a5df0..be90570 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -993,6 +993,7 @@ static void test_CreateTypeLib(void) { TYPEDESC typedesc1, typedesc2; TYPEATTR *typeattr; HREFTYPE hreftype; + int impltypeflags; HRESULT hres;
trace("CreateTypeLib tests\n"); @@ -1179,6 +1180,16 @@ static void test_CreateTypeLib(void) { hres = ICreateTypeInfo_AddImplType(createti, 0, hreftype); ok(hres == S_OK, "got %08x\n", hres);
+ hres = ICreateTypeInfo_SetImplTypeFlags(createti, 0, IMPLTYPEFLAG_FDEFAULT); + ok(hres == TYPE_E_BADMODULEKIND, "got %08x\n", hres); + + hres = ITypeInfo_GetImplTypeFlags(interface2, 0, &impltypeflags); + ok(hres == S_OK, "got %08x\n", hres); + ok(impltypeflags == 0, "impltypeflags = %x\n", impltypeflags); + + hres = ITypeInfo_GetImplTypeFlags(interface2, 1, &impltypeflags); + ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres); + ICreateTypeInfo_Release(createti);
hres = ICreateTypeLib_CreateTypeInfo(createtl, coclassW, TKIND_COCLASS, &createti); @@ -1205,6 +1216,32 @@ static void test_CreateTypeLib(void) { hres = ICreateTypeInfo_AddImplType(createti, 2, hreftype); ok(hres == S_OK, "got %08x\n", hres);
+ hres = ICreateTypeInfo_SetImplTypeFlags(createti, 0, IMPLTYPEFLAG_FDEFAULT); + ok(hres == S_OK, "got %08x\n", hres); + + hres = ICreateTypeInfo_SetImplTypeFlags(createti, 1, IMPLTYPEFLAG_FRESTRICTED); + ok(hres == S_OK, "got %08x\n", hres); + + hres = ICreateTypeInfo_QueryInterface(createti, &IID_ITypeInfo, (void**)&ti); + ok(hres == S_OK, "got %08x\n", hres); + + hres = ITypeInfo_GetImplTypeFlags(ti, 0, NULL); + ok(hres == E_INVALIDARG, "got %08x\n", hres); + + hres = ITypeInfo_GetImplTypeFlags(ti, 0, &impltypeflags); + ok(hres == S_OK, "got %08x\n", hres); + ok(impltypeflags == IMPLTYPEFLAG_FDEFAULT, "impltypeflags = %x\n", impltypeflags); + + hres = ITypeInfo_GetImplTypeFlags(ti, 1, &impltypeflags); + ok(hres == S_OK, "got %08x\n", hres); + ok(impltypeflags == IMPLTYPEFLAG_FRESTRICTED, "impltypeflags = %x\n", impltypeflags); + + hres = ITypeInfo_GetImplTypeFlags(ti, 2, &impltypeflags); + ok(hres == S_OK, "got %08x\n", hres); + ok(impltypeflags == 0, "impltypeflags = %x\n", impltypeflags); + + ITypeInfo_Release(ti); + ICreateTypeInfo_Release(createti);
hres = ITypeInfo_GetTypeAttr(interface1, &typeattr); diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c index a8d83bf..8a3d808 100644 --- a/dlls/oleaut32/typelib2.c +++ b/dlls/oleaut32/typelib2.c @@ -2849,8 +2849,30 @@ static HRESULT WINAPI ITypeInfo2_fnGetImplTypeFlags( UINT index, INT* pImplTypeFlags) { - FIXME("(%p,%d,%p), stub!\n", iface, index, pImplTypeFlags); - return E_OUTOFMEMORY; + ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface); + int offset; + MSFT_RefRecord *ref; + + TRACE("(%p,%d,%p)\n", iface, index, pImplTypeFlags); + + if(!pImplTypeFlags) + return E_INVALIDARG; + + if(index >= This->typeinfo->cImplTypes) + return TYPE_E_ELEMENTNOTFOUND; + + if((This->typeinfo->typekind&0xf) != TKIND_COCLASS) { + *pImplTypeFlags = 0; + return S_OK; + } + + offset = ctl2_find_nth_reference(This->typelib, This->typeinfo->datatype1, index); + if(offset == -1) + return TYPE_E_ELEMENTNOTFOUND; + + ref = (MSFT_RefRecord *)&This->typelib->typelib_segment_data[MSFT_SEG_REFERENCES][offset]; + *pImplTypeFlags = ref->flags; + return S_OK; }
/******************************************************************************