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

oleaut32: Improve TypeInfos with changed TypeKind handling.

parent 6b035d25
...@@ -1087,6 +1087,9 @@ static void test_CreateTypeLib(void) { ...@@ -1087,6 +1087,9 @@ static void test_CreateTypeLib(void) {
ok(hres == S_OK, "got %08x\n", hres); ok(hres == S_OK, "got %08x\n", hres);
ok(hreftype == 3, "hreftype = %d\n", hreftype); 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)); memset(&funcdesc, 0, sizeof(FUNCDESC));
funcdesc.funckind = FUNC_PUREVIRTUAL; funcdesc.funckind = FUNC_PUREVIRTUAL;
funcdesc.invkind = INVOKE_PROPERTYGET; funcdesc.invkind = INVOKE_PROPERTYGET;
...@@ -1237,6 +1240,9 @@ static void test_CreateTypeLib(void) { ...@@ -1237,6 +1240,9 @@ static void test_CreateTypeLib(void) {
ok(hres == S_OK, "got %08x\n", hres); ok(hres == S_OK, "got %08x\n", hres);
ok(hreftype == 2, "hreftype = %d\n", hreftype); 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); hres = ICreateTypeInfo_SetImplTypeFlags(createti, 0, IMPLTYPEFLAG_FDEFAULT);
ok(hres == TYPE_E_BADMODULEKIND, "got %08x\n", hres); ok(hres == TYPE_E_BADMODULEKIND, "got %08x\n", hres);
...@@ -1309,6 +1315,9 @@ static void test_CreateTypeLib(void) { ...@@ -1309,6 +1315,9 @@ static void test_CreateTypeLib(void) {
ok(hres == S_OK, "got %08x\n", hres); ok(hres == S_OK, "got %08x\n", hres);
ok(hreftype == 1, "hreftype = %d\n", hreftype); 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); ITypeInfo_Release(ti);
ICreateTypeInfo_Release(createti); ICreateTypeInfo_Release(createti);
...@@ -1316,6 +1325,12 @@ static void test_CreateTypeLib(void) { ...@@ -1316,6 +1325,12 @@ static void test_CreateTypeLib(void) {
hres = ICreateTypeLib_CreateTypeInfo(createtl, dualW, TKIND_INTERFACE, &createti); hres = ICreateTypeLib_CreateTypeInfo(createtl, dualW, TKIND_INTERFACE, &createti);
ok(hres == S_OK, "got %08x\n", hres); 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); hres = ICreateTypeInfo_AddRefTypeInfo(createti, dispatch, &hreftype);
ok(hres == S_OK, "got %08x\n", hres); ok(hres == S_OK, "got %08x\n", hres);
...@@ -1329,15 +1344,19 @@ static void test_CreateTypeLib(void) { ...@@ -1329,15 +1344,19 @@ static void test_CreateTypeLib(void) {
ok(hres == S_OK, "got %08x\n", hres); ok(hres == S_OK, "got %08x\n", hres);
ok(typeattr->cbSizeInstance == 4, "cbSizeInstance = %d\n", typeattr->cbSizeInstance); ok(typeattr->cbSizeInstance == 4, "cbSizeInstance = %d\n", typeattr->cbSizeInstance);
ok(typeattr->typekind == 3, "typekind = %d\n", typeattr->typekind); 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->cVars == 0, "cVars = %d\n", typeattr->cVars);
ok(typeattr->cImplTypes == 1, "cImplTypes = %d\n", typeattr->cImplTypes); 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->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->wMajorVerNum == 0, "wMajorVerNum = %d\n", typeattr->wMajorVerNum);
ok(typeattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", typeattr->wMinorVerNum); 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_ReleaseTypeAttr(ti, typeattr);
ITypeInfo_Release(ti); ITypeInfo_Release(ti);
......
...@@ -1640,6 +1640,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc( ...@@ -1640,6 +1640,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
int *typedata; int *typedata;
int i, num_defaults = 0; int i, num_defaults = 0;
int decoded_size; int decoded_size;
TYPEKIND tkind;
HRESULT hres; HRESULT hres;
TRACE("(%p,%d,%p)\n", iface, index, pFuncDesc); TRACE("(%p,%d,%p)\n", iface, index, pFuncDesc);
...@@ -1653,7 +1654,9 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc( ...@@ -1653,7 +1654,9 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
pFuncDesc->cParamsOpt, pFuncDesc->oVft, pFuncDesc->cScodes, pFuncDesc->cParamsOpt, pFuncDesc->oVft, pFuncDesc->cScodes,
pFuncDesc->elemdescFunc.tdesc.vt, pFuncDesc->wFuncFlags); 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: case TKIND_MODULE:
if(pFuncDesc->funckind != FUNC_STATIC) if(pFuncDesc->funckind != FUNC_STATIC)
return TYPE_E_BADMODULEKIND; return TYPE_E_BADMODULEKIND;
...@@ -1814,15 +1817,16 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddImplType( ...@@ -1814,15 +1817,16 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddImplType(
ref->flags = 0; ref->flags = 0;
ref->oCustData = -1; ref->oCustData = -1;
ref->onext = -1; ref->onext = -1;
} else if ((This->typeinfo->typekind & 15) == TKIND_DISPATCH) { } else if ((This->typeinfo->typekind & 15) == TKIND_INTERFACE ||
FIXME("dispatch case unhandled.\n"); (This->typeinfo->typekind&0x10)) {
} else if ((This->typeinfo->typekind & 15) == TKIND_INTERFACE) {
if (This->typeinfo->cImplTypes && index==1) if (This->typeinfo->cImplTypes && index==1)
return TYPE_E_BADMODULEKIND; return TYPE_E_BADMODULEKIND;
if( index != 0) return TYPE_E_ELEMENTNOTFOUND; if( index != 0) return TYPE_E_ELEMENTNOTFOUND;
This->typeinfo->datatype1 = hRefType; This->typeinfo->datatype1 = hRefType;
} else if ((This->typeinfo->typekind & 15) == TKIND_DISPATCH) {
FIXME("dispatch case unhandled.\n");
} else { } else {
FIXME("AddImplType unsupported on typekind %d\n", This->typeinfo->typekind & 15); FIXME("AddImplType unsupported on typekind %d\n", This->typeinfo->typekind & 15);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -2779,7 +2783,10 @@ static HRESULT WINAPI ITypeInfo2_fnGetTypeAttr( ...@@ -2779,7 +2783,10 @@ static HRESULT WINAPI ITypeInfo2_fnGetTypeAttr(
(*ppTypeAttr)->lcid = This->typelib->typelib_header.lcid; (*ppTypeAttr)->lcid = This->typelib->typelib_header.lcid;
(*ppTypeAttr)->cbSizeInstance = This->typeinfo->size; (*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)->cFuncs = This->typeinfo->cElement&0xffff;
(*ppTypeAttr)->cVars = This->typeinfo->cElement>>16; (*ppTypeAttr)->cVars = This->typeinfo->cElement>>16;
(*ppTypeAttr)->cImplTypes = This->typeinfo->cImplTypes; (*ppTypeAttr)->cImplTypes = This->typeinfo->cImplTypes;
...@@ -2872,8 +2879,13 @@ static HRESULT WINAPI ITypeInfo2_fnGetRefTypeOfImplType( ...@@ -2872,8 +2879,13 @@ static HRESULT WINAPI ITypeInfo2_fnGetRefTypeOfImplType(
return E_INVALIDARG; return E_INVALIDARG;
if(index == -1) { if(index == -1) {
FIXME("Dual interfaces not handled yet\n"); if((This->typeinfo->typekind&0xf)==TKIND_DISPATCH
return E_NOTIMPL; && (This->typeinfo->flags&TYPEFLAG_FDUAL)) {
*pRefType = -2; /* FIXME: is it correct? */
return S_OK;
}
return TYPE_E_ELEMENTNOTFOUND;
} }
if(index >= This->typeinfo->cImplTypes) if(index >= This->typeinfo->cImplTypes)
...@@ -3014,6 +3026,11 @@ static HRESULT WINAPI ITypeInfo2_fnGetRefTypeInfo( ...@@ -3014,6 +3026,11 @@ static HRESULT WINAPI ITypeInfo2_fnGetRefTypeInfo(
if(!ppTInfo) if(!ppTInfo)
return E_INVALIDARG; return E_INVALIDARG;
if(hRefType == -2) {
FIXME("Negative hreftype not handled yet\n");
return E_NOTIMPL;
}
if(hRefType&1) { if(hRefType&1) {
ITypeLib *tl; ITypeLib *tl;
MSFT_ImpInfo *impinfo; MSFT_ImpInfo *impinfo;
......
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