Directory Services

Late Binding: What's Happening Under the Hood?

The following list outlines the general process for performing a late bind:

  1. Something binds to an ADSI directory object. For example, LDAP://CN=Jeffsmith, OU=Sales, DC=Fabrikam, 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. Be aware that ADSI caches this data.
  4. Something makes a call to the MyNewMethod method. 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 the YourNewMethod method 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.