Platform SDK: Active Directory, ADSI, and Directory Services

Late Binding: What's Happening Under the Hood?

Here is what is happening in the late binding case:

  1. Something binds to an ADSI directory object. For example, LDAP://CN=Jsmith, OU=Sales, DC=Microsoft, DC=COM binds using COM late binding. This causes ADSI to call the QueryInterface method on the IDispatch interface.
  2. ADSI finds an object in the user class and creates an object that supports the appropriate interfaces (such as IADs, IADsUser).
  3. ADSI performs a lookup in the registry and finds extension CLSIDs for user. (Note: ADSI actually caches this information.)
  4. Something makes a call to MyNewMethod. ADSI looks up its dispatch ID and the dispatch IDs for other ADSI extensions. ADSI then finds the extension that serves this call, and calls the IADsExtension interface for that extension.
  5. The extension executes the function.
  6. Now, the client writer invokes YourNewMethod using the IDispatch interface for the current extension. The extension's IDispatch implementation delegates back to the IDispatch for ADSI.
  7. The IDispatch for ADSI again searches for the appropriate extension (or itself), then it calls the appropriate extension using the IADsExtension interface for that extension.