/*1* Copyright 2020 Dmitry Timoshkov2*3* This library is free software; you can redistribute it and/or4* modify it under the terms of the GNU Lesser General Public5* License as published by the Free Software Foundation; either6* version 2.1 of the License, or (at your option) any later version.7*8* This library is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11* Lesser General Public License for more details.12*13* You should have received a copy of the GNU Lesser General Public14* License along with this library; if not, write to the Free Software15* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA16*/1718#ifndef _ADSLDP_PRIVATE_H19#define _ADSLDP_PRIVATE_H2021static inline LPWSTR strnUtoW( LPCSTR str, DWORD inlen, DWORD *outlen )22{23LPWSTR ret = NULL;24*outlen = 0;25if (str)26{27DWORD len = MultiByteToWideChar( CP_UTF8, 0, str, inlen, NULL, 0 );28if ((ret = malloc( (len + 1) * sizeof(WCHAR) )))29{30MultiByteToWideChar( CP_UTF8, 0, str, inlen, ret, len );31ret[len] = 0;32*outlen = len;33}34}35return ret;36}3738struct attribute_type39{40WCHAR *oid;41WCHAR *name;42ULONG name_count;43WCHAR *syntax;44int single_value;45};4647DWORD map_ldap_error(DWORD);48struct attribute_type *load_schema(LDAP *ld, ULONG *, ULONG *);49ADSTYPEENUM get_schema_type(const WCHAR *, const struct attribute_type *, ULONG, ULONG);50void free_attribute_types(struct attribute_type *, ULONG);5152#endif535455