Platform SDK: Active Directory, ADSI, and Directory Services

ldap_create_sort_control

Use the ldap_create_sort_control function to format a list of sort keys into a search control. Support for this function is available in LDAP 3 and later.

ULONG ldap_create_sort_control (
  PLDAP ExternalHandle,
  PLDAPSortKey* SortKeys,
  UCHAR IsCritical,
  PLDAPControl* Control
);

Parameters

ExternalHandle
[in] The session handle.
SortKeys
[in] A list of LDAPSortKey structures.
IsCritical
[in] Tells the server whether this control is critical to the search. 0 ==> False, !0 ==> True.
Control
[out] Pointer to the newly created control.

Return Values

Value Meaning
LDAP_SUCCESS The call completed successfully.
LDAP_UNAVAILABLE_CRIT_EXTENSION The control is critical and the server does not support the control.

Remarks

The ldap_create_sort_control function creates a simple sort control. Such a control is useful when the LDAP client has limited functionality and cannot sort results, yet needs them sorted.

The sort keys are passed as a list of LDAPSortKey structures, one key for each attribute type within the sort process. The sort keys specify the matching rules a server should use when returning the results to an LDAP search request.

The sort controls allow a server to return a result code for the sorting of the results that is independent of the result code returned for the search operation.

To free the control when it is no longer needed, call ldap_control_free.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 SP4 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Winldap.h.
  Library: Use Wldap32.lib.
  Unicode: Declared as Unicode and ANSI prototypes.

See Also

Functions, ldap_control_free, LDAPSortKey