Helper Functions

ADSI supplies several helper functions available to C and C++ developers. For a list of these functions, see ADSI Function List.

ADsGetObject, given a fully qualified distinguished name, finds the directory element specified, creates an ADSI object to represent it, and retrieves an interface pointer on that object. ADsOpenObject, in addition to performing the same function, also supplies a user name and password for credentials.

Listing the contents of a container or collection object requires a special type of object known as an enumerator. The IEnumXXXX interface on the enumerator object supplies the methods needed to list the collection of elements or objects within a container or collection. The helper functions ADsBuildEnumerator, ADsEnumerateNext, and ADsFreeEnumerator encapsulate the code needed to perform these operations. In addition, ADsBuildVarArrayInt and ADsBuildVarArrayStr are supplied to ease the task of building an array of integers or strings of type VARIANT. For more information, see enumeration examples in Automation Examples or COM Vtable Examples.