[PATCH 1/4] oleaut32: Implement ICreateTypeInfo::SetFuncAndParamNames
Andrew Eikum
aeikum at codeweavers.com
Wed May 29 14:59:09 CDT 2013
---
dlls/oleaut32/tests/typelib.c | 7 +++++++
dlls/oleaut32/typelib.c | 41 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 0bc1854..1919ea8 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -3250,6 +3250,13 @@ static void test_SetFuncAndParamNames(void)
hr = ICreateTypeInfo_SetFuncAndParamNames(cti, 2, propW, 1);
ok(hr == S_OK, "got 0x%08x\n", hr);
+ hr = ICreateTypeInfo_AddFuncDesc(cti, 3, &funcdesc);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ /* getter name again */
+ hr = ICreateTypeInfo_SetFuncAndParamNames(cti, 3, propW, 1);
+ ok(hr == TYPE_E_AMBIGUOUSNAME, "got 0x%08x\n", hr);
+
ICreateTypeInfo_Release(cti);
ICreateTypeLib2_Release(ctl);
DeleteFileA(filenameA);
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 922e9ab..50a955e 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -8840,8 +8840,45 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetFuncAndParamNames(ICreateTypeInfo2 *
UINT index, LPOLESTR *names, UINT numNames)
{
ITypeInfoImpl *This = info_impl_from_ICreateTypeInfo2(iface);
- FIXME("%p %u %p %u - stub\n", This, index, names, numNames);
- return E_NOTIMPL;
+ TLBFuncDesc *func_desc = &This->funcdescs[index];
+ int i;
+
+ TRACE("%p %u %p %u\n", This, index, names, numNames);
+
+ if (!names)
+ return E_INVALIDARG;
+
+ if (index >= This->TypeAttr.cFuncs || numNames == 0)
+ return TYPE_E_ELEMENTNOTFOUND;
+
+ if (func_desc->funcdesc.invkind & (INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF)){
+ if(numNames > func_desc->funcdesc.cParams)
+ return TYPE_E_ELEMENTNOTFOUND;
+ } else
+ if(numNames > func_desc->funcdesc.cParams + 1)
+ return TYPE_E_ELEMENTNOTFOUND;
+
+ for(i = 0; i < This->TypeAttr.cFuncs; ++i) {
+ TLBFuncDesc *iter = &This->funcdescs[i];
+ if (iter->Name && !strcmpW(iter->Name, *names)) {
+ if (iter->funcdesc.invkind & (INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF | INVOKE_PROPERTYGET) &&
+ func_desc->funcdesc.invkind & (INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF | INVOKE_PROPERTYGET) &&
+ func_desc->funcdesc.invkind != iter->funcdesc.invkind)
+ continue;
+ return TYPE_E_AMBIGUOUSNAME;
+ }
+ }
+
+ SysFreeString(func_desc->Name);
+ func_desc->Name = SysAllocString(*names);
+
+ for (i = 1; i < numNames; ++i) {
+ TLBParDesc *par_desc = func_desc->pParamDesc + i - 1;
+ SysFreeString(par_desc->Name);
+ par_desc->Name = SysAllocString(*(names + i));
+ }
+
+ return S_OK;
}
static HRESULT WINAPI ICreateTypeInfo2_fnSetVarName(ICreateTypeInfo2 *iface,
--
1.8.3
More information about the wine-patches
mailing list