次の方法で共有


ldap_compare (Windows Embedded CE 6.0)

1/6/2010

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

Syntax

ULONG ldap_compare(
  LDAP* ld,
  UNICODE PTCHAR dn,
  UNICODE PTCHAR attr,
  UNICODE PTCHAR value
);

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 Value

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_abandonfunction.

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

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

See Also

Reference

LDAP Directory Entry Functions
ldap_abandon
ldap_bind
ldap_compare_ext
ldap_compare_ext_s
ldap_compare_s
ldap_result
ldap_simple_bind