Partager via


ldap_compare (Windows CE 5.0)

Send Feedback

This function determines whether an attribute for a given entry holds a known value.

ULONG ldap_compare(LDAP* ld,UNICODE PTCHARdn,UNICODE PTCHARattr,UNICODE PTCHARvalue);

Parameters

  • ld
    [in] Session handle.
  • dn
    [in] Distinguished name of the entry.
  • attr
    [in] Attribute to compare.
  • value
    [in] String attribute value to compare to the attribute value.

Return Values

If this function succeeds, the return value is the message identifier of the compare operation.

If this function fails, it returns –1 and sets the session error parameters in the LDAP structure.

Remarks

This function initiates an asynchronous compare operation, comparing the value of an attribute to a known string value. Use ldap_compare_ext or ldap_compare_ext_s if you need to compare binary values. Use ldap_compare_s or ldap_compare_ext_s to carry out a synchronous compare operation.

As an asynchronous function, ldap_compare returns a message identifier for the operation. Call the ldap_result function with the message identifier to get the result of the operation. To cancel an asynchronous operation before it has been completed, call the ldap_abandon function.

If you prefer to have the function return the results directly, use the synchronous routine ldap_compare_s. Use ldap_compare_ext or ldap_compare_ext_s if you need support for LDAP 3 server and client controls.

In a multithreading environment, calls to ldap_compare are not thread-safe because the function returns a message identifier rather than the return code. To determine whether the call returned an error value, you have to retrieve the return code from the connection block. It is possible for another thread to overwrite the return code before you retrieve it. Use ldap_compare_ext, ldap_compare_s, or ldap_compare_ext_s, all of which are thread-safe.

When connecting to an LDAP 2 server, the application must perform a bind operation (by calling one of the ldap_bind or ldap_simple_bind routines) before attempting other operations.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Winldap.h.
Link Library: Wldap32.lib.

See Also

ldap_abandon | ldap_bind | ldap_compare_ext | ldap_compare_ext_s | ldap_compare_s | ldap_result | ldap_simple_bind

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.