| Platform SDK: Active Directory, ADSI, and Directory Services |
IADsExtension is an optional interface. The extension writer should implement this interface when at least one of the following conditions is met:
If an extension component supports IADsExtension for reason number 1 only, the IADsExtension::PrivateGetIDsOfNames and IADsExtension::PrivateInvoke methods can simply return E_NOTIMPL. On the other hand, if an extension component supports this interface for reason number 2 only, the Operate method can simply ignore the data and return an HRESULT of E_NOTIMPL.
The following is an example of an extension implementing IADsExtension:
STDMETHOD(Operate)(ULONG dwCode, VARIANT varData1, VARIANT varData2, VARIANT varData3)
{
HRESULT hr = S_OK;
switch (dwCode)
{
case ADS_EXT_INIT:
// you can prompt for a credential if you like
// MessageBox(NULL, "INITCRED", "ADsExt", MB_OK);
break;
default:
hr = E_FAIL;
break;
}
return hr;
}
STDMETHOD(PrivateGetIDsOfNames)(REFIID riid, OLECHAR ** rgszNames, unsigned int cNames, LCID lcid, DISPID * rgdispid)
{
if (rgdispid == NULL)
{
return E_POINTER;
}
return DispGetIDsOfNames(m_pTypeInfo, rgszNames, cNames, rgdispid);
}
STDMETHOD(PrivateInvoke)(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, UINT * puArgErr)
{
return DispInvoke( (IHelloWorld*)this,
m_pTypeInfo,
dispidMember,
wFlags,
pdispparams,
pvarResult,
pexcepinfo,
puArgErr );
}