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

oleaut32: Added implementation of ITypeInfo2_fnGetTypeAttr.

parent 32c39db8
......@@ -990,6 +990,7 @@ static void test_CreateTypeLib(void) {
ELEMDESC elemdesc[5];
PARAMDESCEX paramdescex;
TYPEDESC typedesc1, typedesc2;
TYPEATTR *typeattr;
HREFTYPE hreftype;
HRESULT hres;
......@@ -1182,6 +1183,36 @@ static void test_CreateTypeLib(void) {
ICreateTypeInfo_Release(createti2);
hres = ITypeInfo_GetTypeAttr(interface1, &typeattr);
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 == 11, "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 == 56, "cbSizeVft = %d\n", typeattr->cbSizeVft);
ok(typeattr->cbAlignment == 4, "cbAlignment = %d\n", typeattr->cbAlignment);
ok(typeattr->wTypeFlags == 0, "wTypeFlags = %d\n", typeattr->wTypeFlags);
ok(typeattr->wMajorVerNum == 0, "wMajorVerNum = %d\n", typeattr->wMajorVerNum);
ok(typeattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", typeattr->wMinorVerNum);
ITypeInfo_ReleaseTypeAttr(interface1, typeattr);
hres = ITypeInfo_GetTypeAttr(interface2, &typeattr);
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->cVars == 0, "cVars = %d\n", typeattr->cVars);
ok(typeattr->cImplTypes == 1, "cImplTypes = %d\n", typeattr->cImplTypes);
ok(typeattr->cbSizeVft == 56, "cbSizeVft = %d\n", typeattr->cbSizeVft);
ok(typeattr->cbAlignment == 4, "cbAlignment = %d\n", typeattr->cbAlignment);
ok(typeattr->wTypeFlags == 0, "wTypeFlags = %d\n", typeattr->wTypeFlags);
ok(typeattr->wMajorVerNum == 0, "wMajorVerNum = %d\n", typeattr->wMajorVerNum);
ok(typeattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", typeattr->wMinorVerNum);
ITypeInfo_ReleaseTypeAttr(interface2, typeattr);
hres = ICreateTypeLib2_SaveAllChanges(createtl);
ok(hres == S_OK, "got %08x\n", hres);
ICreateTypeLib2_Release(createtl);
......
......@@ -2723,8 +2723,45 @@ static HRESULT WINAPI ITypeInfo2_fnGetTypeAttr(
ITypeInfo2* iface,
TYPEATTR** ppTypeAttr)
{
FIXME("(%p,%p), stub!\n", iface, ppTypeAttr);
return E_OUTOFMEMORY;
ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
HRESULT hres;
TRACE("(%p,%p)\n", iface, ppTypeAttr);
if(!ppTypeAttr)
return E_INVALIDARG;
hres = ICreateTypeInfo_LayOut((ICreateTypeInfo*)This);
if(FAILED(hres))
return hres;
*ppTypeAttr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TYPEATTR));
if(!*ppTypeAttr)
return E_OUTOFMEMORY;
if(This->typeinfo->posguid != -1) {
MSFT_GuidEntry *guid;
guid = (MSFT_GuidEntry*)&This->typelib->typelib_segment_data[MSFT_SEG_GUID][This->typeinfo->posguid];
(*ppTypeAttr)->guid = guid->guid;
}
(*ppTypeAttr)->lcid = This->typelib->typelib_header.lcid;
(*ppTypeAttr)->cbSizeInstance = This->typeinfo->size;
(*ppTypeAttr)->typekind = This->typeinfo->typekind&0xf;
(*ppTypeAttr)->cFuncs = This->typeinfo->cElement&0xffff;
(*ppTypeAttr)->cVars = This->typeinfo->cElement>>16;
(*ppTypeAttr)->cImplTypes = This->typeinfo->cImplTypes;
(*ppTypeAttr)->cbSizeVft = This->typeinfo->cbSizeVft;
(*ppTypeAttr)->cbAlignment = (This->typeinfo->typekind>>11) & 0x1f;
(*ppTypeAttr)->wTypeFlags = This->typeinfo->flags;
(*ppTypeAttr)->wMajorVerNum = This->typeinfo->version&0xffff;
(*ppTypeAttr)->wMinorVerNum = This->typeinfo->version>>16;
if((*ppTypeAttr)->typekind == TKIND_ALIAS)
FIXME("TKIND_ALIAS handling not implemented\n");
return S_OK;
}
/******************************************************************************
......@@ -3014,7 +3051,10 @@ static void WINAPI ITypeInfo2_fnReleaseTypeAttr(
ITypeInfo2* iface,
TYPEATTR* pTypeAttr)
{
FIXME("(%p,%p), stub!\n", iface, pTypeAttr);
TRACE("(%p,%p)\n", iface, pTypeAttr);
if(pTypeAttr)
HeapFree(GetProcessHeap(), 0, pTypeAttr);
}
/******************************************************************************
......
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