Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef LDAP_CLIENT_DEFINED
      7 #define LDAP_CLIENT_DEFINED
      8 
      9 #ifdef __cplusplus
     10 extern "C" {
     11 #endif
     12 
     13 #ifndef BASETYPES
     14 #include <windef.h>
     15 #endif
     16 
     17 #include <schnlsp.h>
     18 
     19 #define WINLDAPAPI DECLSPEC_IMPORT
     20 
     21 #ifndef LDAPAPI
     22 #define LDAPAPI __cdecl
     23 #endif
     24 
     25 #ifndef LDAP_UNICODE
     26 #if defined(UNICODE)
     27 #define LDAP_UNICODE 1
     28 #else
     29 #define LDAP_UNICODE 0
     30 #endif
     31 #endif
     32 
     33 #define LDAP_PORT 389
     34 #define LDAP_SSL_PORT 636
     35 #define LDAP_GC_PORT 3268
     36 #define LDAP_SSL_GC_PORT 3269
     37 
     38 #define LDAP_VERSION1 1
     39 #define LDAP_VERSION2 2
     40 #define LDAP_VERSION3 3
     41 #define LDAP_VERSION LDAP_VERSION2
     42 
     43 #define LDAP_BIND_CMD __MSABI_LONG(0x60)
     44 #define LDAP_UNBIND_CMD __MSABI_LONG(0x42)
     45 #define LDAP_SEARCH_CMD __MSABI_LONG(0x63)
     46 #define LDAP_MODIFY_CMD __MSABI_LONG(0x66)
     47 #define LDAP_ADD_CMD __MSABI_LONG(0x68)
     48 #define LDAP_DELETE_CMD __MSABI_LONG(0x4a)
     49 #define LDAP_MODRDN_CMD __MSABI_LONG(0x6c)
     50 #define LDAP_COMPARE_CMD __MSABI_LONG(0x6e)
     51 #define LDAP_ABANDON_CMD __MSABI_LONG(0x50)
     52 #define LDAP_SESSION_CMD __MSABI_LONG(0x71)
     53 #define LDAP_EXTENDED_CMD __MSABI_LONG(0x77)
     54 
     55 #define LDAP_RES_BIND __MSABI_LONG(0x61)
     56 #define LDAP_RES_SEARCH_ENTRY __MSABI_LONG(0x64)
     57 #define LDAP_RES_SEARCH_RESULT __MSABI_LONG(0x65)
     58 #define LDAP_RES_MODIFY __MSABI_LONG(0x67)
     59 #define LDAP_RES_ADD __MSABI_LONG(0x69)
     60 #define LDAP_RES_DELETE __MSABI_LONG(0x6b)
     61 #define LDAP_RES_MODRDN __MSABI_LONG(0x6d)
     62 #define LDAP_RES_COMPARE __MSABI_LONG(0x6f)
     63 #define LDAP_RES_SESSION __MSABI_LONG(0x72)
     64 #define LDAP_RES_REFERRAL __MSABI_LONG(0x73)
     65 #define LDAP_RES_EXTENDED __MSABI_LONG(0x78)
     66 
     67 #define LDAP_RES_ANY (__MSABI_LONG(-1))
     68 
     69 #define LDAP_INVALID_CMD 0xff
     70 #define LDAP_INVALID_RES 0xff
     71 
     72   typedef enum {
     73     LDAP_SUCCESS = 0x00,LDAP_OPERATIONS_ERROR = 0x01,LDAP_PROTOCOL_ERROR = 0x02,LDAP_TIMELIMIT_EXCEEDED = 0x03,LDAP_SIZELIMIT_EXCEEDED = 0x04,
     74     LDAP_COMPARE_FALSE = 0x05,LDAP_COMPARE_TRUE = 0x06,LDAP_AUTH_METHOD_NOT_SUPPORTED = 0x07,LDAP_STRONG_AUTH_REQUIRED = 0x08,LDAP_REFERRAL_V2 = 0x09,
     75     LDAP_PARTIAL_RESULTS = 0x09,LDAP_REFERRAL = 0x0a,LDAP_ADMIN_LIMIT_EXCEEDED = 0x0b,LDAP_UNAVAILABLE_CRIT_EXTENSION = 0x0c,
     76     LDAP_CONFIDENTIALITY_REQUIRED = 0x0d,LDAP_SASL_BIND_IN_PROGRESS = 0x0e,LDAP_NO_SUCH_ATTRIBUTE = 0x10,LDAP_UNDEFINED_TYPE = 0x11,
     77     LDAP_INAPPROPRIATE_MATCHING = 0x12,LDAP_CONSTRAINT_VIOLATION = 0x13,LDAP_ATTRIBUTE_OR_VALUE_EXISTS = 0x14,LDAP_INVALID_SYNTAX = 0x15,
     78     LDAP_NO_SUCH_OBJECT = 0x20,LDAP_ALIAS_PROBLEM = 0x21,LDAP_INVALID_DN_SYNTAX = 0x22,LDAP_IS_LEAF = 0x23,LDAP_ALIAS_DEREF_PROBLEM = 0x24,
     79     LDAP_INAPPROPRIATE_AUTH = 0x30,LDAP_INVALID_CREDENTIALS = 0x31,LDAP_INSUFFICIENT_RIGHTS = 0x32,LDAP_BUSY = 0x33,LDAP_UNAVAILABLE = 0x34,
     80     LDAP_UNWILLING_TO_PERFORM = 0x35,LDAP_LOOP_DETECT = 0x36,LDAP_SORT_CONTROL_MISSING = 0x3C,LDAP_OFFSET_RANGE_ERROR = 0x3D,
     81     LDAP_NAMING_VIOLATION = 0x40,LDAP_OBJECT_CLASS_VIOLATION = 0x41,LDAP_NOT_ALLOWED_ON_NONLEAF = 0x42,LDAP_NOT_ALLOWED_ON_RDN = 0x43,
     82     LDAP_ALREADY_EXISTS = 0x44,LDAP_NO_OBJECT_CLASS_MODS = 0x45,LDAP_RESULTS_TOO_LARGE = 0x46,LDAP_AFFECTS_MULTIPLE_DSAS = 0x47,
     83     LDAP_VIRTUAL_LIST_VIEW_ERROR = 0x4c,LDAP_OTHER = 0x50,LDAP_SERVER_DOWN = 0x51,LDAP_LOCAL_ERROR = 0x52,LDAP_ENCODING_ERROR = 0x53,
     84     LDAP_DECODING_ERROR = 0x54,LDAP_TIMEOUT = 0x55,LDAP_AUTH_UNKNOWN = 0x56,LDAP_FILTER_ERROR = 0x57,LDAP_USER_CANCELLED = 0x58,LDAP_PARAM_ERROR = 0x59,
     85     LDAP_NO_MEMORY = 0x5a,LDAP_CONNECT_ERROR = 0x5b,LDAP_NOT_SUPPORTED = 0x5c,LDAP_NO_RESULTS_RETURNED = 0x5e,LDAP_CONTROL_NOT_FOUND = 0x5d,
     86     LDAP_MORE_RESULTS_TO_RETURN = 0x5f,LDAP_CLIENT_LOOP = 0x60,LDAP_REFERRAL_LIMIT_EXCEEDED = 0x61
     87   } LDAP_RETCODE;
     88 
     89 #define LDAP_AUTH_SIMPLE __MSABI_LONG(0x80)
     90 #define LDAP_AUTH_SASL __MSABI_LONG(0x83)
     91 #define LDAP_AUTH_OTHERKIND __MSABI_LONG(0x86)
     92 #define LDAP_AUTH_SICILY (LDAP_AUTH_OTHERKIND | 0x0200)
     93 #define LDAP_AUTH_MSN (LDAP_AUTH_OTHERKIND | 0x0800)
     94 #define LDAP_AUTH_NTLM (LDAP_AUTH_OTHERKIND | 0x1000)
     95 #define LDAP_AUTH_DPA (LDAP_AUTH_OTHERKIND | 0x2000)
     96 #define LDAP_AUTH_NEGOTIATE (LDAP_AUTH_OTHERKIND | 0x0400)
     97 #define LDAP_AUTH_SSPI LDAP_AUTH_NEGOTIATE
     98 #define LDAP_AUTH_DIGEST (LDAP_AUTH_OTHERKIND | 0x4000)
     99 #define LDAP_AUTH_EXTERNAL (LDAP_AUTH_OTHERKIND | 0x0020)
    100 
    101 #define LDAP_FILTER_AND 0xa0
    102 #define LDAP_FILTER_OR 0xa1
    103 #define LDAP_FILTER_NOT 0xa2
    104 #define LDAP_FILTER_EQUALITY 0xa3
    105 #define LDAP_FILTER_SUBSTRINGS 0xa4
    106 #define LDAP_FILTER_GE 0xa5
    107 #define LDAP_FILTER_LE 0xa6
    108 #define LDAP_FILTER_PRESENT 0x87
    109 #define LDAP_FILTER_APPROX 0xa8
    110 #define LDAP_FILTER_EXTENSIBLE 0xa9
    111 
    112 #define LDAP_SUBSTRING_INITIAL __MSABI_LONG(0x80)
    113 #define LDAP_SUBSTRING_ANY __MSABI_LONG(0x81)
    114 #define LDAP_SUBSTRING_FINAL __MSABI_LONG(0x82)
    115 
    116 #define LDAP_DEREF_NEVER 0
    117 #define LDAP_DEREF_SEARCHING 1
    118 #define LDAP_DEREF_FINDING 2
    119 #define LDAP_DEREF_ALWAYS 3
    120 
    121 #define LDAP_NO_LIMIT 0
    122 
    123 #define LDAP_OPT_DNS 0x00000001
    124 #define LDAP_OPT_CHASE_REFERRALS 0x00000002
    125 #define LDAP_OPT_RETURN_REFS 0x00000004
    126 
    127 #ifndef _WIN64
    128 #pragma pack(push,4)
    129 #endif
    130 
    131   typedef struct ldap {
    132     struct {
    133       UINT_PTR sb_sd;
    134       UCHAR Reserved1[(10*sizeof(ULONG))+1];
    135       ULONG_PTR sb_naddr;
    136       UCHAR Reserved2[(6*sizeof(ULONG))];
    137     } ld_sb;
    138     PCHAR ld_host;
    139     ULONG ld_version;
    140     UCHAR ld_lberoptions;
    141     ULONG ld_deref;
    142     ULONG ld_timelimit;
    143     ULONG ld_sizelimit;
    144     ULONG ld_errno;
    145     PCHAR ld_matched;
    146     PCHAR ld_error;
    147     ULONG ld_msgid;
    148     UCHAR Reserved3[(6*sizeof(ULONG))+1];
    149     ULONG ld_cldaptries;
    150     ULONG ld_cldaptimeout;
    151     ULONG ld_refhoplimit;
    152     ULONG ld_options;
    153   } LDAP,*PLDAP;
    154 
    155   typedef struct l_timeval {
    156     LONG tv_sec;
    157     LONG tv_usec;
    158   } LDAP_TIMEVAL,*PLDAP_TIMEVAL;
    159 
    160   typedef struct berval {
    161     ULONG bv_len;
    162     PCHAR bv_val;
    163   } LDAP_BERVAL,*PLDAP_BERVAL,BERVAL,*PBERVAL,BerValue;
    164 
    165   typedef struct ldapmsg {
    166     ULONG lm_msgid;
    167     ULONG lm_msgtype;
    168     PVOID lm_ber;
    169     struct ldapmsg *lm_chain;
    170     struct ldapmsg *lm_next;
    171     ULONG lm_time;
    172 
    173     PLDAP Connection;
    174     PVOID Request;
    175     ULONG lm_returncode;
    176     USHORT lm_referral;
    177     BOOLEAN lm_chased;
    178     BOOLEAN lm_eom;
    179     BOOLEAN ConnectionReferenced;
    180   } LDAPMessage,*PLDAPMessage;
    181 
    182   typedef struct ldapcontrolA {
    183     PCHAR ldctl_oid;
    184     struct berval ldctl_value;
    185     BOOLEAN ldctl_iscritical;
    186   } LDAPControlA,*PLDAPControlA;
    187 
    188   typedef struct ldapcontrolW {
    189     PWCHAR ldctl_oid;
    190     struct berval ldctl_value;
    191     BOOLEAN ldctl_iscritical;
    192   } LDAPControlW,*PLDAPControlW;
    193 
    194 #if LDAP_UNICODE
    195 #define LDAPControl LDAPControlW
    196 #define PLDAPControl PLDAPControlW
    197 #else
    198 #define LDAPControl LDAPControlA
    199 #define PLDAPControl PLDAPControlA
    200 #endif
    201 
    202 #define LDAP_CONTROL_REFERRALS_W L"1.2.840.113556.1.4.616"
    203 #define LDAP_CONTROL_REFERRALS "1.2.840.113556.1.4.616"
    204 
    205 #define LDAP_MOD_ADD 0x00
    206 #define LDAP_MOD_DELETE 0x01
    207 #define LDAP_MOD_REPLACE 0x02
    208 #define LDAP_MOD_BVALUES 0x80
    209 
    210   typedef struct ldapmodW {
    211     ULONG mod_op;
    212     PWCHAR mod_type;
    213     union {
    214       PWCHAR *modv_strvals;
    215       struct berval **modv_bvals;
    216     } mod_vals;
    217   } LDAPModW,*PLDAPModW;
    218 
    219   typedef struct ldapmodA {
    220     ULONG mod_op;
    221     PCHAR mod_type;
    222     union {
    223       PCHAR *modv_strvals;
    224       struct berval **modv_bvals;
    225     } mod_vals;
    226   } LDAPModA,*PLDAPModA;
    227 
    228 #if LDAP_UNICODE
    229 #define LDAPMod LDAPModW
    230 #define PLDAPMod PLDAPModW
    231 #else
    232 #define LDAPMod LDAPModA
    233 #define PLDAPMod PLDAPModA
    234 #endif
    235 
    236 #ifndef _WIN64
    237 #pragma pack(pop)
    238 #endif
    239 
    240 #define LDAP_IS_CLDAP(ld) ((ld)->ld_sb.sb_naddr > 0)
    241 #define mod_values mod_vals.modv_strvals
    242 #define mod_bvalues mod_vals.modv_bvals
    243 #define NAME_ERROR(n) ((n & 0xf0)==0x20)
    244 
    245   WINLDAPAPI LDAP *LDAPAPI ldap_openW(const PWCHAR HostName,ULONG PortNumber);
    246   WINLDAPAPI LDAP *LDAPAPI ldap_openA(const PCHAR HostName,ULONG PortNumber);
    247   WINLDAPAPI LDAP *LDAPAPI ldap_initW(const PWCHAR HostName,ULONG PortNumber);
    248   WINLDAPAPI LDAP *LDAPAPI ldap_initA(const PCHAR HostName,ULONG PortNumber);
    249   WINLDAPAPI LDAP *LDAPAPI ldap_sslinitW(PWCHAR HostName,ULONG PortNumber,int secure);
    250   WINLDAPAPI LDAP *LDAPAPI ldap_sslinitA(PCHAR HostName,ULONG PortNumber,int secure);
    251   WINLDAPAPI ULONG LDAPAPI ldap_connect(LDAP *ld,struct l_timeval *timeout);
    252 
    253 #if LDAP_UNICODE
    254 #define ldap_open ldap_openW
    255 #define ldap_init ldap_initW
    256 #define ldap_sslinit ldap_sslinitW
    257 #else
    258   WINLDAPAPI LDAP *LDAPAPI ldap_open(PCHAR HostName,ULONG PortNumber);
    259   WINLDAPAPI LDAP *LDAPAPI ldap_init(PCHAR HostName,ULONG PortNumber);
    260   WINLDAPAPI LDAP *LDAPAPI ldap_sslinit(PCHAR HostName,ULONG PortNumber,int secure);
    261 #endif
    262 
    263   WINLDAPAPI LDAP *LDAPAPI cldap_openW(PWCHAR HostName,ULONG PortNumber);
    264   WINLDAPAPI LDAP *LDAPAPI cldap_openA(PCHAR HostName,ULONG PortNumber);
    265 
    266 #if LDAP_UNICODE
    267 #define cldap_open cldap_openW
    268 #else
    269   WINLDAPAPI LDAP *LDAPAPI cldap_open(PCHAR HostName,ULONG PortNumber);
    270 #endif
    271 
    272   WINLDAPAPI ULONG LDAPAPI ldap_unbind(LDAP *ld);
    273   WINLDAPAPI ULONG LDAPAPI ldap_unbind_s(LDAP *ld);
    274   WINLDAPAPI ULONG LDAPAPI ldap_get_option(LDAP *ld,int option,void *outvalue);
    275   WINLDAPAPI ULONG LDAPAPI ldap_get_optionW(LDAP *ld,int option,void *outvalue);
    276   WINLDAPAPI ULONG LDAPAPI ldap_set_option(LDAP *ld,int option,const void *invalue);
    277   WINLDAPAPI ULONG LDAPAPI ldap_set_optionW(LDAP *ld,int option,const void *invalue);
    278 
    279 #if LDAP_UNICODE
    280 #define ldap_get_option ldap_get_optionW
    281 #define ldap_set_option ldap_set_optionW
    282 #endif
    283 
    284 #define LDAP_OPT_API_INFO 0x00
    285 #define LDAP_OPT_DESC 0x01
    286 #define LDAP_OPT_DEREF 0x02
    287 #define LDAP_OPT_SIZELIMIT 0x03
    288 #define LDAP_OPT_TIMELIMIT 0x04
    289 #define LDAP_OPT_THREAD_FN_PTRS 0x05
    290 #define LDAP_OPT_REBIND_FN 0x06
    291 #define LDAP_OPT_REBIND_ARG 0x07
    292 #define LDAP_OPT_REFERRALS 0x08
    293 #define LDAP_OPT_RESTART 0x09
    294 
    295 #define LDAP_OPT_SSL 0x0a
    296 #define LDAP_OPT_IO_FN_PTRS 0x0b
    297 #define LDAP_OPT_CACHE_FN_PTRS 0x0d
    298 #define LDAP_OPT_CACHE_STRATEGY 0x0e
    299 #define LDAP_OPT_CACHE_ENABLE 0x0f
    300 #define LDAP_OPT_REFERRAL_HOP_LIMIT 0x10
    301 #define LDAP_OPT_PROTOCOL_VERSION 0x11
    302 #define LDAP_OPT_VERSION 0x11
    303 #define LDAP_OPT_API_FEATURE_INFO 0x15
    304 
    305 #define LDAP_OPT_HOST_NAME 0x30
    306 #define LDAP_OPT_ERROR_NUMBER 0x31
    307 #define LDAP_OPT_ERROR_STRING 0x32
    308 #define LDAP_OPT_SERVER_ERROR 0x33
    309 #define LDAP_OPT_SERVER_EXT_ERROR 0x34
    310 #define LDAP_OPT_HOST_REACHABLE 0x3E
    311 #define LDAP_OPT_PING_KEEP_ALIVE 0x36
    312 #define LDAP_OPT_PING_WAIT_TIME 0x37
    313 #define LDAP_OPT_PING_LIMIT 0x38
    314 #define LDAP_OPT_DNSDOMAIN_NAME 0x3B
    315 #define LDAP_OPT_GETDSNAME_FLAGS 0x3D
    316 #define LDAP_OPT_PROMPT_CREDENTIALS 0x3F
    317 #define LDAP_OPT_AUTO_RECONNECT 0x91
    318 #define LDAP_OPT_SSPI_FLAGS 0x92
    319 #define LDAP_OPT_SSL_INFO 0x93
    320 #define LDAP_OPT_TLS LDAP_OPT_SSL
    321 #define LDAP_OPT_TLS_INFO LDAP_OPT_SSL_INFO
    322 #define LDAP_OPT_SIGN 0x95
    323 #define LDAP_OPT_ENCRYPT 0x96
    324 #define LDAP_OPT_SASL_METHOD 0x97
    325 #define LDAP_OPT_AREC_EXCLUSIVE 0x98
    326 #define LDAP_OPT_SECURITY_CONTEXT 0x99
    327 #define LDAP_OPT_ROOTDSE_CACHE 0x9a
    328 #define LDAP_OPT_TCP_KEEPALIVE 0x40
    329 #define LDAP_OPT_FAST_CONCURRENT_BIND 0x41
    330 #define LDAP_OPT_SEND_TIMEOUT 0x42
    331 #define LDAP_OPT_ON ((void *) 1)
    332 #define LDAP_OPT_OFF ((void *) 0)
    333 
    334 #define LDAP_CHASE_SUBORDINATE_REFERRALS 0x00000020
    335 #define LDAP_CHASE_EXTERNAL_REFERRALS 0x00000040
    336 
    337   WINLDAPAPI ULONG LDAPAPI ldap_simple_bindW(LDAP *ld,PWCHAR dn,PWCHAR passwd);
    338   WINLDAPAPI ULONG LDAPAPI ldap_simple_bindA(LDAP *ld,PCHAR dn,PCHAR passwd);
    339   WINLDAPAPI ULONG LDAPAPI ldap_simple_bind_sW(LDAP *ld,PWCHAR dn,PWCHAR passwd);
    340   WINLDAPAPI ULONG LDAPAPI ldap_simple_bind_sA(LDAP *ld,PCHAR dn,PCHAR passwd);
    341   WINLDAPAPI ULONG LDAPAPI ldap_bindW(LDAP *ld,PWCHAR dn,PWCHAR cred,ULONG method);
    342   WINLDAPAPI ULONG LDAPAPI ldap_bindA(LDAP *ld,PCHAR dn,PCHAR cred,ULONG method);
    343   WINLDAPAPI ULONG LDAPAPI ldap_bind_sW(LDAP *ld,PWCHAR dn,PWCHAR cred,ULONG method);
    344   WINLDAPAPI ULONG LDAPAPI ldap_bind_sA(LDAP *ld,PCHAR dn,PCHAR cred,ULONG method);
    345   WINLDAPAPI INT LDAPAPI ldap_sasl_bindA(LDAP *ExternalHandle,const PCHAR DistName,const PCHAR AuthMechanism,const BERVAL *cred,PLDAPControlA *ServerCtrls,PLDAPControlA *ClientCtrls,int *MessageNumber);
    346   WINLDAPAPI INT LDAPAPI ldap_sasl_bindW(LDAP *ExternalHandle,const PWCHAR DistName,const PWCHAR AuthMechanism,const BERVAL *cred,PLDAPControlW *ServerCtrls,PLDAPControlW *ClientCtrls,int *MessageNumber);
    347   WINLDAPAPI INT LDAPAPI ldap_sasl_bind_sA(LDAP *ExternalHandle,const PCHAR DistName,const PCHAR AuthMechanism,const BERVAL *cred,PLDAPControlA *ServerCtrls,PLDAPControlA *ClientCtrls,PBERVAL *ServerData);
    348   WINLDAPAPI INT LDAPAPI ldap_sasl_bind_sW(LDAP *ExternalHandle,const PWCHAR DistName,const PWCHAR AuthMechanism,const BERVAL *cred,PLDAPControlW *ServerCtrls,PLDAPControlW *ClientCtrls,PBERVAL *ServerData);
    349 
    350 #if LDAP_UNICODE
    351 #define ldap_simple_bind ldap_simple_bindW
    352 #define ldap_simple_bind_s ldap_simple_bind_sW
    353 
    354 #define ldap_bind ldap_bindW
    355 #define ldap_bind_s ldap_bind_sW
    356 
    357 #define ldap_sasl_bind ldap_sasl_bindW
    358 #define ldap_sasl_bind_s ldap_sasl_bind_sW
    359 #else
    360 
    361   WINLDAPAPI ULONG LDAPAPI ldap_simple_bind(LDAP *ld,const PCHAR dn,const PCHAR passwd);
    362   WINLDAPAPI ULONG LDAPAPI ldap_simple_bind_s(LDAP *ld,const PCHAR dn,const PCHAR passwd);
    363   WINLDAPAPI ULONG LDAPAPI ldap_bind(LDAP *ld,const PCHAR dn,const PCHAR cred,ULONG method);
    364   WINLDAPAPI ULONG LDAPAPI ldap_bind_s(LDAP *ld,const PCHAR dn,const PCHAR cred,ULONG method);
    365 
    366 #define ldap_sasl_bind ldap_sasl_bindA
    367 #define ldap_sasl_bind_s ldap_sasl_bind_sA
    368 #endif
    369 
    370 #define LDAP_SCOPE_BASE 0x00
    371 #define LDAP_SCOPE_ONELEVEL 0x01
    372 #define LDAP_SCOPE_SUBTREE 0x02
    373 
    374   WINLDAPAPI ULONG LDAPAPI ldap_searchW(LDAP *ld,const PWCHAR base,ULONG scope,const PWCHAR filter,PWCHAR attrs[],ULONG attrsonly);
    375   WINLDAPAPI ULONG LDAPAPI ldap_searchA(LDAP *ld,const PCHAR base,ULONG scope,const PCHAR filter,PCHAR attrs[],ULONG attrsonly);
    376   WINLDAPAPI ULONG LDAPAPI ldap_search_sW(LDAP *ld,const PWCHAR base,ULONG scope,const PWCHAR filter,PWCHAR attrs[],ULONG attrsonly,LDAPMessage **res);
    377   WINLDAPAPI ULONG LDAPAPI ldap_search_sA(LDAP *ld,const PCHAR base,ULONG scope,const PCHAR filter,PCHAR attrs[],ULONG attrsonly,LDAPMessage **res);
    378   WINLDAPAPI ULONG LDAPAPI ldap_search_stW(LDAP *ld,const PWCHAR base,ULONG scope,const PWCHAR filter,PWCHAR attrs[],ULONG attrsonly,struct l_timeval *timeout,LDAPMessage **res);
    379   WINLDAPAPI ULONG LDAPAPI ldap_search_stA(LDAP *ld,const PCHAR base,ULONG scope,const PCHAR filter,PCHAR attrs[],ULONG attrsonly,struct l_timeval *timeout,LDAPMessage **res);
    380   WINLDAPAPI ULONG LDAPAPI ldap_search_extW(LDAP *ld,const PWCHAR base,ULONG scope,const PWCHAR filter,PWCHAR attrs[],ULONG attrsonly,PLDAPControlW *ServerControls,PLDAPControlW *ClientControls,ULONG TimeLimit,ULONG SizeLimit,ULONG *MessageNumber);
    381   WINLDAPAPI ULONG LDAPAPI ldap_search_extA(LDAP *ld,const PCHAR base,ULONG scope,const PCHAR filter,PCHAR attrs[],ULONG attrsonly,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG TimeLimit,ULONG SizeLimit,ULONG *MessageNumber);
    382   WINLDAPAPI ULONG LDAPAPI ldap_search_ext_sW(LDAP *ld,const PWCHAR base,ULONG scope,const PWCHAR filter,PWCHAR attrs[],ULONG attrsonly,PLDAPControlW *ServerControls,PLDAPControlW *ClientControls,struct l_timeval *timeout,ULONG SizeLimit,LDAPMessage **res);
    383   WINLDAPAPI ULONG LDAPAPI ldap_search_ext_sA(LDAP *ld,const PCHAR base,ULONG scope,const PCHAR filter,PCHAR attrs[],ULONG attrsonly,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,struct l_timeval *timeout,ULONG SizeLimit,LDAPMessage **res);
    384 
    385 #if LDAP_UNICODE
    386 #define ldap_search ldap_searchW
    387 #define ldap_search_s ldap_search_sW
    388 #define ldap_search_st ldap_search_stW
    389 
    390 #define ldap_search_ext ldap_search_extW
    391 #define ldap_search_ext_s ldap_search_ext_sW
    392 #else
    393 
    394   WINLDAPAPI ULONG LDAPAPI ldap_search(LDAP *ld,PCHAR base,ULONG scope,PCHAR filter,PCHAR attrs[],ULONG attrsonly);
    395   WINLDAPAPI ULONG LDAPAPI ldap_search_s(LDAP *ld,PCHAR base,ULONG scope,PCHAR filter,PCHAR attrs[],ULONG attrsonly,LDAPMessage **res);
    396   WINLDAPAPI ULONG LDAPAPI ldap_search_st(LDAP *ld,PCHAR base,ULONG scope,PCHAR filter,PCHAR attrs[],ULONG attrsonly,struct l_timeval *timeout,LDAPMessage **res);
    397   WINLDAPAPI ULONG LDAPAPI ldap_search_ext(LDAP *ld,PCHAR base,ULONG scope,PCHAR filter,PCHAR attrs[],ULONG attrsonly,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG TimeLimit,ULONG SizeLimit,ULONG *MessageNumber);
    398   WINLDAPAPI ULONG LDAPAPI ldap_search_ext_s(LDAP *ld,PCHAR base,ULONG scope,PCHAR filter,PCHAR attrs[],ULONG attrsonly,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,struct l_timeval *timeout,ULONG SizeLimit,LDAPMessage **res);
    399 #endif
    400 
    401   WINLDAPAPI ULONG LDAPAPI ldap_check_filterW(LDAP *ld,PWCHAR SearchFilter);
    402   WINLDAPAPI ULONG LDAPAPI ldap_check_filterA(LDAP *ld,PCHAR SearchFilter);
    403 
    404 #if LDAP_UNICODE
    405 #define ldap_check_filter ldap_check_filterW
    406 #else
    407 #define ldap_check_filter ldap_check_filterA
    408 #endif
    409 
    410   WINLDAPAPI ULONG LDAPAPI ldap_modifyW(LDAP *ld,PWCHAR dn,LDAPModW *mods[]);
    411   WINLDAPAPI ULONG LDAPAPI ldap_modifyA(LDAP *ld,PCHAR dn,LDAPModA *mods[]);
    412   WINLDAPAPI ULONG LDAPAPI ldap_modify_sW(LDAP *ld,PWCHAR dn,LDAPModW *mods[]);
    413   WINLDAPAPI ULONG LDAPAPI ldap_modify_sA(LDAP *ld,PCHAR dn,LDAPModA *mods[]);
    414   WINLDAPAPI ULONG LDAPAPI ldap_modify_extW(LDAP *ld,const PWCHAR dn,LDAPModW *mods[],PLDAPControlW *ServerControls,PLDAPControlW *ClientControls,ULONG *MessageNumber);
    415   WINLDAPAPI ULONG LDAPAPI ldap_modify_extA(LDAP *ld,const PCHAR dn,LDAPModA *mods[],PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG *MessageNumber);
    416   WINLDAPAPI ULONG LDAPAPI ldap_modify_ext_sW(LDAP *ld,const PWCHAR dn,LDAPModW *mods[],PLDAPControlW *ServerControls,PLDAPControlW *ClientControls);
    417   WINLDAPAPI ULONG LDAPAPI ldap_modify_ext_sA(LDAP *ld,const PCHAR dn,LDAPModA *mods[],PLDAPControlA *ServerControls,PLDAPControlA *ClientControls);
    418 
    419 #if LDAP_UNICODE
    420 #define ldap_modify ldap_modifyW
    421 #define ldap_modify_s ldap_modify_sW
    422 #define ldap_modify_ext ldap_modify_extW
    423 #define ldap_modify_ext_s ldap_modify_ext_sW
    424 #else
    425   WINLDAPAPI ULONG LDAPAPI ldap_modify(LDAP *ld,PCHAR dn,LDAPModA *mods[]);
    426   WINLDAPAPI ULONG LDAPAPI ldap_modify_s(LDAP *ld,PCHAR dn,LDAPModA *mods[]);
    427   WINLDAPAPI ULONG LDAPAPI ldap_modify_ext(LDAP *ld,const PCHAR dn,LDAPModA *mods[],PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG *MessageNumber);
    428   WINLDAPAPI ULONG LDAPAPI ldap_modify_ext_s(LDAP *ld,const PCHAR dn,LDAPModA *mods[],PLDAPControlA *ServerControls,PLDAPControlA *ClientControls);
    429 #endif
    430 
    431   WINLDAPAPI ULONG LDAPAPI ldap_modrdn2W (LDAP *ExternalHandle,const PWCHAR DistinguishedName,const PWCHAR NewDistinguishedName,INT DeleteOldRdn);
    432   WINLDAPAPI ULONG LDAPAPI ldap_modrdn2A (LDAP *ExternalHandle,const PCHAR DistinguishedName,const PCHAR NewDistinguishedName,INT DeleteOldRdn);
    433   WINLDAPAPI ULONG LDAPAPI ldap_modrdnW (LDAP *ExternalHandle,const PWCHAR DistinguishedName,const PWCHAR NewDistinguishedName);
    434   WINLDAPAPI ULONG LDAPAPI ldap_modrdnA (LDAP *ExternalHandle,const PCHAR DistinguishedName,const PCHAR NewDistinguishedName);
    435   WINLDAPAPI ULONG LDAPAPI ldap_modrdn2_sW (LDAP *ExternalHandle,const PWCHAR DistinguishedName,const PWCHAR NewDistinguishedName,INT DeleteOldRdn);
    436   WINLDAPAPI ULONG LDAPAPI ldap_modrdn2_sA (LDAP *ExternalHandle,const PCHAR DistinguishedName,const PCHAR NewDistinguishedName,INT DeleteOldRdn);
    437   WINLDAPAPI ULONG LDAPAPI ldap_modrdn_sW (LDAP *ExternalHandle,const PWCHAR DistinguishedName,const PWCHAR NewDistinguishedName);
    438   WINLDAPAPI ULONG LDAPAPI ldap_modrdn_sA (LDAP *ExternalHandle,const PCHAR DistinguishedName,const PCHAR NewDistinguishedName);
    439 
    440 #if LDAP_UNICODE
    441 #define ldap_modrdn2 ldap_modrdn2W
    442 #define ldap_modrdn ldap_modrdnW
    443 #define ldap_modrdn2_s ldap_modrdn2_sW
    444 #define ldap_modrdn_s ldap_modrdn_sW
    445 #else
    446   WINLDAPAPI ULONG LDAPAPI ldap_modrdn2 (LDAP *ExternalHandle,const PCHAR DistinguishedName,const PCHAR NewDistinguishedName,INT DeleteOldRdn);
    447   WINLDAPAPI ULONG LDAPAPI ldap_modrdn (LDAP *ExternalHandle,const PCHAR DistinguishedName,const PCHAR NewDistinguishedName);
    448   WINLDAPAPI ULONG LDAPAPI ldap_modrdn2_s (LDAP *ExternalHandle,const PCHAR DistinguishedName,const PCHAR NewDistinguishedName,INT DeleteOldRdn);
    449   WINLDAPAPI ULONG LDAPAPI ldap_modrdn_s (LDAP *ExternalHandle,const PCHAR DistinguishedName,const PCHAR NewDistinguishedName);
    450 #endif
    451 
    452   WINLDAPAPI ULONG LDAPAPI ldap_rename_extW(LDAP *ld,const PWCHAR dn,const PWCHAR NewRDN,const PWCHAR NewParent,INT DeleteOldRdn,PLDAPControlW *ServerControls,PLDAPControlW *ClientControls,ULONG *MessageNumber);
    453   WINLDAPAPI ULONG LDAPAPI ldap_rename_extA(LDAP *ld,const PCHAR dn,const PCHAR NewRDN,const PCHAR NewParent,INT DeleteOldRdn,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG *MessageNumber);
    454   WINLDAPAPI ULONG LDAPAPI ldap_rename_ext_sW(LDAP *ld,const PWCHAR dn,const PWCHAR NewRDN,const PWCHAR NewParent,INT DeleteOldRdn,PLDAPControlW *ServerControls,PLDAPControlW *ClientControls);
    455   WINLDAPAPI ULONG LDAPAPI ldap_rename_ext_sA(LDAP *ld,const PCHAR dn,const PCHAR NewRDN,const PCHAR NewParent,INT DeleteOldRdn,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls);
    456 
    457 #if LDAP_UNICODE
    458 #define ldap_rename ldap_rename_extW
    459 #define ldap_rename_s ldap_rename_ext_sW
    460 #else
    461 #define ldap_rename ldap_rename_extA
    462 #define ldap_rename_s ldap_rename_ext_sA
    463 #endif
    464 
    465 #if LDAP_UNICODE
    466 #define ldap_rename_ext ldap_rename_extW
    467 #define ldap_rename_ext_s ldap_rename_ext_sW
    468 #else
    469   WINLDAPAPI ULONG LDAPAPI ldap_rename_ext(LDAP *ld,const PCHAR dn,const PCHAR NewRDN,const PCHAR NewParent,INT DeleteOldRdn,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG *MessageNumber);
    470   WINLDAPAPI ULONG LDAPAPI ldap_rename_ext_s(LDAP *ld,const PCHAR dn,const PCHAR NewRDN,const PCHAR NewParent,INT DeleteOldRdn,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls);
    471 #endif
    472 
    473   WINLDAPAPI ULONG LDAPAPI ldap_addW(LDAP *ld,PWCHAR dn,LDAPModW *attrs[]);
    474   WINLDAPAPI ULONG LDAPAPI ldap_addA(LDAP *ld,PCHAR dn,LDAPModA *attrs[]);
    475   WINLDAPAPI ULONG LDAPAPI ldap_add_sW(LDAP *ld,PWCHAR dn,LDAPModW *attrs[]);
    476   WINLDAPAPI ULONG LDAPAPI ldap_add_sA(LDAP *ld,PCHAR dn,LDAPModA *attrs[]);
    477   WINLDAPAPI ULONG LDAPAPI ldap_add_extW(LDAP *ld,const PWCHAR dn,LDAPModW *attrs[],PLDAPControlW *ServerControls,PLDAPControlW *ClientControls,ULONG *MessageNumber);
    478   WINLDAPAPI ULONG LDAPAPI ldap_add_extA(LDAP *ld,const PCHAR dn,LDAPModA *attrs[],PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG *MessageNumber);
    479   WINLDAPAPI ULONG LDAPAPI ldap_add_ext_sW(LDAP *ld,const PWCHAR dn,LDAPModW *attrs[],PLDAPControlW *ServerControls,PLDAPControlW *ClientControls);
    480   WINLDAPAPI ULONG LDAPAPI ldap_add_ext_sA(LDAP *ld,const PCHAR dn,LDAPModA *attrs[],PLDAPControlA *ServerControls,PLDAPControlA *ClientControls);
    481 
    482 #if LDAP_UNICODE
    483 #define ldap_add ldap_addW
    484 #define ldap_add_s ldap_add_sW
    485 #define ldap_add_ext ldap_add_extW
    486 #define ldap_add_ext_s ldap_add_ext_sW
    487 #else
    488   WINLDAPAPI ULONG LDAPAPI ldap_add(LDAP *ld,PCHAR dn,LDAPMod *attrs[]);
    489   WINLDAPAPI ULONG LDAPAPI ldap_add_s(LDAP *ld,PCHAR dn,LDAPMod *attrs[]);
    490   WINLDAPAPI ULONG LDAPAPI ldap_add_ext(LDAP *ld,const PCHAR dn,LDAPModA *attrs[],PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG *MessageNumber);
    491   WINLDAPAPI ULONG LDAPAPI ldap_add_ext_s(LDAP *ld,const PCHAR dn,LDAPModA *attrs[],PLDAPControlA *ServerControls,PLDAPControlA *ClientControls);
    492 #endif
    493 
    494   WINLDAPAPI ULONG LDAPAPI ldap_compareW(LDAP *ld,const PWCHAR dn,const PWCHAR attr,PWCHAR value);
    495   WINLDAPAPI ULONG LDAPAPI ldap_compareA(LDAP *ld,const PCHAR dn,const PCHAR attr,PCHAR value);
    496   WINLDAPAPI ULONG LDAPAPI ldap_compare_sW(LDAP *ld,const PWCHAR dn,const PWCHAR attr,PWCHAR value);
    497   WINLDAPAPI ULONG LDAPAPI ldap_compare_sA(LDAP *ld,const PCHAR dn,const PCHAR attr,PCHAR value);
    498 
    499 #if LDAP_UNICODE
    500 #define ldap_compare ldap_compareW
    501 #define ldap_compare_s ldap_compare_sW
    502 #else
    503   WINLDAPAPI ULONG LDAPAPI ldap_compare(LDAP *ld,const PCHAR dn,const PCHAR attr,PCHAR value);
    504   WINLDAPAPI ULONG LDAPAPI ldap_compare_s(LDAP *ld,const PCHAR dn,const PCHAR attr,PCHAR value);
    505 #endif
    506 
    507   WINLDAPAPI ULONG LDAPAPI ldap_compare_extW(LDAP *ld,const PWCHAR dn,const PWCHAR Attr,const PWCHAR Value,struct berval *Data,PLDAPControlW *ServerControls,PLDAPControlW *ClientControls,ULONG *MessageNumber);
    508   WINLDAPAPI ULONG LDAPAPI ldap_compare_extA(LDAP *ld,const PCHAR dn,const PCHAR Attr,const PCHAR Value,struct berval *Data,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG *MessageNumber);
    509   WINLDAPAPI ULONG LDAPAPI ldap_compare_ext_sW(LDAP *ld,const PWCHAR dn,const PWCHAR Attr,const PWCHAR Value,struct berval *Data,PLDAPControlW *ServerControls,PLDAPControlW *ClientControls);
    510   WINLDAPAPI ULONG LDAPAPI ldap_compare_ext_sA(LDAP *ld,const PCHAR dn,const PCHAR Attr,const PCHAR Value,struct berval *Data,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls);
    511 
    512 #if LDAP_UNICODE
    513 #define ldap_compare_ext ldap_compare_extW
    514 #define ldap_compare_ext_s ldap_compare_ext_sW
    515 #else
    516 
    517   WINLDAPAPI ULONG LDAPAPI ldap_compare_ext(LDAP *ld,const PCHAR dn,const PCHAR Attr,const PCHAR Value,struct berval *Data,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG *MessageNumber);
    518   WINLDAPAPI ULONG LDAPAPI ldap_compare_ext_s(LDAP *ld,const PCHAR dn,const PCHAR Attr,const PCHAR Value,struct berval *Data,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls);
    519 #endif
    520 
    521   WINLDAPAPI ULONG LDAPAPI ldap_deleteW(LDAP *ld,const PWCHAR dn);
    522   WINLDAPAPI ULONG LDAPAPI ldap_deleteA(LDAP *ld,const PCHAR dn);
    523   WINLDAPAPI ULONG LDAPAPI ldap_delete_sW(LDAP *ld,const PWCHAR dn);
    524   WINLDAPAPI ULONG LDAPAPI ldap_delete_sA(LDAP *ld,const PCHAR dn);
    525   WINLDAPAPI ULONG LDAPAPI ldap_delete_extW(LDAP *ld,const PWCHAR dn,PLDAPControlW *ServerControls,PLDAPControlW *ClientControls,ULONG *MessageNumber);
    526   WINLDAPAPI ULONG LDAPAPI ldap_delete_extA(LDAP *ld,const PCHAR dn,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG *MessageNumber);
    527   WINLDAPAPI ULONG LDAPAPI ldap_delete_ext_sW(LDAP *ld,const PWCHAR dn,PLDAPControlW *ServerControls,PLDAPControlW *ClientControls);
    528   WINLDAPAPI ULONG LDAPAPI ldap_delete_ext_sA(LDAP *ld,const PCHAR dn,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls);
    529 
    530 #if LDAP_UNICODE
    531 #define ldap_delete ldap_deleteW
    532 #define ldap_delete_ext ldap_delete_extW
    533 #define ldap_delete_s ldap_delete_sW
    534 #define ldap_delete_ext_s ldap_delete_ext_sW
    535 #else
    536   WINLDAPAPI ULONG LDAPAPI ldap_delete(LDAP *ld,PCHAR dn);
    537   WINLDAPAPI ULONG LDAPAPI ldap_delete_s(LDAP *ld,PCHAR dn);
    538   WINLDAPAPI ULONG LDAPAPI ldap_delete_ext(LDAP *ld,const PCHAR dn,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG *MessageNumber);
    539   WINLDAPAPI ULONG LDAPAPI ldap_delete_ext_s(LDAP *ld,const PCHAR dn,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls);
    540 #endif
    541 
    542   WINLDAPAPI ULONG LDAPAPI ldap_abandon(LDAP *ld,ULONG msgid);
    543 
    544 #define LDAP_MSG_ONE 0
    545 #define LDAP_MSG_ALL 1
    546 #define LDAP_MSG_RECEIVED 2
    547 
    548   WINLDAPAPI ULONG LDAPAPI ldap_result(LDAP *ld,ULONG msgid,ULONG all,struct l_timeval *timeout,LDAPMessage **res);
    549   WINLDAPAPI ULONG LDAPAPI ldap_msgfree(LDAPMessage *res);
    550   WINLDAPAPI ULONG LDAPAPI ldap_result2error(LDAP *ld,LDAPMessage *res,ULONG freeit);
    551   WINLDAPAPI ULONG LDAPAPI ldap_parse_resultW (LDAP *Connection,LDAPMessage *ResultMessage,ULONG *ReturnCode,PWCHAR *MatchedDNs,PWCHAR *ErrorMessage,PWCHAR **Referrals,PLDAPControlW **ServerControls,BOOLEAN Freeit);
    552   WINLDAPAPI ULONG LDAPAPI ldap_parse_resultA (LDAP *Connection,LDAPMessage *ResultMessage,ULONG *ReturnCode,PCHAR *MatchedDNs,PCHAR *ErrorMessage,PCHAR **Referrals,PLDAPControlA **ServerControls,BOOLEAN Freeit);
    553   WINLDAPAPI ULONG LDAPAPI ldap_parse_extended_resultA (LDAP *Connection,LDAPMessage *ResultMessage,PCHAR *ResultOID,struct berval **ResultData,BOOLEAN Freeit);
    554   WINLDAPAPI ULONG LDAPAPI ldap_parse_extended_resultW (LDAP *Connection,LDAPMessage *ResultMessage,PWCHAR *ResultOID,struct berval **ResultData,BOOLEAN Freeit);
    555   WINLDAPAPI ULONG LDAPAPI ldap_controls_freeA (LDAPControlA **Controls);
    556   WINLDAPAPI ULONG LDAPAPI ldap_control_freeA (LDAPControlA *Controls);
    557   WINLDAPAPI ULONG LDAPAPI ldap_controls_freeW (LDAPControlW **Control);
    558   WINLDAPAPI ULONG LDAPAPI ldap_control_freeW (LDAPControlW *Control);
    559   WINLDAPAPI ULONG LDAPAPI ldap_free_controlsW (LDAPControlW **Controls);
    560   WINLDAPAPI ULONG LDAPAPI ldap_free_controlsA (LDAPControlA **Controls);
    561 
    562 #if LDAP_UNICODE
    563 #define ldap_parse_result ldap_parse_resultW
    564 #define ldap_controls_free ldap_controls_freeW
    565 #define ldap_control_free ldap_control_freeW
    566 #define ldap_free_controls ldap_free_controlsW
    567 #define ldap_parse_extended_result ldap_parse_extended_resultW
    568 #else
    569 #define ldap_parse_extended_result ldap_parse_extended_resultA
    570   WINLDAPAPI ULONG LDAPAPI ldap_parse_result (LDAP *Connection,LDAPMessage *ResultMessage,ULONG *ReturnCode,PCHAR *MatchedDNs,PCHAR *ErrorMessage,PCHAR **Referrals,PLDAPControlA **ServerControls,BOOLEAN Freeit);
    571   WINLDAPAPI ULONG LDAPAPI ldap_controls_free (LDAPControlA **Controls);
    572   WINLDAPAPI ULONG LDAPAPI ldap_control_free (LDAPControlA *Control);
    573   WINLDAPAPI ULONG LDAPAPI ldap_free_controls (LDAPControlA **Controls);
    574 #endif
    575 
    576   WINLDAPAPI PWCHAR LDAPAPI ldap_err2stringW(ULONG err);
    577   WINLDAPAPI PCHAR LDAPAPI ldap_err2stringA(ULONG err);
    578 
    579 #if LDAP_UNICODE
    580 #define ldap_err2string ldap_err2stringW
    581 #else
    582   WINLDAPAPI PCHAR LDAPAPI ldap_err2string(ULONG err);
    583 #endif
    584 
    585   WINLDAPAPI void LDAPAPI ldap_perror(LDAP *ld,const PCHAR msg);
    586   WINLDAPAPI LDAPMessage *LDAPAPI ldap_first_entry(LDAP *ld,LDAPMessage *res);
    587   WINLDAPAPI LDAPMessage *LDAPAPI ldap_next_entry(LDAP *ld,LDAPMessage *entry);
    588   WINLDAPAPI ULONG LDAPAPI ldap_count_entries(LDAP *ld,LDAPMessage *res);
    589 
    590   typedef struct berelement {
    591     PCHAR opaque;
    592   } BerElement;
    593 
    594 #define NULLBER ((BerElement *) 0)
    595 
    596   WINLDAPAPI PWCHAR LDAPAPI ldap_first_attributeW(LDAP *ld,LDAPMessage *entry,BerElement **ptr);
    597   WINLDAPAPI PCHAR LDAPAPI ldap_first_attributeA(LDAP *ld,LDAPMessage *entry,BerElement **ptr);
    598 
    599 #if LDAP_UNICODE
    600 #define ldap_first_attribute ldap_first_attributeW
    601 #else
    602   WINLDAPAPI PCHAR LDAPAPI ldap_first_attribute(LDAP *ld,LDAPMessage *entry,BerElement **ptr);
    603 #endif
    604 
    605   WINLDAPAPI PWCHAR LDAPAPI ldap_next_attributeW(LDAP *ld,LDAPMessage *entry,BerElement *ptr);
    606   WINLDAPAPI PCHAR LDAPAPI ldap_next_attributeA(LDAP *ld,LDAPMessage *entry,BerElement *ptr);
    607 
    608 #if LDAP_UNICODE
    609 #define ldap_next_attribute ldap_next_attributeW
    610 #else
    611   WINLDAPAPI PCHAR LDAPAPI ldap_next_attribute(LDAP *ld,LDAPMessage *entry,BerElement *ptr);
    612 #endif
    613 
    614   WINLDAPAPI PWCHAR *LDAPAPI ldap_get_valuesW(LDAP *ld,LDAPMessage *entry,const PWCHAR attr);
    615   WINLDAPAPI PCHAR *LDAPAPI ldap_get_valuesA(LDAP *ld,LDAPMessage *entry,const PCHAR attr);
    616 
    617 #if LDAP_UNICODE
    618 #define ldap_get_values ldap_get_valuesW
    619 #else
    620   WINLDAPAPI PCHAR *LDAPAPI ldap_get_values(LDAP *ld,LDAPMessage *entry,const PCHAR attr);
    621 #endif
    622 
    623   WINLDAPAPI struct berval **LDAPAPI ldap_get_values_lenW (LDAP *ExternalHandle,LDAPMessage *Message,const PWCHAR attr);
    624   WINLDAPAPI struct berval **LDAPAPI ldap_get_values_lenA (LDAP *ExternalHandle,LDAPMessage *Message,const PCHAR attr);
    625 
    626 #if LDAP_UNICODE
    627 #define ldap_get_values_len ldap_get_values_lenW
    628 #else
    629   WINLDAPAPI struct berval **LDAPAPI ldap_get_values_len (LDAP *ExternalHandle,LDAPMessage *Message,const PCHAR attr);
    630 #endif
    631 
    632   WINLDAPAPI ULONG LDAPAPI ldap_count_valuesW(PWCHAR *vals);
    633   WINLDAPAPI ULONG LDAPAPI ldap_count_valuesA(PCHAR *vals);
    634 
    635 #if LDAP_UNICODE
    636 #define ldap_count_values ldap_count_valuesW
    637 #else
    638   WINLDAPAPI ULONG LDAPAPI ldap_count_values(PCHAR *vals);
    639 #endif
    640 
    641   WINLDAPAPI ULONG LDAPAPI ldap_count_values_len(struct berval **vals);
    642   WINLDAPAPI ULONG LDAPAPI ldap_value_freeW(PWCHAR *vals);
    643   WINLDAPAPI ULONG LDAPAPI ldap_value_freeA(PCHAR *vals);
    644 
    645 #if LDAP_UNICODE
    646 #define ldap_value_free ldap_value_freeW
    647 #else
    648   WINLDAPAPI ULONG LDAPAPI ldap_value_free(PCHAR *vals);
    649 #endif
    650 
    651   WINLDAPAPI ULONG LDAPAPI ldap_value_free_len(struct berval **vals);
    652   WINLDAPAPI PWCHAR LDAPAPI ldap_get_dnW(LDAP *ld,LDAPMessage *entry);
    653   WINLDAPAPI PCHAR LDAPAPI ldap_get_dnA(LDAP *ld,LDAPMessage *entry);
    654 
    655 #if LDAP_UNICODE
    656 #define ldap_get_dn ldap_get_dnW
    657 #else
    658   WINLDAPAPI PCHAR LDAPAPI ldap_get_dn(LDAP *ld,LDAPMessage *entry);
    659 #endif
    660 
    661   WINLDAPAPI PWCHAR *LDAPAPI ldap_explode_dnW(const PWCHAR dn,ULONG notypes);
    662   WINLDAPAPI PCHAR *LDAPAPI ldap_explode_dnA(const PCHAR dn,ULONG notypes);
    663 
    664 #if LDAP_UNICODE
    665 #define ldap_explode_dn ldap_explode_dnW
    666 #else
    667   WINLDAPAPI PCHAR *LDAPAPI ldap_explode_dn(const PCHAR dn,ULONG notypes);
    668 #endif
    669 
    670   WINLDAPAPI PWCHAR LDAPAPI ldap_dn2ufnW(const PWCHAR dn);
    671   WINLDAPAPI PCHAR LDAPAPI ldap_dn2ufnA(const PCHAR dn);
    672 
    673 #if LDAP_UNICODE
    674 #define ldap_dn2ufn ldap_dn2ufnW
    675 #else
    676   WINLDAPAPI PCHAR LDAPAPI ldap_dn2ufn(const PCHAR dn);
    677 #endif
    678 
    679   WINLDAPAPI VOID LDAPAPI ldap_memfreeW(PWCHAR Block);
    680   WINLDAPAPI VOID LDAPAPI ldap_memfreeA(PCHAR Block);
    681   WINLDAPAPI VOID LDAPAPI ber_bvfree(struct berval *bv);
    682 
    683 #if LDAP_UNICODE
    684 #define ldap_memfree ldap_memfreeW
    685 #else
    686   WINLDAPAPI VOID LDAPAPI ldap_memfree(PCHAR Block);
    687 #endif
    688 
    689   WINLDAPAPI ULONG LDAPAPI ldap_ufn2dnW (const PWCHAR ufn,PWCHAR *pDn);
    690   WINLDAPAPI ULONG LDAPAPI ldap_ufn2dnA (const PCHAR ufn,PCHAR *pDn);
    691 
    692 #if LDAP_UNICODE
    693 #define ldap_ufn2dn ldap_ufn2dnW
    694 #else
    695   WINLDAPAPI ULONG LDAPAPI ldap_ufn2dn (const PCHAR ufn,PCHAR *pDn);
    696 #endif
    697 
    698 #define LBER_USE_DER 0x01
    699 #define LBER_USE_INDEFINITE_LEN 0x02
    700 #define LBER_TRANSLATE_STRINGS 0x04
    701 
    702 #define LAPI_MAJOR_VER1 1
    703 #define LAPI_MINOR_VER1 1
    704 
    705   typedef struct ldap_version_info {
    706     ULONG lv_size;
    707     ULONG lv_major;
    708     ULONG lv_minor;
    709   } LDAP_VERSION_INFO,*PLDAP_VERSION_INFO;
    710 
    711   WINLDAPAPI ULONG LDAPAPI ldap_startup (PLDAP_VERSION_INFO version,HANDLE *Instance);
    712 
    713 #define LDAP_API_INFO_VERSION 1
    714 #define LDAP_API_VERSION 2004
    715 #define LDAP_VERSION_MIN 2
    716 #define LDAP_VERSION_MAX 3
    717 #define LDAP_VENDOR_NAME "Microsoft Corporation."
    718 #define LDAP_VENDOR_NAME_W L"Microsoft Corporation."
    719 #define LDAP_VENDOR_VERSION 510
    720 
    721   typedef struct ldapapiinfoA {
    722     int ldapai_info_version;
    723     int ldapai_api_version;
    724     int ldapai_protocol_version;
    725     char **ldapai_extensions;
    726     char *ldapai_vendor_name;
    727     int ldapai_vendor_version;
    728   } LDAPAPIInfoA;
    729 
    730   typedef struct ldapapiinfoW {
    731     int ldapai_info_version;
    732     int ldapai_api_version;
    733     int ldapai_protocol_version;
    734     PWCHAR *ldapai_extensions;
    735     PWCHAR ldapai_vendor_name;
    736     int ldapai_vendor_version;
    737   } LDAPAPIInfoW;
    738 
    739 #define LDAP_FEATURE_INFO_VERSION 1
    740 
    741   typedef struct ldap_apifeature_infoA {
    742     int ldapaif_info_version;
    743     char *ldapaif_name;
    744     int ldapaif_version;
    745   } LDAPAPIFeatureInfoA;
    746 
    747   typedef struct ldap_apifeature_infoW {
    748     int ldapaif_info_version;
    749     PWCHAR ldapaif_name;
    750     int ldapaif_version;
    751   } LDAPAPIFeatureInfoW;
    752 
    753 #if LDAP_UNICODE
    754 #define LDAPAPIInfo LDAPAPIInfoW
    755 #define LDAPAPIFeatureInfo LDAPAPIFeatureInfoW
    756 #else
    757 #define LDAPAPIInfo LDAPAPIInfoA
    758 #define LDAPAPIFeatureInfo LDAPAPIFeatureInfoA
    759 #endif
    760 
    761   WINLDAPAPI ULONG LDAPAPI ldap_cleanup (HANDLE hInstance);
    762   WINLDAPAPI ULONG LDAPAPI ldap_escape_filter_elementW (PCHAR sourceFilterElement,ULONG sourceLength,PWCHAR destFilterElement,ULONG destLength);
    763   WINLDAPAPI ULONG LDAPAPI ldap_escape_filter_elementA (PCHAR sourceFilterElement,ULONG sourceLength,PCHAR destFilterElement,ULONG destLength);
    764 
    765 #if LDAP_UNICODE
    766 #define ldap_escape_filter_element ldap_escape_filter_elementW
    767 #else
    768   WINLDAPAPI ULONG LDAPAPI ldap_escape_filter_element (PCHAR sourceFilterElement,ULONG sourceLength,PCHAR destFilterElement,ULONG destLength);
    769 #endif
    770 
    771   WINLDAPAPI ULONG LDAPAPI ldap_set_dbg_flags(ULONG NewFlags);
    772 
    773   typedef ULONG (LDAPAPI *DBGPRINT)(PCH Format,...);
    774 
    775   WINLDAPAPI VOID LDAPAPI ldap_set_dbg_routine(DBGPRINT DebugPrintRoutine);
    776   WINLDAPAPI int LDAPAPI LdapUTF8ToUnicode(LPCSTR lpSrcStr,int cchSrc,LPWSTR lpDestStr,int cchDest);
    777   WINLDAPAPI int LDAPAPI LdapUnicodeToUTF8(LPCWSTR lpSrcStr,int cchSrc,LPSTR lpDestStr,int cchDest);
    778 
    779 #define LDAP_SERVER_SORT_OID "1.2.840.113556.1.4.473"
    780 #define LDAP_SERVER_SORT_OID_W L"1.2.840.113556.1.4.473"
    781 #define LDAP_SERVER_RESP_SORT_OID "1.2.840.113556.1.4.474"
    782 #define LDAP_SERVER_RESP_SORT_OID_W L"1.2.840.113556.1.4.474"
    783 
    784   typedef struct ldapsearch LDAPSearch,*PLDAPSearch;
    785 
    786   typedef struct ldapsortkeyW {
    787     PWCHAR sk_attrtype;
    788     PWCHAR sk_matchruleoid;
    789     BOOLEAN sk_reverseorder;
    790   } LDAPSortKeyW,*PLDAPSortKeyW;
    791 
    792   typedef struct ldapsortkeyA {
    793     PCHAR sk_attrtype;
    794     PCHAR sk_matchruleoid;
    795     BOOLEAN sk_reverseorder;
    796   } LDAPSortKeyA,*PLDAPSortKeyA;
    797 
    798 #if LDAP_UNICODE
    799 #define LDAPSortKey LDAPSortKeyW
    800 #define PLDAPSortKey PLDAPSortKeyW
    801 #else
    802 #define LDAPSortKey LDAPSortKeyA
    803 #define PLDAPSortKey PLDAPSortKeyA
    804 #endif
    805 
    806   WINLDAPAPI ULONG LDAPAPI ldap_create_sort_controlA (PLDAP ExternalHandle,PLDAPSortKeyA *SortKeys,UCHAR IsCritical,PLDAPControlA *Control);
    807   WINLDAPAPI ULONG LDAPAPI ldap_create_sort_controlW (PLDAP ExternalHandle,PLDAPSortKeyW *SortKeys,UCHAR IsCritical,PLDAPControlW *Control);
    808   WINLDAPAPI ULONG LDAPAPI ldap_parse_sort_controlA (PLDAP ExternalHandle,PLDAPControlA *Control,ULONG *Result,PCHAR *Attribute);
    809   WINLDAPAPI ULONG LDAPAPI ldap_parse_sort_controlW (PLDAP ExternalHandle,PLDAPControlW *Control,ULONG *Result,PWCHAR *Attribute);
    810 
    811 #if LDAP_UNICODE
    812 #define ldap_create_sort_control ldap_create_sort_controlW
    813 #define ldap_parse_sort_control ldap_parse_sort_controlW
    814 #else
    815   WINLDAPAPI ULONG LDAPAPI ldap_create_sort_control (PLDAP ExternalHandle,PLDAPSortKeyA *SortKeys,UCHAR IsCritical,PLDAPControlA *Control);
    816   WINLDAPAPI ULONG LDAPAPI ldap_parse_sort_control (PLDAP ExternalHandle,PLDAPControlA *Control,ULONG *Result,PCHAR *Attribute);
    817 #endif
    818 
    819   WINLDAPAPI ULONG LDAPAPI ldap_encode_sort_controlW (PLDAP ExternalHandle,PLDAPSortKeyW *SortKeys,PLDAPControlW Control,BOOLEAN Criticality);
    820   WINLDAPAPI ULONG LDAPAPI ldap_encode_sort_controlA (PLDAP ExternalHandle,PLDAPSortKeyA *SortKeys,PLDAPControlA Control,BOOLEAN Criticality);
    821 
    822 #if LDAP_UNICODE
    823 #define ldap_encode_sort_control ldap_encode_sort_controlW
    824 #else
    825   WINLDAPAPI ULONG LDAPAPI ldap_encode_sort_control (PLDAP ExternalHandle,PLDAPSortKeyA *SortKeys,PLDAPControlA Control,BOOLEAN Criticality);
    826 #endif
    827 
    828   WINLDAPAPI ULONG LDAPAPI ldap_create_page_controlW(PLDAP ExternalHandle,ULONG PageSize,struct berval *Cookie,UCHAR IsCritical,PLDAPControlW *Control);
    829   WINLDAPAPI ULONG LDAPAPI ldap_create_page_controlA(PLDAP ExternalHandle,ULONG PageSize,struct berval *Cookie,UCHAR IsCritical,PLDAPControlA *Control);
    830   WINLDAPAPI ULONG LDAPAPI ldap_parse_page_controlW (PLDAP ExternalHandle,PLDAPControlW *ServerControls,ULONG *TotalCount,struct berval **Cookie);
    831   WINLDAPAPI ULONG LDAPAPI ldap_parse_page_controlA (PLDAP ExternalHandle,PLDAPControlA *ServerControls,ULONG *TotalCount,struct berval **Cookie);
    832 
    833 #if LDAP_UNICODE
    834 #define ldap_create_page_control ldap_create_page_controlW
    835 #define ldap_parse_page_control ldap_parse_page_controlW
    836 #else
    837   WINLDAPAPI ULONG LDAPAPI ldap_create_page_control(PLDAP ExternalHandle,ULONG PageSize,struct berval *Cookie,UCHAR IsCritical,PLDAPControlA *Control);
    838   WINLDAPAPI ULONG LDAPAPI ldap_parse_page_control (PLDAP ExternalHandle,PLDAPControlA *ServerControls,ULONG *TotalCount,struct berval **Cookie);
    839 #endif
    840 
    841 #define LDAP_PAGED_RESULT_OID_STRING "1.2.840.113556.1.4.319"
    842 #define LDAP_PAGED_RESULT_OID_STRING_W L"1.2.840.113556.1.4.319"
    843 
    844   WINLDAPAPI PLDAPSearch LDAPAPI ldap_search_init_pageW(PLDAP ExternalHandle,const PWCHAR DistinguishedName,ULONG ScopeOfSearch,const PWCHAR SearchFilter,PWCHAR AttributeList[],ULONG AttributesOnly,PLDAPControlW *ServerControls,PLDAPControlW *ClientControls,ULONG PageTimeLimit,ULONG TotalSizeLimit,PLDAPSortKeyW *SortKeys);
    845   WINLDAPAPI PLDAPSearch LDAPAPI ldap_search_init_pageA(PLDAP ExternalHandle,const PCHAR DistinguishedName,ULONG ScopeOfSearch,const PCHAR SearchFilter,PCHAR AttributeList[],ULONG AttributesOnly,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG PageTimeLimit,ULONG TotalSizeLimit,PLDAPSortKeyA *SortKeys);
    846 
    847 #if LDAP_UNICODE
    848 #define ldap_search_init_page ldap_search_init_pageW
    849 #else
    850   WINLDAPAPI PLDAPSearch LDAPAPI ldap_search_init_page(PLDAP ExternalHandle,const PCHAR DistinguishedName,ULONG ScopeOfSearch,const PCHAR SearchFilter,PCHAR AttributeList[],ULONG AttributesOnly,PLDAPControl *ServerControls,PLDAPControl *ClientControls,ULONG PageTimeLimit,ULONG TotalSizeLimit,PLDAPSortKey *SortKeys);
    851 #endif
    852 
    853   WINLDAPAPI ULONG LDAPAPI ldap_get_next_page(PLDAP ExternalHandle,PLDAPSearch SearchHandle,ULONG PageSize,ULONG *MessageNumber);
    854   WINLDAPAPI ULONG LDAPAPI ldap_get_next_page_s(PLDAP ExternalHandle,PLDAPSearch SearchHandle,struct l_timeval *timeout,ULONG PageSize,ULONG *TotalCount,LDAPMessage **Results);
    855   WINLDAPAPI ULONG LDAPAPI ldap_get_paged_count(PLDAP ExternalHandle,PLDAPSearch SearchBlock,ULONG *TotalCount,PLDAPMessage Results);
    856   WINLDAPAPI ULONG LDAPAPI ldap_search_abandon_page(PLDAP ExternalHandle,PLDAPSearch SearchBlock);
    857 
    858 #define LDAP_CONTROL_VLVREQUEST "2.16.840.1.113730.3.4.9"
    859 #define LDAP_CONTROL_VLVREQUEST_W L"2.16.840.1.113730.3.4.9"
    860 #define LDAP_CONTROL_VLVRESPONSE "2.16.840.1.113730.3.4.10"
    861 #define LDAP_CONTROL_VLVRESPONSE_W L"2.16.840.1.113730.3.4.10"
    862 
    863 #define LDAP_API_FEATURE_VIRTUAL_LIST_VIEW 1001
    864 
    865 #define LDAP_VLVINFO_VERSION 1
    866 
    867   typedef struct ldapvlvinfo {
    868     int ldvlv_version;
    869     ULONG ldvlv_before_count;
    870     ULONG ldvlv_after_count;
    871     ULONG ldvlv_offset;
    872     ULONG ldvlv_count;
    873     PBERVAL ldvlv_attrvalue;
    874     PBERVAL ldvlv_context;
    875     VOID *ldvlv_extradata;
    876   } LDAPVLVInfo,*PLDAPVLVInfo;
    877 
    878   WINLDAPAPI INT LDAPAPI ldap_create_vlv_controlW (PLDAP ExternalHandle,PLDAPVLVInfo VlvInfo,UCHAR IsCritical,PLDAPControlW *Control);
    879   WINLDAPAPI INT LDAPAPI ldap_create_vlv_controlA (PLDAP ExternalHandle,PLDAPVLVInfo VlvInfo,UCHAR IsCritical,PLDAPControlA *Control);
    880   WINLDAPAPI INT LDAPAPI ldap_parse_vlv_controlW (PLDAP ExternalHandle,PLDAPControlW *Control,PULONG TargetPos,PULONG ListCount,PBERVAL *Context,PINT ErrCode);
    881   WINLDAPAPI INT LDAPAPI ldap_parse_vlv_controlA (PLDAP ExternalHandle,PLDAPControlA *Control,PULONG TargetPos,PULONG ListCount,PBERVAL *Context,PINT ErrCode);
    882 
    883 #if LDAP_UNICODE
    884 #define ldap_create_vlv_control ldap_create_vlv_controlW
    885 #define ldap_parse_vlv_control ldap_parse_vlv_controlW
    886 #else
    887 #define ldap_create_vlv_control ldap_create_vlv_controlA
    888 #define ldap_parse_vlv_control ldap_parse_vlv_controlA
    889 #endif
    890 
    891 #define LDAP_START_TLS_OID "1.3.6.1.4.1.1466.20037"
    892 #define LDAP_START_TLS_OID_W L"1.3.6.1.4.1.1466.20037"
    893 
    894   WINLDAPAPI ULONG LDAPAPI ldap_start_tls_sW(PLDAP ExternalHandle,PULONG ServerReturnValue,LDAPMessage **result,PLDAPControlW *ServerControls,PLDAPControlW *ClientControls);
    895   WINLDAPAPI ULONG LDAPAPI ldap_start_tls_sA(PLDAP ExternalHandle,PULONG ServerReturnValue,LDAPMessage **result,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls);
    896   WINLDAPAPI BOOLEAN LDAPAPI ldap_stop_tls_s(PLDAP ExternalHandle);
    897 
    898 #if LDAP_UNICODE
    899 #define ldap_start_tls_s ldap_start_tls_sW
    900 #else
    901 #define ldap_start_tls_s ldap_start_tls_sA
    902 #endif
    903 
    904 #define LDAP_TTL_EXTENDED_OP_OID "1.3.6.1.4.1.1466.101.119.1"
    905 #define LDAP_TTL_EXTENDED_OP_OID_W L"1.3.6.1.4.1.1466.101.119.1"
    906 
    907   WINLDAPAPI LDAPMessage *LDAPAPI ldap_first_reference(LDAP *ld,LDAPMessage *res);
    908   WINLDAPAPI LDAPMessage *LDAPAPI ldap_next_reference(LDAP *ld,LDAPMessage *entry);
    909   WINLDAPAPI ULONG LDAPAPI ldap_count_references(LDAP *ld,LDAPMessage *res);
    910   WINLDAPAPI ULONG LDAPAPI ldap_parse_referenceW (LDAP *Connection,LDAPMessage *ResultMessage,PWCHAR **Referrals);
    911   WINLDAPAPI ULONG LDAPAPI ldap_parse_referenceA (LDAP *Connection,LDAPMessage *ResultMessage,PCHAR **Referrals);
    912 
    913 #if LDAP_UNICODE
    914 #define ldap_parse_reference ldap_parse_referenceW
    915 #else
    916   WINLDAPAPI ULONG LDAPAPI ldap_parse_reference (LDAP *Connection,LDAPMessage *ResultMessage,PCHAR **Referrals);
    917 #endif
    918 
    919   WINLDAPAPI ULONG LDAPAPI ldap_extended_operationW(LDAP *ld,const PWCHAR Oid,struct berval *Data,PLDAPControlW *ServerControls,PLDAPControlW *ClientControls,ULONG *MessageNumber);
    920   WINLDAPAPI ULONG LDAPAPI ldap_extended_operationA(LDAP *ld,const PCHAR Oid,struct berval *Data,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG *MessageNumber);
    921   WINLDAPAPI ULONG LDAPAPI ldap_extended_operation_sA (LDAP *ExternalHandle,PCHAR Oid,struct berval *Data,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,PCHAR *ReturnedOid,struct berval **ReturnedData);
    922   WINLDAPAPI ULONG LDAPAPI ldap_extended_operation_sW (LDAP *ExternalHandle,PWCHAR Oid,struct berval *Data,PLDAPControlW *ServerControls,PLDAPControlW *ClientControls,PWCHAR *ReturnedOid,struct berval **ReturnedData);
    923 
    924 #if LDAP_UNICODE
    925 #define ldap_extended_operation ldap_extended_operationW
    926 #define ldap_extended_operation_s ldap_extended_operation_sW
    927 #else
    928   WINLDAPAPI ULONG LDAPAPI ldap_extended_operation(LDAP *ld,const PCHAR Oid,struct berval *Data,PLDAPControlA *ServerControls,PLDAPControlA *ClientControls,ULONG *MessageNumber);
    929 #define ldap_extended_operation_s ldap_extended_operation_sA
    930 #endif
    931 
    932   WINLDAPAPI ULONG LDAPAPI ldap_close_extended_op(LDAP *ld,ULONG MessageNumber);
    933 
    934 #define LDAP_OPT_REFERRAL_CALLBACK 0x70
    935 
    936   typedef ULONG (LDAPAPI QUERYFORCONNECTION)(PLDAP PrimaryConnection,PLDAP ReferralFromConnection,PWCHAR NewDN,PCHAR HostName,ULONG PortNumber,PVOID SecAuthIdentity,PVOID CurrentUserToken,PLDAP *ConnectionToUse);
    937   typedef BOOLEAN (LDAPAPI NOTIFYOFNEWCONNECTION) (PLDAP PrimaryConnection,PLDAP ReferralFromConnection,PWCHAR NewDN,PCHAR HostName,PLDAP NewConnection,ULONG PortNumber,PVOID SecAuthIdentity,PVOID CurrentUser,ULONG ErrorCodeFromBind);
    938   typedef ULONG (LDAPAPI DEREFERENCECONNECTION)(PLDAP PrimaryConnection,PLDAP ConnectionToDereference);
    939 
    940   typedef struct LdapReferralCallback {
    941     ULONG SizeOfCallbacks;
    942     QUERYFORCONNECTION *QueryForConnection;
    943     NOTIFYOFNEWCONNECTION *NotifyRoutine;
    944     DEREFERENCECONNECTION *DereferenceRoutine;
    945   } LDAP_REFERRAL_CALLBACK,*PLDAP_REFERRAL_CALLBACK;
    946 
    947   WINLDAPAPI ULONG LDAPAPI LdapGetLastError(VOID);
    948   WINLDAPAPI ULONG LDAPAPI LdapMapErrorToWin32(ULONG LdapError);
    949 
    950 #define LDAP_OPT_CLIENT_CERTIFICATE 0x80
    951 #define LDAP_OPT_SERVER_CERTIFICATE 0x81
    952 #define LDAP_OPT_REF_DEREF_CONN_PER_MSG 0x94
    953 
    954   typedef BOOLEAN (LDAPAPI QUERYCLIENTCERT) (PLDAP Connection,PSecPkgContext_IssuerListInfoEx trusted_CAs,PCCERT_CONTEXT *ppCertificate);
    955   typedef BOOLEAN (LDAPAPI VERIFYSERVERCERT) (PLDAP Connection,PCCERT_CONTEXT pServerCert);
    956 
    957   WINLDAPAPI LDAP *LDAPAPI ldap_conn_from_msg (LDAP *PrimaryConn,LDAPMessage *res);
    958 
    959 
    960 #ifdef __cplusplus
    961 }
    962 #endif
    963 #endif
    964