Active Directory objects are COM objects. Active Directory programming is COM programming. In its most basic form, programmers interact with COM objects by calling one of the standard OLE procedures to obtain a pointer to an object's IUnknown interface. They then call QueryInterface to obtain a pointer to the specific interface of interest.
Active Directory interfaces can all be called using this standard COM model by using traditional compiled languages such as, Microsoft C and Microsoft C/C++. Active Directory providers a "helper" function, OleDsGetObject, to simplify the process of obtaining the desired interface pointer from a given Active Directory object.
Example 1: Creating a User (C/C++)
IOleDsContainer *pContainer; IOleDs *pNewObject; IOleDsContainer *pContainer; IOleDs *pNewObject; IOleDsUser *pUser; IOleDsUserAccountRestrictions *pAcctRestr; // // Bind to the known container. // OleDsGetObject(TEXT"@WinNT!MSFT", IID_IOleDsContainer, (void**)&pContainer); // // Create the new Active Directory User object. // pContainer->Create(TEXT"User", TEXT"Jane", &pNewObject); // // Get the IOleDsUser interface from the user object. // pNewObject->QueryInterface(IID_IOleDsUser, &pUser); // // Set Jane's password. // pUser->AccountRestrictions(&pAcctRestr); pAcctRestr->SetPassword(TEXT"Argus"); // // Complete the operation to create the object. // pUser->SetInfo(); // // Cleanup. // pContainer->Release(); pNewObject->Release(); pUser->Release(); pAcctRestr->Release();