Platform SDK: Active Directory, ADSI, and Directory Services

ldap_result

The ldap_result function obtains the result of an asynchronous operation.

ULONG ldap_result(
  LDAP* ld,
  ULONG msgid,
  ULONG all,
  struct l_timeval* timeout,
  LDAPMessage** res
);

Parameters

ld
[in] The session handle.
msgid
[in] The message ID of the operation, or the constant LDAP_RES_ANY if any result is desired.
all
[in] Specifies how many messages will be retrieved in a single call to ldap_result. This parameter only has meaning for search results. Pass the constant LDAP_MSG_ONE (0x00) to retrieve one message at a time. Pass LDAP_MSG_ALL (0x01) to request that all results of a search be received before returning all results in a single chain. Pass LDAP_MSG_RECEIVED (0x02) to indicate that all results retrieved so far should be returned in the result chain.
timeout
[out] A time-out specifying how long to wait for results to be returned. A NULL value causes ldap_result to block until results are available. A time-out value of zero seconds specifies a polling behavior.
res
[out] Contains the result(s) of the operation.

Return Values

If the function succeeds, it returns the type of the first result in the res parameter as one of the following values:

LDAP_RES_ADD

LDAP_RES_BIND

LDAP_RES_COMPARE

LDAP_RES_DELETE

LDAP_RES_EXTENDED

LDAP_RES_MODDN

LDAP_RES_MODIFY

LDAP_RES_SEARCH_ENTRY

LDAP_RES_SEARCH_REFERENCE

LDAP_RES_SEARCH_RESULT

If the time-out expires, the function returns 0.

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

Remarks

The ldap_result function retrieves the result of a previous, asynchronously initiated operation. Note that, depending on the way it is called, ldap_result may actually return a list or "chain" of messages.

For connectionless LDAP, you must pass both an LDAP connection handle and a message ID to ensure that you get the correct results. The LDAP run time continues to send the request until it receives a response.

Multithreading: Calls to ldap_result are thread safe.

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.

See Also

Functions