Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function searches the LDAP directory and returns a requested set of attributes for each entry matched. The function is identical to ldap_search_s, except that it takes an additional parameter that specifies a local time-out for the search.

Syntax

ULONG ldap_search_st(
  LDAP* 
ld,
  UNICODE PTCHAR 
base,
  ULONG 
scope,
  UNICODE PTCHAR 
filter,
  UNICODE PTCHAR 
attrs[],
  ULONG 
attrsonly,
  struct l_timeval* 
timeout,
  LDAPMessage** 
res
);

Parameters

ld

[in] Session handle.

base

[in] Distinguished name of the entry at which to start the search.

scope

[in] Specifies one of the following values to indicate the scope of the search.

Value Description

LDAP_SCOPE_BASE

Searches the base entry only.

LDAP_SCOPE_ONELEVEL

Searches all entries in the first level below the base entry, excluding the base entry.

LDAP_SCOPE_SUBTREE

Searches the base entry and all entries in the tree below the base.

filter

[in] Pointer to a null-terminated string that specifies the search filter.

attrs

[in] Null-terminated array of strings that indicate which attributes to return for each matching entry. Pass NULL to retrieve all available attributes.

attrsonly

[in] Boolean value that should be zero if both attribute types and values are to be returned and nonzero if only types are wanted.

timeout

[in] Local search time-out value in seconds.

res

[out] Contains the results of the search upon completion of the call.

Return Value

If this function succeeds, the return value is LDAP_SUCCESS.

If this function fails, it returns an error code. See the LDAP_RETCODEenumeration for a list of possible return values.

Remarks

This function initiates a synchronous search operation.

You can use the ldap_set_optionfunction with the ldsession handle to set the LDAP_OPT_SIZELIMIT and LDAP_OPT_DEREF options that determine how the search is performed. The timeoutparameter in ldap_search_stoverrides the LDAP_OPT_TIMELIMIT option.

Upon completion of the search operation, this function returns to the caller. Use ldap_searchor ldap_search_extif you prefer to have the operation carried out asynchronously.

In a multithreading environment, calls to ldap_search_stare thread-safe.

Requirements

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

See Also