hidclass.sys: Implement IRP_MN_QUERY_ID for HID devices.
[wine.git] / dlls / wldap32 / wldap32.h
blob55852a66170328c7df7c459fe71be62ee5a5eac7
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 #include "wine/unicode.h"
23 extern HINSTANCE hwldap32 DECLSPEC_HIDDEN;
25 ULONG map_error( int ) DECLSPEC_HIDDEN;
27 /* A set of helper functions to convert LDAP data structures
28 * to and from ansi (A), wide character (W) and utf8 (U) encodings.
31 static inline char *strdupU( const char *src )
33 char *dst;
35 if (!src) return NULL;
36 dst = HeapAlloc( GetProcessHeap(), 0, (strlen( src ) + 1) * sizeof(char) );
37 if (dst)
38 strcpy( dst, src );
39 return dst;
42 static inline WCHAR *strdupW( const WCHAR *src )
44 WCHAR *dst;
46 if (!src) return NULL;
47 dst = HeapAlloc( GetProcessHeap(), 0, (strlenW( src ) + 1) * sizeof(WCHAR) );
48 if (dst)
49 strcpyW( dst, src );
50 return dst;
53 static inline LPWSTR strAtoW( LPCSTR str )
55 LPWSTR ret = NULL;
56 if (str)
58 DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
59 if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
60 MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
62 return ret;
65 static inline LPSTR strWtoA( LPCWSTR str )
67 LPSTR ret = NULL;
68 if (str)
70 DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
71 if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
72 WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
74 return ret;
77 static inline char *strWtoU( LPCWSTR str )
79 LPSTR ret = NULL;
80 if (str)
82 DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL );
83 if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
84 WideCharToMultiByte( CP_UTF8, 0, str, -1, ret, len, NULL, NULL );
86 return ret;
89 static inline LPWSTR strUtoW( char *str )
91 LPWSTR ret = NULL;
92 if (str)
94 DWORD len = MultiByteToWideChar( CP_UTF8, 0, str, -1, NULL, 0 );
95 if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
96 MultiByteToWideChar( CP_UTF8, 0, str, -1, ret, len );
98 return ret;
101 static inline void strfreeA( LPSTR str )
103 HeapFree( GetProcessHeap(), 0, str );
106 static inline void strfreeW( LPWSTR str )
108 HeapFree( GetProcessHeap(), 0, str );
111 static inline void strfreeU( char *str )
113 HeapFree( GetProcessHeap(), 0, str );
116 static inline DWORD strarraylenA( LPSTR *strarray )
118 LPSTR *p = strarray;
119 while (*p) p++;
120 return p - strarray;
123 static inline DWORD strarraylenW( LPWSTR *strarray )
125 LPWSTR *p = strarray;
126 while (*p) p++;
127 return p - strarray;
130 static inline DWORD strarraylenU( char **strarray )
132 char **p = strarray;
133 while (*p) p++;
134 return p - strarray;
137 static inline LPWSTR *strarrayAtoW( LPSTR *strarray )
139 LPWSTR *strarrayW = NULL;
140 DWORD size;
142 if (strarray)
144 size = sizeof(WCHAR*) * (strarraylenA( strarray ) + 1);
145 strarrayW = HeapAlloc( GetProcessHeap(), 0, size );
147 if (strarrayW)
149 LPSTR *p = strarray;
150 LPWSTR *q = strarrayW;
152 while (*p) *q++ = strAtoW( *p++ );
153 *q = NULL;
156 return strarrayW;
159 static inline LPSTR *strarrayWtoA( LPWSTR *strarray )
161 LPSTR *strarrayA = NULL;
162 DWORD size;
164 if (strarray)
166 size = sizeof(LPSTR) * (strarraylenW( strarray ) + 1);
167 strarrayA = HeapAlloc( GetProcessHeap(), 0, size );
169 if (strarrayA)
171 LPWSTR *p = strarray;
172 LPSTR *q = strarrayA;
174 while (*p) *q++ = strWtoA( *p++ );
175 *q = NULL;
178 return strarrayA;
181 static inline char **strarrayWtoU( LPWSTR *strarray )
183 char **strarrayU = NULL;
184 DWORD size;
186 if (strarray)
188 size = sizeof(char*) * (strarraylenW( strarray ) + 1);
189 strarrayU = HeapAlloc( GetProcessHeap(), 0, size );
191 if (strarrayU)
193 LPWSTR *p = strarray;
194 char **q = strarrayU;
196 while (*p) *q++ = strWtoU( *p++ );
197 *q = NULL;
200 return strarrayU;
203 static inline LPWSTR *strarrayUtoW( char **strarray )
205 LPWSTR *strarrayW = NULL;
206 DWORD size;
208 if (strarray)
210 size = sizeof(WCHAR*) * (strarraylenU( strarray ) + 1);
211 strarrayW = HeapAlloc( GetProcessHeap(), 0, size );
213 if (strarrayW)
215 char **p = strarray;
216 LPWSTR *q = strarrayW;
218 while (*p) *q++ = strUtoW( *p++ );
219 *q = NULL;
222 return strarrayW;
225 static inline void strarrayfreeA( LPSTR *strarray )
227 if (strarray)
229 LPSTR *p = strarray;
230 while (*p) strfreeA( *p++ );
231 HeapFree( GetProcessHeap(), 0, strarray );
235 static inline void strarrayfreeW( LPWSTR *strarray )
237 if (strarray)
239 LPWSTR *p = strarray;
240 while (*p) strfreeW( *p++ );
241 HeapFree( GetProcessHeap(), 0, strarray );
245 static inline void strarrayfreeU( char **strarray )
247 if (strarray)
249 char **p = strarray;
250 while (*p) strfreeU( *p++ );
251 HeapFree( GetProcessHeap(), 0, strarray );
255 #ifdef HAVE_LDAP
257 static inline struct berval *bvdup( struct berval *bv )
259 struct berval *berval;
260 DWORD size = sizeof(struct berval) + bv->bv_len;
262 berval = HeapAlloc( GetProcessHeap(), 0, size );
263 if (berval)
265 char *val = (char *)berval + sizeof(struct berval);
267 berval->bv_len = bv->bv_len;
268 berval->bv_val = val;
269 memcpy( val, bv->bv_val, bv->bv_len );
271 return berval;
274 static inline DWORD bvarraylen( struct berval **bv )
276 struct berval **p = bv;
277 while (*p) p++;
278 return p - bv;
281 static inline struct berval **bvarraydup( struct berval **bv )
283 struct berval **berval = NULL;
284 DWORD size;
286 if (bv)
288 size = sizeof(struct berval *) * (bvarraylen( bv ) + 1);
289 berval = HeapAlloc( GetProcessHeap(), 0, size );
291 if (berval)
293 struct berval **p = bv;
294 struct berval **q = berval;
296 while (*p) *q++ = bvdup( *p++ );
297 *q = NULL;
300 return berval;
303 static inline void bvarrayfree( struct berval **bv )
305 struct berval **p = bv;
306 while (*p) HeapFree( GetProcessHeap(), 0, *p++ );
307 HeapFree( GetProcessHeap(), 0, bv );
310 static inline LDAPModW *modAtoW( LDAPModA *mod )
312 LDAPModW *modW;
314 modW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPModW) );
315 if (modW)
317 modW->mod_op = mod->mod_op;
318 modW->mod_type = strAtoW( mod->mod_type );
320 if (mod->mod_op & LDAP_MOD_BVALUES)
321 modW->mod_vals.modv_bvals = bvarraydup( mod->mod_vals.modv_bvals );
322 else
323 modW->mod_vals.modv_strvals = strarrayAtoW( mod->mod_vals.modv_strvals );
325 return modW;
328 static inline LDAPMod *modWtoU( LDAPModW *mod )
330 LDAPMod *modU;
332 modU = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPMod) );
333 if (modU)
335 modU->mod_op = mod->mod_op;
336 modU->mod_type = strWtoU( mod->mod_type );
338 if (mod->mod_op & LDAP_MOD_BVALUES)
339 modU->mod_vals.modv_bvals = bvarraydup( mod->mod_vals.modv_bvals );
340 else
341 modU->mod_vals.modv_strvals = strarrayWtoU( mod->mod_vals.modv_strvals );
343 return modU;
346 static inline void modfreeW( LDAPModW *mod )
348 if (mod->mod_op & LDAP_MOD_BVALUES)
349 bvarrayfree( mod->mod_vals.modv_bvals );
350 else
351 strarrayfreeW( mod->mod_vals.modv_strvals );
352 HeapFree( GetProcessHeap(), 0, mod );
355 static inline void modfreeU( LDAPMod *mod )
357 if (mod->mod_op & LDAP_MOD_BVALUES)
358 bvarrayfree( mod->mod_vals.modv_bvals );
359 else
360 strarrayfreeU( mod->mod_vals.modv_strvals );
361 HeapFree( GetProcessHeap(), 0, mod );
364 static inline DWORD modarraylenA( LDAPModA **modarray )
366 LDAPModA **p = modarray;
367 while (*p) p++;
368 return p - modarray;
371 static inline DWORD modarraylenW( LDAPModW **modarray )
373 LDAPModW **p = modarray;
374 while (*p) p++;
375 return p - modarray;
378 static inline LDAPModW **modarrayAtoW( LDAPModA **modarray )
380 LDAPModW **modarrayW = NULL;
381 DWORD size;
383 if (modarray)
385 size = sizeof(LDAPModW*) * (modarraylenA( modarray ) + 1);
386 modarrayW = HeapAlloc( GetProcessHeap(), 0, size );
388 if (modarrayW)
390 LDAPModA **p = modarray;
391 LDAPModW **q = modarrayW;
393 while (*p) *q++ = modAtoW( *p++ );
394 *q = NULL;
397 return modarrayW;
400 static inline LDAPMod **modarrayWtoU( LDAPModW **modarray )
402 LDAPMod **modarrayU = NULL;
403 DWORD size;
405 if (modarray)
407 size = sizeof(LDAPMod*) * (modarraylenW( modarray ) + 1);
408 modarrayU = HeapAlloc( GetProcessHeap(), 0, size );
410 if (modarrayU)
412 LDAPModW **p = modarray;
413 LDAPMod **q = modarrayU;
415 while (*p) *q++ = modWtoU( *p++ );
416 *q = NULL;
419 return modarrayU;
422 static inline void modarrayfreeW( LDAPModW **modarray )
424 if (modarray)
426 LDAPModW **p = modarray;
427 while (*p) modfreeW( *p++ );
428 HeapFree( GetProcessHeap(), 0, modarray );
432 static inline void modarrayfreeU( LDAPMod **modarray )
434 if (modarray)
436 LDAPMod **p = modarray;
437 while (*p) modfreeU( *p++ );
438 HeapFree( GetProcessHeap(), 0, modarray );
442 static inline LDAPControlW *controlAtoW( LDAPControlA *control )
444 LDAPControlW *controlW;
445 DWORD len = control->ldctl_value.bv_len;
446 char *val = NULL;
448 if (control->ldctl_value.bv_val)
450 val = HeapAlloc( GetProcessHeap(), 0, len );
451 if (!val) return NULL;
452 memcpy( val, control->ldctl_value.bv_val, len );
455 controlW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlW) );
456 if (!controlW)
458 HeapFree( GetProcessHeap(), 0, val );
459 return NULL;
462 controlW->ldctl_oid = strAtoW( control->ldctl_oid );
463 controlW->ldctl_value.bv_len = len;
464 controlW->ldctl_value.bv_val = val;
465 controlW->ldctl_iscritical = control->ldctl_iscritical;
467 return controlW;
470 static inline LDAPControlA *controlWtoA( LDAPControlW *control )
472 LDAPControlA *controlA;
473 DWORD len = control->ldctl_value.bv_len;
474 char *val = NULL;
476 if (control->ldctl_value.bv_val)
478 val = HeapAlloc( GetProcessHeap(), 0, len );
479 if (!val) return NULL;
480 memcpy( val, control->ldctl_value.bv_val, len );
483 controlA = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlA) );
484 if (!controlA)
486 HeapFree( GetProcessHeap(), 0, val );
487 return NULL;
490 controlA->ldctl_oid = strWtoA( control->ldctl_oid );
491 controlA->ldctl_value.bv_len = len;
492 controlA->ldctl_value.bv_val = val;
493 controlA->ldctl_iscritical = control->ldctl_iscritical;
495 return controlA;
498 static inline LDAPControl *controlWtoU( LDAPControlW *control )
500 LDAPControl *controlU;
501 DWORD len = control->ldctl_value.bv_len;
502 char *val = NULL;
504 if (control->ldctl_value.bv_val)
506 val = HeapAlloc( GetProcessHeap(), 0, len );
507 if (!val) return NULL;
508 memcpy( val, control->ldctl_value.bv_val, len );
511 controlU = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControl) );
512 if (!controlU)
514 HeapFree( GetProcessHeap(), 0, val );
515 return NULL;
518 controlU->ldctl_oid = strWtoU( control->ldctl_oid );
519 controlU->ldctl_value.bv_len = len;
520 controlU->ldctl_value.bv_val = val;
521 controlU->ldctl_iscritical = control->ldctl_iscritical;
523 return controlU;
526 static inline LDAPControlW *controlUtoW( LDAPControl *control )
528 LDAPControlW *controlW;
529 DWORD len = control->ldctl_value.bv_len;
530 char *val = NULL;
532 if (control->ldctl_value.bv_val)
534 val = HeapAlloc( GetProcessHeap(), 0, len );
535 if (!val) return NULL;
536 memcpy( val, control->ldctl_value.bv_val, len );
539 controlW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlW) );
540 if (!controlW)
542 HeapFree( GetProcessHeap(), 0, val );
543 return NULL;
546 controlW->ldctl_oid = strUtoW( control->ldctl_oid );
547 controlW->ldctl_value.bv_len = len;
548 controlW->ldctl_value.bv_val = val;
549 controlW->ldctl_iscritical = control->ldctl_iscritical;
551 return controlW;
554 static inline void controlfreeA( LDAPControlA *control )
556 if (control)
558 strfreeA( control->ldctl_oid );
559 HeapFree( GetProcessHeap(), 0, control->ldctl_value.bv_val );
560 HeapFree( GetProcessHeap(), 0, control );
564 static inline void controlfreeW( LDAPControlW *control )
566 if (control)
568 strfreeW( control->ldctl_oid );
569 HeapFree( GetProcessHeap(), 0, control->ldctl_value.bv_val );
570 HeapFree( GetProcessHeap(), 0, control );
574 static inline void controlfreeU( LDAPControl *control )
576 if (control)
578 strfreeU( control->ldctl_oid );
579 HeapFree( GetProcessHeap(), 0, control->ldctl_value.bv_val );
580 HeapFree( GetProcessHeap(), 0, control );
584 static inline DWORD controlarraylenA( LDAPControlA **controlarray )
586 LDAPControlA **p = controlarray;
587 while (*p) p++;
588 return p - controlarray;
591 static inline DWORD controlarraylenW( LDAPControlW **controlarray )
593 LDAPControlW **p = controlarray;
594 while (*p) p++;
595 return p - controlarray;
598 static inline DWORD controlarraylenU( LDAPControl **controlarray )
600 LDAPControl **p = controlarray;
601 while (*p) p++;
602 return p - controlarray;
605 static inline LDAPControlW **controlarrayAtoW( LDAPControlA **controlarray )
607 LDAPControlW **controlarrayW = NULL;
608 DWORD size;
610 if (controlarray)
612 size = sizeof(LDAPControlW*) * (controlarraylenA( controlarray ) + 1);
613 controlarrayW = HeapAlloc( GetProcessHeap(), 0, size );
615 if (controlarrayW)
617 LDAPControlA **p = controlarray;
618 LDAPControlW **q = controlarrayW;
620 while (*p) *q++ = controlAtoW( *p++ );
621 *q = NULL;
624 return controlarrayW;
627 static inline LDAPControlA **controlarrayWtoA( LDAPControlW **controlarray )
629 LDAPControlA **controlarrayA = NULL;
630 DWORD size;
632 if (controlarray)
634 size = sizeof(LDAPControl*) * (controlarraylenW( controlarray ) + 1);
635 controlarrayA = HeapAlloc( GetProcessHeap(), 0, size );
637 if (controlarrayA)
639 LDAPControlW **p = controlarray;
640 LDAPControlA **q = controlarrayA;
642 while (*p) *q++ = controlWtoA( *p++ );
643 *q = NULL;
646 return controlarrayA;
649 static inline LDAPControl **controlarrayWtoU( LDAPControlW **controlarray )
651 LDAPControl **controlarrayU = NULL;
652 DWORD size;
654 if (controlarray)
656 size = sizeof(LDAPControl*) * (controlarraylenW( controlarray ) + 1);
657 controlarrayU = HeapAlloc( GetProcessHeap(), 0, size );
659 if (controlarrayU)
661 LDAPControlW **p = controlarray;
662 LDAPControl **q = controlarrayU;
664 while (*p) *q++ = controlWtoU( *p++ );
665 *q = NULL;
668 return controlarrayU;
671 static inline LDAPControlW **controlarrayUtoW( LDAPControl **controlarray )
673 LDAPControlW **controlarrayW = NULL;
674 DWORD size;
676 if (controlarray)
678 size = sizeof(LDAPControlW*) * (controlarraylenU( controlarray ) + 1);
679 controlarrayW = HeapAlloc( GetProcessHeap(), 0, size );
681 if (controlarrayW)
683 LDAPControl **p = controlarray;
684 LDAPControlW **q = controlarrayW;
686 while (*p) *q++ = controlUtoW( *p++ );
687 *q = NULL;
690 return controlarrayW;
693 static inline void controlarrayfreeA( LDAPControlA **controlarray )
695 if (controlarray)
697 LDAPControlA **p = controlarray;
698 while (*p) controlfreeA( *p++ );
699 HeapFree( GetProcessHeap(), 0, controlarray );
703 static inline void controlarrayfreeW( LDAPControlW **controlarray )
705 if (controlarray)
707 LDAPControlW **p = controlarray;
708 while (*p) controlfreeW( *p++ );
709 HeapFree( GetProcessHeap(), 0, controlarray );
713 static inline void controlarrayfreeU( LDAPControl **controlarray )
715 if (controlarray)
717 LDAPControl **p = controlarray;
718 while (*p) controlfreeU( *p++ );
719 HeapFree( GetProcessHeap(), 0, controlarray );
723 static inline LDAPSortKeyW *sortkeyAtoW( LDAPSortKeyA *sortkey )
725 LDAPSortKeyW *sortkeyW;
727 sortkeyW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPSortKeyW) );
728 if (sortkeyW)
730 sortkeyW->sk_attrtype = strAtoW( sortkey->sk_attrtype );
731 sortkeyW->sk_matchruleoid = strAtoW( sortkey->sk_matchruleoid );
732 sortkeyW->sk_reverseorder = sortkey->sk_reverseorder;
734 return sortkeyW;
737 static inline LDAPSortKeyA *sortkeyWtoA( LDAPSortKeyW *sortkey )
739 LDAPSortKeyA *sortkeyA;
741 sortkeyA = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPSortKeyA) );
742 if (sortkeyA)
744 sortkeyA->sk_attrtype = strWtoA( sortkey->sk_attrtype );
745 sortkeyA->sk_matchruleoid = strWtoA( sortkey->sk_matchruleoid );
746 sortkeyA->sk_reverseorder = sortkey->sk_reverseorder;
748 return sortkeyA;
751 static inline LDAPSortKey *sortkeyWtoU( LDAPSortKeyW *sortkey )
753 LDAPSortKey *sortkeyU;
755 sortkeyU = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPSortKey) );
756 if (sortkeyU)
758 sortkeyU->attributeType = strWtoU( sortkey->sk_attrtype );
759 sortkeyU->orderingRule = strWtoU( sortkey->sk_matchruleoid );
760 sortkeyU->reverseOrder = sortkey->sk_reverseorder;
762 return sortkeyU;
765 static inline void sortkeyfreeA( LDAPSortKeyA *sortkey )
767 if (sortkey)
769 strfreeA( sortkey->sk_attrtype );
770 strfreeA( sortkey->sk_matchruleoid );
771 HeapFree( GetProcessHeap(), 0, sortkey );
775 static inline void sortkeyfreeW( LDAPSortKeyW *sortkey )
777 if (sortkey)
779 strfreeW( sortkey->sk_attrtype );
780 strfreeW( sortkey->sk_matchruleoid );
781 HeapFree( GetProcessHeap(), 0, sortkey );
785 static inline void sortkeyfreeU( LDAPSortKey *sortkey )
787 if (sortkey)
789 strfreeU( sortkey->attributeType );
790 strfreeU( sortkey->orderingRule );
791 HeapFree( GetProcessHeap(), 0, sortkey );
795 static inline DWORD sortkeyarraylenA( LDAPSortKeyA **sortkeyarray )
797 LDAPSortKeyA **p = sortkeyarray;
798 while (*p) p++;
799 return p - sortkeyarray;
802 static inline DWORD sortkeyarraylenW( LDAPSortKeyW **sortkeyarray )
804 LDAPSortKeyW **p = sortkeyarray;
805 while (*p) p++;
806 return p - sortkeyarray;
809 static inline LDAPSortKeyW **sortkeyarrayAtoW( LDAPSortKeyA **sortkeyarray )
811 LDAPSortKeyW **sortkeyarrayW = NULL;
812 DWORD size;
814 if (sortkeyarray)
816 size = sizeof(LDAPSortKeyW*) * (sortkeyarraylenA( sortkeyarray ) + 1);
817 sortkeyarrayW = HeapAlloc( GetProcessHeap(), 0, size );
819 if (sortkeyarrayW)
821 LDAPSortKeyA **p = sortkeyarray;
822 LDAPSortKeyW **q = sortkeyarrayW;
824 while (*p) *q++ = sortkeyAtoW( *p++ );
825 *q = NULL;
828 return sortkeyarrayW;
831 static inline LDAPSortKey **sortkeyarrayWtoU( LDAPSortKeyW **sortkeyarray )
833 LDAPSortKey **sortkeyarrayU = NULL;
834 DWORD size;
836 if (sortkeyarray)
838 size = sizeof(LDAPSortKey*) * (sortkeyarraylenW( sortkeyarray ) + 1);
839 sortkeyarrayU = HeapAlloc( GetProcessHeap(), 0, size );
841 if (sortkeyarrayU)
843 LDAPSortKeyW **p = sortkeyarray;
844 LDAPSortKey **q = sortkeyarrayU;
846 while (*p) *q++ = sortkeyWtoU( *p++ );
847 *q = NULL;
850 return sortkeyarrayU;
853 static inline void sortkeyarrayfreeW( LDAPSortKeyW **sortkeyarray )
855 if (sortkeyarray)
857 LDAPSortKeyW **p = sortkeyarray;
858 while (*p) sortkeyfreeW( *p++ );
859 HeapFree( GetProcessHeap(), 0, sortkeyarray );
863 static inline void sortkeyarrayfreeU( LDAPSortKey **sortkeyarray )
865 if (sortkeyarray)
867 LDAPSortKey **p = sortkeyarray;
868 while (*p) sortkeyfreeU( *p++ );
869 HeapFree( GetProcessHeap(), 0, sortkeyarray );
872 #endif /* HAVE_LDAP */