If you use Visual C++ 6.0 or later, you can use the following procedure to add the IADsExtension interface implementation. Otherwise, you will need to type (or copy and paste) the IADsExtension declaration and implementation.
You will need to implement the IADsExtension through the ADs section of the Type Library of your project environment. This will comment out the import .tlb in MyExtension.h, since the activeds.h file is included.
//#import "c:\winnt\system32\activeds.tlb"
Note Developers not using Visual C++ 6.0 must also do the following steps:
protected:
ITypeInfo *m_pTypeInfo;
MyExtension();
~MyExtension();
MyExtension::MyExtension()
{
HRESULT hr;
ITypeLib *pITypeLib;
m_pTypeInfo = NULL;
hr = LoadRegTypeLib( LIBID_ADSFIRSTEXTLib,
1,
0,
PRIMARYLANGID(GetSystemDefaultLCID()),
&pITypeLib );
if ( SUCCEEDED(hr)
{
hr = pITypeLib->GetTypeInfoOfGuid( IID_IMyExtension, &m_pTypeInfo);
}
pITypeLib->Release();
}
MyExtension::~MyExtension()
{
if ( m_pTypeInfo )
{
m_pTypeInfo->Release();
}
}
Note ADsIIS doesn't support a credentials field, so if the Operate method is passed with ADS_EXT_INITCREDENTIALS, ADsIIS will ignore that flag.
STDMETHOD(Operate)(ULONG dwCode, VARIANT varData1, VARIANT varData2, VARIANT varData3)
{
HRESULT hr = S_OK;
switch (dwCode)
{
case ADS_EXT_INITCREDENTIALS:
// At the time of this writing, this case is not
// supported by the IIS ADSI provider.
// MessageBox(NULL, "INITCRED", "ADsExt", MB_OK);
break;
default:
hr = E_FAIL;
break;
}
return hr;
}
STDMETHOD (PrivateGetIDsOfNames)(
REFIID riid,
OLECHAR __RPC_FAR *__RPC_FAR *rgszNames,
unsigned int cNames,
LCID lcid,
DISPID __RPC_FAR *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 __RPC_FAR *pdispparams,
VARIANT __RPC_FAR *pvarResult,
EXCEPINFO __RPC_FAR *pexcepinfo,
unsigned int __RPC_FAR *puArgErr);
{
return DispInvoke( (IMyExtension*)this,
m_pTypeInfo,
dispidMember,
wFlags,
pdispparams,
pvarResult,
pexcepinfo,
puArgErr );
}
You should now be able to compile and have support for late binding. For the latest information on ADSI, check out the ADSI Web site: http://www.microsoft.com/adsi.