Commit 31837863 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

oleaut32: Added implementation of ITypeInfo2_GetImplTypeFlags.

parent 69579b04
......@@ -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);
......
......@@ -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;
}
/******************************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment