Platform SDK: Active Directory, ADSI, and Directory Services
ADSI and Extensions: What's Happening Under the Hood?
This is how ADSI interacts with extensions.
Something binds to an ADSI directory object. For example, LDAP://CN=Jsmith, OU=Sales, DC=Microsoft, DC=COM.
ADSI finds that the object is in the class called user.
ADSI does a lookup in the registry and finds the extension CLSIDs for user. (Note: ADSI actually caches this information.)
Something calls the QueryInterface method for IID_IMyExtension. ADSI searches the interfaces associated with the user object, starting with its own interfaces, then looking at extension interfaces.
If a match is found, ADSI creates an instance of the component that supports IID_IMyExtension, and calls QueryInterface for the extension. The resulting interface is returned to the consumer.
The consumer uses this interface to call the interface's methods.
Next, the client calls QueryInterface for IID_IYourExtension, which is in a different component. This component will delegate this QueryInterface call to the IUnknown interface of the aggregator, which happens to be ADSI itself.
Once again, ADSI searches the interfaces and creates the component instance.