LDAPSortKeyA structure (winldap.h)

The LDAPSortKey structure stores sorting criteria for use by sort controls.


typedef struct ldapsortkeyA {
  PCHAR   sk_attrtype;
  PCHAR   sk_matchruleoid;
  BOOLEAN sk_reverseorder;
} LDAPSortKeyA, *PLDAPSortKeyA;



Pointer to a null-terminated string that specifies the name of the attribute to use as a sort key. Use multiple LDAPSortKey structures to specify multiple sort keys. Be aware that Active Directory supports only a single sort key.


Pointer to a null-terminated string that specifies the object identifier of the matching rule for the sort. Should be set to NULL if you do not want to explicitly specify a matching rule for the sort. Specifying an explicitly set matching rule is supported only by Windows Server 2003.


If TRUE, specifies that the sort be ordered from lowest to highest. If FALSE, the sort order is from highest to lowest.


The ldap_create_sort_control and ldap_search_init_page functions use this structure to specify how results should be sorted before being returned to the client.


The winldap.h header defines LDAPSortKey as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Header winldap.h

See also

Data Structures


Using Controls