> DNU home > code projects page 1
Searching for Attribute Values - Source Code Details 6
DeveloperNet University Article

NWDSGetObjectName is called for each object to obtain the distinguished name for the found object. But before that, the DCV_CANONICALIZE_NAMES flag in the context must be cleared so that NWDSGetObjectName will return fully-distinguished names instead of abbreviated (partial context) names.

See Managing Contexts for more information on the source code used in these examples to manage NDS client contexts.

The prototype for NWDSGetObjectName is shown below:

 (NWDSCCODE) NWDSGetObjectName (NWDSContextHandle context, Buf_T * respBuf, pnstr8 objectName, pnuint32 attrCount, pObject_Info_T objectInfo );

context Specifies the NDS context for the request.

respBuf Points to the buffer containing the results of the search.

objectName Obtains the distinguished name of the object in the buffer.

attrCount Obtains the number of object's attributes in the buffer.

objectInfo Points to additional info about the object in the buffer.

Notes:

1. Non-zero return values from NWDSGetObjectName indicate an error. To understand handling client side NDS errors, refer to handling_errors.

2. You must retrieve all of the information about the current object before calling NWDSGetObjectName for the next object.

You must allocate space for the object's name. The size of the allocated memory is ((MAX_DN_CHARS)+1)*sizeof(character size) where character size is 1 for single-byte characters, and 2 for double-byte characters (Unicode is double-byte). One character is used for NULL termination.

The objectInfo parameter points to additional information about the object. You must allocate memory to retrieve this information (sizeof(Object_Info_T)).

In our example, the object names are installed into the calling routines return buffer until there are no more iterations.



PREVIOUSblankTop of PageblankNEXT