Oftentimes an extension needs to get information from the IIS object it binds to. For example, an extension for IIsWebVirtualDir might need the LogType property of the current object. This can be easily achieved by issuing a QueryInterface to the aggregator’s IUnknown. This code is intended as an example only.
HRESULT hr;
IADs *pADs; // ADSI Interface to get and set attributes.
hr = m_pOuterUnk->QueryInterface(IID_IADs,(void**)&pADs);
if ( SUCCEEDED(hr) )
{
VARIANT var;
VariantInit(&var);
hr = pADs ->Get(L"LogType", &var);
printf("%S\n", V_BSTR(&var));
VariantClear(&var);
pADs->Release();
}
Note It's very important to release the reference to the aggregator to prevent looping errors and allow early binding to function properly.