Commit 3c747fec authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

oleaut32: Added ICreateTypeInfo2_SetFuncHelpContext implementation.

parent eb15921f
......@@ -1106,6 +1106,9 @@ static void test_CreateTypeLib(void) {
hres = ICreateTypeInfo_AddFuncDesc(createti, 0, &funcdesc);
ok(hres == S_OK, "got %08x\n", hres);
hres = ICreateTypeInfo_SetFuncHelpContext(createti, 0, 0xabcdefab);
ok(hres == S_OK, "got %08x\n", hres);
funcdesc.invkind = INVOKE_PROPERTYPUT;
hres = ICreateTypeInfo_AddFuncDesc(createti, 1, &funcdesc);
ok(hres == TYPE_E_INCONSISTENTPROPFUNCS, "got %08x\n", hres);
......@@ -1126,10 +1129,19 @@ static void test_CreateTypeLib(void) {
hres = ICreateTypeInfo_AddFuncDesc(createti, 1, &funcdesc);
ok(hres == S_OK, "got %08x\n", hres);
hres = ICreateTypeInfo_SetFuncHelpContext(createti, 1, 0xabcdefab);
ok(hres == S_OK, "got %08x\n", hres);
funcdesc.invkind = INVOKE_PROPERTYPUTREF;
hres = ICreateTypeInfo_AddFuncDesc(createti, 0, &funcdesc);
ok(hres == S_OK, "got %08x\n", hres);
hres = ICreateTypeInfo_SetFuncHelpContext(createti, 0, 0xabcdefab);
ok(hres == S_OK, "got %08x\n", hres);
hres = ICreateTypeInfo_SetFuncHelpContext(createti, 0, 0x201);
ok(hres == S_OK, "got %08x\n", hres);
funcdesc.memid = 1;
funcdesc.lprgelemdescParam = NULL;
funcdesc.invkind = INVOKE_FUNC;
......
......@@ -2264,8 +2264,42 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetFuncHelpContext(
UINT index,
DWORD dwHelpContext)
{
FIXME("(%p,%d,%d), stub!\n", iface, index, dwHelpContext);
return E_OUTOFMEMORY;
ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
CyclicList *func;
int *typedata;
int size;
TRACE("(%p,%d,%d)\n", iface, index, dwHelpContext);
if(This->typeinfo->cElement<index)
return TYPE_E_ELEMENTNOTFOUND;
if(This->typeinfo->cElement == index)
func = This->typedata;
else
for(func=This->typedata->next->next; func!=This->typedata; func=func->next)
if(index-- == 0)
break;
typedata = func->u.data;
/* Compute func size without arguments */
size = typedata[0] - typedata[5]*(typedata[4]&0x1000?16:12);
/* Allocate memory for HelpContext if needed */
if(size < 7*sizeof(int)) {
typedata = HeapReAlloc(GetProcessHeap(), 0, typedata, typedata[0]+sizeof(int));
if(!typedata)
return E_OUTOFMEMORY;
memmove(&typedata[7], &typedata[6], typedata[0]-sizeof(int)*6);
typedata[0] += sizeof(int);
This->typedata->next->u.val += sizeof(int);
func->u.data = typedata;
}
typedata[6] = dwHelpContext;
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