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 converts raw binary data in a filter element to a safe text string that can be passed safely in a search filter.

Syntax

ULONG ldap_escape_filter_element(
  UNICODE PTCHAR 
sourceFilterElement,
  ULONG 
sourceLength,
  UNICODE PTCHAR 
destFilterElement,
  ULONG 
destLength
);

Parameters

sourceFilterElement

[in] Filter element to convert.

sourceLength

[in] Length of the source filter element.

destFilterElement

[out] Safe text string.

destLength

[out] Length of the safe text string.

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 allows you to use raw binary data in search filters. For example, you can use this function to specify a certificate or a JPEG image as the attribute to match.

Call this function with the sourceFilterElementparameter pointing to raw data and sourceCountset appropriately to the length of data. If the destFilterElementparameter is NULL, then the return value is the length required for the output buffer. If destFilterElementis not NULL, then the function copies the source into the destination buffer and ensures that it is of a safe format. Then insert the destination buffer into your search filter after the "attributetype=" filter element.

Do not call this function for attribute values that are strings, as the run time does not perform any conversion from UTF-8 format. Use this function only for attribute elements that are raw binary data.

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

Reference

LDAP_RETCODE