다음을 통해 공유


ldap_first_attribute (Windows Embedded CE 6.0)

1/6/2010

This function returns the first attribute for a given directory entry.

Syntax

UNICODE PTCHAR ldap_first_attribute(
  LDAP* ld,
  LDAPMessage* entry,
  BerElement** ptr
);

Parameters

  • ld
    [in] Session handle.
  • ptr
    [out] Address of a pointer used internally to keep track of the current position in the entry.

Return Value

If this function succeeds, it returns a pointer to an allocated buffer containing the current attribute name. When there are no more attributes to step through, it returns NULL.

If this function fails, it returns NULL.

Remarks

Use this function in conjunction with ldap_next_attribute to step through the list of attribute types returned with an entry. You can then pass these attribute names in a call to ldap_get_values to retrieve their associated values.

A call to ldap_first_attribute allocates, and returns through the ptr parameter, a pointer to a BerElement structure. Pass this pointer to ldap_next_attribute to keep track of the current position in the list of attributes. When you have finished stepping through a list of attributes and ptr is non-NULL, free the pointer by calling ber_free (ptr, 0).

Note

It is very important to pass the second parameter as 0 (zero) in this call.

Both ldap_first_attribute and ldap_next_attribute return a pointer to an allocated buffer containing the current attribute name. This should be freed when no longer in use by calling ldap_memfree.

Requirements

Header winldap.h
Library wldap32.lib
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

LDAP Search Functions
BerElement
ldap_first_entry
ldap_get_values
ldap_memfree
ldap_next_attribute
ldap_next_entry