The helper functions wrap code required to do common operations. The helper functions will be included within the ActiveDs.DLL that ship with the Active Directory Software Developer Kit. The source code for the helper functions will not be shipped. Documentation on how to call them will be included.
The ADsGetObject helper function is called by the C/C++ client to bind to an Active Directory object. Just like Visual Basic's internal GetObject() function, ADsGetObject takes as input a display name. The display name is discussed within the overview under object binding. A pointer to the requested interface is returned. ADsGetObject calls MkParseDisplayName and then calls the BindToObject method.
HRESULT
ADsGetObject(
LPWSTR *lpObjectPath
REFIID riid,
void ** ppObject
)
The ADsBuildEnumerator helper function encapsulates the code required to create an enumerator object. It calls the _NewEnum method in the IADsContainer interface to create an enumerator and then calls the Query Interface method of IUnknown to get a pointer to the IEnumVARIANT interface for that enumerator. The enumeration object is the Automation mechanism to enumerate over containers.
HRESULT
ADsBuildEnumerator(
IADsContainer *pADsContainer,
IEnumVARIANT * * ppEnumVariant
)
The ADsFreeEnumerator function frees an enumerator returned by ADsBuildEnumerator.
HRESULT
ADsFreeEnumerator(
IEnumVARIANT *pEnumVariant
);
The ADsEnumerateNext helper function returns populates a VARIANT array with elements fetched from the provider enumerator. cElements contains the count of elements requested; pcElementsReturned receives the count of elements actually returned, which can be smaller than the nunmber requested.
HRESULT
ADsEnumerateNext(
IEnumVARIANT *pEnumVariant,
ULONG cElements,
VARIANT FAR *pvar,
ULONG FAR *pcElementsFetched
);
The ADsBuildVarArrayStr function builds a VARIANT array from an array of UNICODE strings.
HRESULT
ADsBuildVarArrayStr(
LPWSTR *lppPathNames,
DWORD dwPathNames,
VARIANT ** ppVar
);
The ADsBuildVarArrayInt function builds a VARIANT array from an array of DWORDS.
ADsBuildVarArrayInt(
LPDWORD lpdwObjectTypes,
DWORD dwObjectTypes,
VARIANT** ppVar
);