wined3d: Cleanup IWineD3DBaseSwapChainImpl_GetBackBuffer() a bit.
[wine/multimedia.git] / dlls / wldap32 / wldap32.h
blobbf913d04aad148bc4727e08741d7d5acc04a2a29
1 /*
2 * WLDAP32 - LDAP support for Wine
4 * Copyright 2005 Hans Leidekker
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 ULONG map_error( int );
23 /* A set of helper functions to convert LDAP data structures
24 * to and from ansi (A), wide character (W) and utf8 (U) encodings.
27 static inline char *strdupU( const char *src )
29 char *dst;
31 if (!src) return NULL;
32 dst = HeapAlloc( GetProcessHeap(), 0, (strlen( src ) + 1) * sizeof(char) );
33 if (dst)
34 strcpy( dst, src );
35 return dst;
38 static inline LPWSTR strAtoW( LPCSTR str )
40 LPWSTR ret = NULL;
41 if (str)
43 DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
44 if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
45 MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
47 return ret;
50 static inline LPSTR strWtoA( LPCWSTR str )
52 LPSTR ret = NULL;
53 if (str)
55 DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
56 if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
57 WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
59 return ret;
62 static inline char *strWtoU( LPCWSTR str )
64 LPSTR ret = NULL;
65 if (str)
67 DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL );
68 if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
69 WideCharToMultiByte( CP_UTF8, 0, str, -1, ret, len, NULL, NULL );
71 return ret;
74 static inline LPWSTR strUtoW( char *str )
76 LPWSTR ret = NULL;
77 if (str)
79 DWORD len = MultiByteToWideChar( CP_UTF8, 0, str, -1, NULL, 0 );
80 if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
81 MultiByteToWideChar( CP_UTF8, 0, str, -1, ret, len );
83 return ret;
86 static inline void strfreeA( LPSTR str )
88 HeapFree( GetProcessHeap(), 0, str );
91 static inline void strfreeW( LPWSTR str )
93 HeapFree( GetProcessHeap(), 0, str );
96 static inline void strfreeU( char *str )
98 HeapFree( GetProcessHeap(), 0, str );
101 static inline DWORD strarraylenA( LPSTR *strarray )
103 LPSTR *p = strarray;
104 while (*p) p++;
105 return p - strarray;
108 static inline DWORD strarraylenW( LPWSTR *strarray )
110 LPWSTR *p = strarray;
111 while (*p) p++;
112 return p - strarray;
115 static inline DWORD strarraylenU( char **strarray )
117 char **p = strarray;
118 while (*p) p++;
119 return p - strarray;
122 static inline LPWSTR *strarrayAtoW( LPSTR *strarray )
124 LPWSTR *strarrayW = NULL;
125 DWORD size;
127 if (strarray)
129 size = sizeof(WCHAR*) * (strarraylenA( strarray ) + 1);
130 strarrayW = HeapAlloc( GetProcessHeap(), 0, size );
132 if (strarrayW)
134 LPSTR *p = strarray;
135 LPWSTR *q = strarrayW;
137 while (*p) *q++ = strAtoW( *p++ );
138 *q = NULL;
141 return strarrayW;
144 static inline LPSTR *strarrayWtoA( LPWSTR *strarray )
146 LPSTR *strarrayA = NULL;
147 DWORD size;
149 if (strarray)
151 size = sizeof(LPSTR) * (strarraylenW( strarray ) + 1);
152 strarrayA = HeapAlloc( GetProcessHeap(), 0, size );
154 if (strarrayA)
156 LPWSTR *p = strarray;
157 LPSTR *q = strarrayA;
159 while (*p) *q++ = strWtoA( *p++ );
160 *q = NULL;
163 return strarrayA;
166 static inline char **strarrayWtoU( LPWSTR *strarray )
168 char **strarrayU = NULL;
169 DWORD size;
171 if (strarray)
173 size = sizeof(char*) * (strarraylenW( strarray ) + 1);
174 strarrayU = HeapAlloc( GetProcessHeap(), 0, size );
176 if (strarrayU)
178 LPWSTR *p = strarray;
179 char **q = strarrayU;
181 while (*p) *q++ = strWtoU( *p++ );
182 *q = NULL;
185 return strarrayU;
188 static inline LPWSTR *strarrayUtoW( char **strarray )
190 LPWSTR *strarrayW = NULL;
191 DWORD size;
193 if (strarray)
195 size = sizeof(WCHAR*) * (strarraylenU( strarray ) + 1);
196 strarrayW = HeapAlloc( GetProcessHeap(), 0, size );
198 if (strarrayW)
200 char **p = strarray;
201 LPWSTR *q = strarrayW;
203 while (*p) *q++ = strUtoW( *p++ );
204 *q = NULL;
207 return strarrayW;
210 static inline void strarrayfreeA( LPSTR *strarray )
212 if (strarray)
214 LPSTR *p = strarray;
215 while (*p) strfreeA( *p++ );
216 HeapFree( GetProcessHeap(), 0, strarray );
220 static inline void strarrayfreeW( LPWSTR *strarray )
222 if (strarray)
224 LPWSTR *p = strarray;
225 while (*p) strfreeW( *p++ );
226 HeapFree( GetProcessHeap(), 0, strarray );
230 static inline void strarrayfreeU( char **strarray )
232 if (strarray)
234 char **p = strarray;
235 while (*p) strfreeU( *p++ );
236 HeapFree( GetProcessHeap(), 0, strarray );
240 #ifdef HAVE_LDAP
242 static inline struct berval *bvdup( struct berval *bv )
244 struct berval *berval;
245 DWORD size = sizeof(struct berval) + bv->bv_len;
247 berval = HeapAlloc( GetProcessHeap(), 0, size );
248 if (berval)
250 char *val = (char *)berval + sizeof(struct berval);
252 berval->bv_len = bv->bv_len;
253 berval->bv_val = val;
254 memcpy( val, bv->bv_val, bv->bv_len );
256 return berval;
259 static inline DWORD bvarraylen( struct berval **bv )
261 struct berval **p = bv;
262 while (*p) p++;
263 return p - bv;
266 static inline struct berval **bvarraydup( struct berval **bv )
268 struct berval **berval = NULL;
269 DWORD size;
271 if (bv)
273 size = sizeof(struct berval *) * (bvarraylen( bv ) + 1);
274 berval = HeapAlloc( GetProcessHeap(), 0, size );
276 if (berval)
278 struct berval **p = bv;
279 struct berval **q = berval;
281 while (*p) *q++ = bvdup( *p++ );
282 *q = NULL;
285 return berval;
288 static inline void bvarrayfree( struct berval **bv )
290 struct berval **p = bv;
291 while (*p) HeapFree( GetProcessHeap(), 0, *p++ );
292 HeapFree( GetProcessHeap(), 0, bv );
295 static inline LDAPModW *modAtoW( LDAPModA *mod )
297 LDAPModW *modW;
299 modW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPModW) );
300 if (modW)
302 modW->mod_op = mod->mod_op;
303 modW->mod_type = strAtoW( mod->mod_type );
305 if (mod->mod_op & LDAP_MOD_BVALUES)
306 modW->mod_vals.modv_bvals = bvarraydup( mod->mod_vals.modv_bvals );
307 else
308 modW->mod_vals.modv_strvals = strarrayAtoW( mod->mod_vals.modv_strvals );
310 return modW;
313 static inline LDAPMod *modWtoU( LDAPModW *mod )
315 LDAPMod *modU;
317 modU = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPMod) );
318 if (modU)
320 modU->mod_op = mod->mod_op;
321 modU->mod_type = strWtoU( mod->mod_type );
323 if (mod->mod_op & LDAP_MOD_BVALUES)
324 modU->mod_vals.modv_bvals = bvarraydup( mod->mod_vals.modv_bvals );
325 else
326 modU->mod_vals.modv_strvals = strarrayWtoU( mod->mod_vals.modv_strvals );
328 return modU;
331 static inline void modfreeW( LDAPModW *mod )
333 if (mod->mod_op & LDAP_MOD_BVALUES)
334 bvarrayfree( mod->mod_vals.modv_bvals );
335 else
336 strarrayfreeW( mod->mod_vals.modv_strvals );
337 HeapFree( GetProcessHeap(), 0, mod );
340 static inline void modfreeU( LDAPMod *mod )
342 if (mod->mod_op & LDAP_MOD_BVALUES)
343 bvarrayfree( mod->mod_vals.modv_bvals );
344 else
345 strarrayfreeU( mod->mod_vals.modv_strvals );
346 HeapFree( GetProcessHeap(), 0, mod );
349 static inline DWORD modarraylenA( LDAPModA **modarray )
351 LDAPModA **p = modarray;
352 while (*p) p++;
353 return p - modarray;
356 static inline DWORD modarraylenW( LDAPModW **modarray )
358 LDAPModW **p = modarray;
359 while (*p) p++;
360 return p - modarray;
363 static inline LDAPModW **modarrayAtoW( LDAPModA **modarray )
365 LDAPModW **modarrayW = NULL;
366 DWORD size;
368 if (modarray)
370 size = sizeof(LDAPModW*) * (modarraylenA( modarray ) + 1);
371 modarrayW = HeapAlloc( GetProcessHeap(), 0, size );
373 if (modarrayW)
375 LDAPModA **p = modarray;
376 LDAPModW **q = modarrayW;
378 while (*p) *q++ = modAtoW( *p++ );
379 *q = NULL;
382 return modarrayW;
385 static inline LDAPMod **modarrayWtoU( LDAPModW **modarray )
387 LDAPMod **modarrayU = NULL;
388 DWORD size;
390 if (modarray)
392 size = sizeof(LDAPMod*) * (modarraylenW( modarray ) + 1);
393 modarrayU = HeapAlloc( GetProcessHeap(), 0, size );
395 if (modarrayU)
397 LDAPModW **p = modarray;
398 LDAPMod **q = modarrayU;
400 while (*p) *q++ = modWtoU( *p++ );
401 *q = NULL;
404 return modarrayU;
407 static inline void modarrayfreeW( LDAPModW **modarray )
409 if (modarray)
411 LDAPModW **p = modarray;
412 while (*p) modfreeW( *p++ );
413 HeapFree( GetProcessHeap(), 0, modarray );
417 static inline void modarrayfreeU( LDAPMod **modarray )
419 if (modarray)
421 LDAPMod **p = modarray;
422 while (*p) modfreeU( *p++ );
423 HeapFree( GetProcessHeap(), 0, modarray );
427 static inline LDAPControlW *controlAtoW( LDAPControlA *control )
429 LDAPControlW *controlW;
430 DWORD len = control->ldctl_value.bv_len;
431 char *val = NULL;
433 if (control->ldctl_value.bv_val)
435 val = HeapAlloc( GetProcessHeap(), 0, len );
436 if (!val) return NULL;
437 memcpy( val, control->ldctl_value.bv_val, len );
440 controlW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlW) );
441 if (!controlW)
443 HeapFree( GetProcessHeap(), 0, val );
444 return NULL;
447 controlW->ldctl_oid = strAtoW( control->ldctl_oid );
448 controlW->ldctl_value.bv_len = len;
449 controlW->ldctl_value.bv_val = val;
450 controlW->ldctl_iscritical = control->ldctl_iscritical;
452 return controlW;
455 static inline LDAPControlA *controlWtoA( LDAPControlW *control )
457 LDAPControlA *controlA;
458 DWORD len = control->ldctl_value.bv_len;
459 char *val = NULL;
461 if (control->ldctl_value.bv_val)
463 val = HeapAlloc( GetProcessHeap(), 0, len );
464 if (!val) return NULL;
465 memcpy( val, control->ldctl_value.bv_val, len );
468 controlA = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlA) );
469 if (!controlA)
471 HeapFree( GetProcessHeap(), 0, val );
472 return NULL;
475 controlA->ldctl_oid = strWtoA( control->ldctl_oid );
476 controlA->ldctl_value.bv_len = len;
477 controlA->ldctl_value.bv_val = val;
478 controlA->ldctl_iscritical = control->ldctl_iscritical;
480 return controlA;
483 static inline LDAPControl *controlWtoU( LDAPControlW *control )
485 LDAPControl *controlU;
486 DWORD len = control->ldctl_value.bv_len;
487 char *val = NULL;
489 if (control->ldctl_value.bv_val)
491 val = HeapAlloc( GetProcessHeap(), 0, len );
492 if (!val) return NULL;
493 memcpy( val, control->ldctl_value.bv_val, len );
496 controlU = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControl) );
497 if (!controlU)
499 HeapFree( GetProcessHeap(), 0, val );
500 return NULL;
503 controlU->ldctl_oid = strWtoU( control->ldctl_oid );
504 controlU->ldctl_value.bv_len = len;
505 controlU->ldctl_value.bv_val = val;
506 controlU->ldctl_iscritical = control->ldctl_iscritical;
508 return controlU;
511 static inline LDAPControlW *controlUtoW( LDAPControl *control )
513 LDAPControlW *controlW;
514 DWORD len = control->ldctl_value.bv_len;
515 char *val = NULL;
517 if (control->ldctl_value.bv_val)
519 val = HeapAlloc( GetProcessHeap(), 0, len );
520 if (!val) return NULL;
521 memcpy( val, control->ldctl_value.bv_val, len );
524 controlW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlW) );
525 if (!controlW)
527 HeapFree( GetProcessHeap(), 0, val );
528 return NULL;
531 controlW->ldctl_oid = strUtoW( control->ldctl_oid );
532 controlW->ldctl_value.bv_len = len;
533 controlW->ldctl_value.bv_val = val;
534 controlW->ldctl_iscritical = control->ldctl_iscritical;
536 return controlW;
539 static inline void controlfreeA( LDAPControlA *control )
541 if (control)
543 strfreeA( control->ldctl_oid );
544 HeapFree( GetProcessHeap(), 0, control->ldctl_value.bv_val );
545 HeapFree( GetProcessHeap(), 0, control );
549 static inline void controlfreeW( LDAPControlW *control )
551 if (control)
553 strfreeW( control->ldctl_oid );
554 HeapFree( GetProcessHeap(), 0, control->ldctl_value.bv_val );
555 HeapFree( GetProcessHeap(), 0, control );
559 static inline void controlfreeU( LDAPControl *control )
561 if (control)
563 strfreeU( control->ldctl_oid );
564 HeapFree( GetProcessHeap(), 0, control->ldctl_value.bv_val );
565 HeapFree( GetProcessHeap(), 0, control );
569 static inline DWORD controlarraylenA( LDAPControlA **controlarray )
571 LDAPControlA **p = controlarray;
572 while (*p) p++;
573 return p - controlarray;
576 static inline DWORD controlarraylenW( LDAPControlW **controlarray )
578 LDAPControlW **p = controlarray;
579 while (*p) p++;
580 return p - controlarray;
583 static inline DWORD controlarraylenU( LDAPControl **controlarray )
585 LDAPControl **p = controlarray;
586 while (*p) p++;
587 return p - controlarray;
590 static inline LDAPControlW **controlarrayAtoW( LDAPControlA **controlarray )
592 LDAPControlW **controlarrayW = NULL;
593 DWORD size;
595 if (controlarray)
597 size = sizeof(LDAPControlW*) * (controlarraylenA( controlarray ) + 1);
598 controlarrayW = HeapAlloc( GetProcessHeap(), 0, size );
600 if (controlarrayW)
602 LDAPControlA **p = controlarray;
603 LDAPControlW **q = controlarrayW;
605 while (*p) *q++ = controlAtoW( *p++ );
606 *q = NULL;
609 return controlarrayW;
612 static inline LDAPControlA **controlarrayWtoA( LDAPControlW **controlarray )
614 LDAPControlA **controlarrayA = NULL;
615 DWORD size;
617 if (controlarray)
619 size = sizeof(LDAPControl*) * (controlarraylenW( controlarray ) + 1);
620 controlarrayA = HeapAlloc( GetProcessHeap(), 0, size );
622 if (controlarrayA)
624 LDAPControlW **p = controlarray;
625 LDAPControlA **q = controlarrayA;
627 while (*p) *q++ = controlWtoA( *p++ );
628 *q = NULL;
631 return controlarrayA;
634 static inline LDAPControl **controlarrayWtoU( LDAPControlW **controlarray )
636 LDAPControl **controlarrayU = NULL;
637 DWORD size;
639 if (controlarray)
641 size = sizeof(LDAPControl*) * (controlarraylenW( controlarray ) + 1);
642 controlarrayU = HeapAlloc( GetProcessHeap(), 0, size );
644 if (controlarrayU)
646 LDAPControlW **p = controlarray;
647 LDAPControl **q = controlarrayU;
649 while (*p) *q++ = controlWtoU( *p++ );
650 *q = NULL;
653 return controlarrayU;
656 static inline LDAPControlW **controlarrayUtoW( LDAPControl **controlarray )
658 LDAPControlW **controlarrayW = NULL;
659 DWORD size;
661 if (controlarray)
663 size = sizeof(LDAPControlW*) * (controlarraylenU( controlarray ) + 1);
664 controlarrayW = HeapAlloc( GetProcessHeap(), 0, size );
666 if (controlarrayW)
668 LDAPControl **p = controlarray;
669 LDAPControlW **q = controlarrayW;
671 while (*p) *q++ = controlUtoW( *p++ );
672 *q = NULL;
675 return controlarrayW;
678 static inline void controlarrayfreeA( LDAPControlA **controlarray )
680 if (controlarray)
682 LDAPControlA **p = controlarray;
683 while (*p) controlfreeA( *p++ );
684 HeapFree( GetProcessHeap(), 0, controlarray );
688 static inline void controlarrayfreeW( LDAPControlW **controlarray )
690 if (controlarray)
692 LDAPControlW **p = controlarray;
693 while (*p) controlfreeW( *p++ );
694 HeapFree( GetProcessHeap(), 0, controlarray );
698 static inline void controlarrayfreeU( LDAPControl **controlarray )
700 if (controlarray)
702 LDAPControl **p = controlarray;
703 while (*p) controlfreeU( *p++ );
704 HeapFree( GetProcessHeap(), 0, controlarray );
708 static inline LDAPSortKeyW *sortkeyAtoW( LDAPSortKeyA *sortkey )
710 LDAPSortKeyW *sortkeyW;
712 sortkeyW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPSortKeyW) );
713 if (sortkeyW)
715 sortkeyW->sk_attrtype = strAtoW( sortkey->sk_attrtype );
716 sortkeyW->sk_matchruleoid = strAtoW( sortkey->sk_matchruleoid );
717 sortkeyW->sk_reverseorder = sortkey->sk_reverseorder;
719 return sortkeyW;
722 static inline LDAPSortKeyA *sortkeyWtoA( LDAPSortKeyW *sortkey )
724 LDAPSortKeyA *sortkeyA;
726 sortkeyA = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPSortKeyA) );
727 if (sortkeyA)
729 sortkeyA->sk_attrtype = strWtoA( sortkey->sk_attrtype );
730 sortkeyA->sk_matchruleoid = strWtoA( sortkey->sk_matchruleoid );
731 sortkeyA->sk_reverseorder = sortkey->sk_reverseorder;
733 return sortkeyA;
736 static inline LDAPSortKey *sortkeyWtoU( LDAPSortKeyW *sortkey )
738 LDAPSortKey *sortkeyU;
740 sortkeyU = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPSortKey) );
741 if (sortkeyU)
743 sortkeyU->attributeType = strWtoU( sortkey->sk_attrtype );
744 sortkeyU->orderingRule = strWtoU( sortkey->sk_matchruleoid );
745 sortkeyU->reverseOrder = sortkey->sk_reverseorder;
747 return sortkeyU;
750 static inline void sortkeyfreeA( LDAPSortKeyA *sortkey )
752 if (sortkey)
754 strfreeA( sortkey->sk_attrtype );
755 strfreeA( sortkey->sk_matchruleoid );
756 HeapFree( GetProcessHeap(), 0, sortkey );
760 static inline void sortkeyfreeW( LDAPSortKeyW *sortkey )
762 if (sortkey)
764 strfreeW( sortkey->sk_attrtype );
765 strfreeW( sortkey->sk_matchruleoid );
766 HeapFree( GetProcessHeap(), 0, sortkey );
770 static inline void sortkeyfreeU( LDAPSortKey *sortkey )
772 if (sortkey)
774 strfreeU( sortkey->attributeType );
775 strfreeU( sortkey->orderingRule );
776 HeapFree( GetProcessHeap(), 0, sortkey );
780 static inline DWORD sortkeyarraylenA( LDAPSortKeyA **sortkeyarray )
782 LDAPSortKeyA **p = sortkeyarray;
783 while (*p) p++;
784 return p - sortkeyarray;
787 static inline DWORD sortkeyarraylenW( LDAPSortKeyW **sortkeyarray )
789 LDAPSortKeyW **p = sortkeyarray;
790 while (*p) p++;
791 return p - sortkeyarray;
794 static inline LDAPSortKeyW **sortkeyarrayAtoW( LDAPSortKeyA **sortkeyarray )
796 LDAPSortKeyW **sortkeyarrayW = NULL;
797 DWORD size;
799 if (sortkeyarray)
801 size = sizeof(LDAPSortKeyW*) * (sortkeyarraylenA( sortkeyarray ) + 1);
802 sortkeyarrayW = HeapAlloc( GetProcessHeap(), 0, size );
804 if (sortkeyarrayW)
806 LDAPSortKeyA **p = sortkeyarray;
807 LDAPSortKeyW **q = sortkeyarrayW;
809 while (*p) *q++ = sortkeyAtoW( *p++ );
810 *q = NULL;
813 return sortkeyarrayW;
816 static inline LDAPSortKey **sortkeyarrayWtoU( LDAPSortKeyW **sortkeyarray )
818 LDAPSortKey **sortkeyarrayU = NULL;
819 DWORD size;
821 if (sortkeyarray)
823 size = sizeof(LDAPSortKey*) * (sortkeyarraylenW( sortkeyarray ) + 1);
824 sortkeyarrayU = HeapAlloc( GetProcessHeap(), 0, size );
826 if (sortkeyarrayU)
828 LDAPSortKeyW **p = sortkeyarray;
829 LDAPSortKey **q = sortkeyarrayU;
831 while (*p) *q++ = sortkeyWtoU( *p++ );
832 *q = NULL;
835 return sortkeyarrayU;
838 static inline void sortkeyarrayfreeW( LDAPSortKeyW **sortkeyarray )
840 if (sortkeyarray)
842 LDAPSortKeyW **p = sortkeyarray;
843 while (*p) sortkeyfreeW( *p++ );
844 HeapFree( GetProcessHeap(), 0, sortkeyarray );
848 static inline void sortkeyarrayfreeU( LDAPSortKey **sortkeyarray )
850 if (sortkeyarray)
852 LDAPSortKey **p = sortkeyarray;
853 while (*p) sortkeyfreeU( *p++ );
854 HeapFree( GetProcessHeap(), 0, sortkeyarray );
858 #endif /* HAVE_LDAP */