diff --git a/dlls/wldap32/control.c b/dlls/wldap32/control.c index e85f8bf2121..e8176be419b 100644 --- a/dlls/wldap32/control.c +++ b/dlls/wldap32/control.c @@ -89,6 +89,62 @@ ULONG ldap_controls_freeW( LDAPControlW **controls ) return ret; } +ULONG ldap_create_sort_controlA( WLDAP32_LDAP *ld, PLDAPSortKeyA *sortkey, + UCHAR critical, PLDAPControlA *control ) +{ + ULONG ret = LDAP_NOT_SUPPORTED; +#ifdef HAVE_LDAP + LDAPSortKeyW **sortkeyW = NULL; + LDAPControlW *controlW = NULL; + + TRACE( "(%p, %p, 0x%02x, %p)\n", ld, sortkey, critical, control ); + + if (!ld || !sortkey || !control) + return WLDAP32_LDAP_PARAM_ERROR; + + sortkeyW = sortkeyarrayAtoW( sortkey ); + if (!sortkeyW) return WLDAP32_LDAP_NO_MEMORY; + + ret = ldap_create_sort_controlW( ld, sortkeyW, critical, &controlW ); + + *control = controlWtoA( controlW ); + if (!*control) ret = WLDAP32_LDAP_NO_MEMORY; + + ldap_control_freeW( controlW ); + sortkeyarrayfreeW( sortkeyW ); + +#endif + return ret; +} + +ULONG ldap_create_sort_controlW( WLDAP32_LDAP *ld, PLDAPSortKeyW *sortkey, + UCHAR critical, PLDAPControlW *control ) +{ + ULONG ret = LDAP_NOT_SUPPORTED; +#ifdef HAVE_LDAP + LDAPSortKey **sortkeyU = NULL; + LDAPControl *controlU = NULL; + + TRACE( "(%p, %p, 0x%02x, %p)\n", ld, sortkey, critical, control ); + + if (!ld || !sortkey || !control) + return WLDAP32_LDAP_PARAM_ERROR; + + sortkeyU = sortkeyarrayWtoU( sortkey ); + if (!sortkeyU) return WLDAP32_LDAP_NO_MEMORY; + + ret = ldap_create_sort_control( ld, sortkeyU, critical, &controlU ); + + *control = controlUtoW( controlU ); + if (!*control) ret = WLDAP32_LDAP_NO_MEMORY; + + ldap_control_free( controlU ); + sortkeyarrayfreeU( sortkeyU ); + +#endif + return ret; +} + ULONG ldap_free_controlsA( LDAPControlA **controls ) { return ldap_controls_freeA( controls ); diff --git a/dlls/wldap32/winldap_private.h b/dlls/wldap32/winldap_private.h index e0bd1637bd5..f7db4497b3a 100644 --- a/dlls/wldap32/winldap_private.h +++ b/dlls/wldap32/winldap_private.h @@ -275,6 +275,8 @@ ULONG WLDAP32_ldap_count_references(WLDAP32_LDAP*,WLDAP32_LDAPMessage*); ULONG ldap_count_valuesA(PCHAR*); ULONG ldap_count_valuesW(PWCHAR*); ULONG WLDAP32_ldap_count_values_len(PBERVAL*); +ULONG ldap_create_sort_controlA(WLDAP32_PLDAP,PLDAPSortKeyA*,UCHAR,PLDAPControlA*); +ULONG ldap_create_sort_controlW(WLDAP32_PLDAP,PLDAPSortKeyW*,UCHAR,PLDAPControlW*); ULONG ldap_deleteA(WLDAP32_LDAP*,PCHAR); ULONG ldap_deleteW(WLDAP32_LDAP*,PWCHAR); ULONG ldap_delete_extA(WLDAP32_LDAP*,PCHAR,PLDAPControlA*,PLDAPControlA*,ULONG*); diff --git a/dlls/wldap32/wldap32.spec b/dlls/wldap32/wldap32.spec index 3e72358274d..f7fbce48e3f 100644 --- a/dlls/wldap32/wldap32.spec +++ b/dlls/wldap32/wldap32.spec @@ -70,9 +70,9 @@ @ stub ldap_create_page_control @ stub ldap_create_page_controlA @ stub ldap_create_page_controlW -@ stub ldap_create_sort_control -@ stub ldap_create_sort_controlA -@ stub ldap_create_sort_controlW +@ cdecl ldap_create_sort_control(ptr ptr long ptr) ldap_create_sort_controlA +@ cdecl ldap_create_sort_controlA(ptr ptr long ptr) +@ cdecl ldap_create_sort_controlW(ptr ptr long ptr) @ stub ldap_create_vlv_controlA @ stub ldap_create_vlv_controlW @ cdecl ldap_delete(ptr str) ldap_deleteA