Here is how I've interpreted the docs:
--- .idl file entry
HRESULT FindSuspectTraces(IDispatch *Repository, BSTR SearchText, [out] BSTR *XMLResults);
--- function definition
HRESULT STDMETHODCALLTYPE CAddIn::FindSuspectTraces(IDispatch *Repository, BSTR SearchText, BSTR *XMLResults)
{
wstring wXML;
wXML = L"<ReportViewData>\n";
wXML += L" <Fields>\n";
wXML += L" <Field name=\"Object\"/>\n";
wXML += L" <Field name=\"CLASSGUID\"/>\n";
wXML += L" </Fields>\n";
wXML += L" <Rows>\n";
vector<wstring> modelGuids;
modelRepo->GetModelGuids(&modelGuids);
for(vector<wstring>::iterator mgi=modelGuids.begin(); mgi!=modelGuids.end(); mgi++) {
wstring suspects;
modelRepo->GetIntegritySetting(mgi->c_str(), mgi->c_str(), L"suspects", suspects);
if (!suspects.empty()) {
wchar_t *suspects_buf = _wcsdup(suspects.c_str());
for(wchar_t *p = suspects_buf; *p;) {
wchar_t *pend = wcschr(p, L',');
if (pend == NULL)
break;
*pend++ = L'\0';
wchar_t *pend2 = wcschr(pend, L'\n');
if (pend2 == NULL)
break;
*pend2++ = L'\0';
wXML += L" <Row>\n";
wXML += L" <Field name=\"CLASSGUID\" value=\"";
wXML += p;
wXML += L"\"/>\n";
wXML += L" <Field name=\"Object\" value=\"";
wXML += pend;
wXML += L"\"/>\n";
wXML += L" </Row>\n";
p = pend2;
}
free(suspects_buf);
}
}
wXML += L" </Rows>\n";
wXML += L"</ReportViewData>\n";
BSTR bXML = ::SysAllocString(wXML.c_str());
*XMLResults = bXML;
return S_OK;
}
--- XML that the above function produces
<ReportViewData>
<Fields>
<Field name="Object"/>
<Field name="CLASSGUID"/>
</Fields>
<Rows>
<Row>
<Field name="CLASSGUID" value="{991DC3C2-DC4C-4faa-B848-4E9E91667287}"/>
<Field name="Object" value="Use Case Model"/>
</Row>
</Rows>
</ReportViewData>
Yet nothing is displayed in the Model Search window when I execute the "Find Suspect Traces" search. I know that my function is being called, so I suspect that I've interpreted the docs incorrectly, and don't have the function declaration correct and/or I'm not setting XMLResults correctly.