ldap_get_optionW function (winldap.h)

The ldap_get_option function retrieves the current values of session-wide parameters.


  [in]  LDAP *ld,
  [in]  int  option,
  [out] void *outvalue


[in] ld

The session handle.

[in] option

The name of the option accessed. For more information and a list of allowable options and their values, see the following Remarks section.

[out] outvalue

The address of the option value. The actual type of this parameter depends on the setting of the option parameter.

Return value

If the function succeeds, the return value is LDAP_SUCCESS.

If the function fails, it returns an error code. For more information, see Return Values.


For more information and a description of optional settings that apply to an LDAP session, see Session Options. The outvalue value returns a pointer to an allocated block of memory of the type listed in the Session Options table; this memory should be freed using ldap_memfree when the data is no longer required, unless it is explicitly mentioned in the Session Options table not to free the returned memory.

Note  LDAP_OPT_ERROR_STRING returns a pointer to an internal static string table, and ldap_memfree should not be called when using this session option.
Multithreading: The ldap_get_option function is thread-safe.


The winldap.h header defines ldap_get_option 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
Target Platform Windows
Header winldap.h
Library Wldap32.lib
DLL Wldap32.dll

See also


Getting and Setting Session Options

Return Values

Session Options