4 * Copyright 2006 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
26 #include "wine/unixlib.h"
28 static inline char *strdup_a( const char *src
)
31 if (!src
) return NULL
;
32 dst
= malloc( (lstrlenA( src
) + 1) * sizeof(char) );
33 if (dst
) lstrcpyA( dst
, src
);
37 static inline char *strdup_u( const char *src
)
40 if (!src
) return NULL
;
41 dst
= malloc( (strlen( src
) + 1) * sizeof(char) );
42 if (dst
) strcpy( dst
, src
);
46 static inline WCHAR
*strdup_w( const WCHAR
*src
)
49 if (!src
) return NULL
;
50 dst
= malloc( (lstrlenW( src
) + 1) * sizeof(WCHAR
) );
51 if (dst
) lstrcpyW( dst
, src
);
55 static inline WCHAR
*strdup_aw( const char *str
)
60 DWORD len
= MultiByteToWideChar( CP_ACP
, 0, str
, -1, NULL
, 0 );
61 if ((ret
= malloc( len
* sizeof(WCHAR
) )))
62 MultiByteToWideChar( CP_ACP
, 0, str
, -1, ret
, len
);
67 static inline WCHAR
*strdup_uw( const char *str
)
72 DWORD len
= MultiByteToWideChar( CP_UTF8
, 0, str
, -1, NULL
, 0 );
73 if ((ret
= malloc( len
* sizeof(WCHAR
) )))
74 MultiByteToWideChar( CP_UTF8
, 0, str
, -1, ret
, len
);
79 static inline char *strdup_wa( const WCHAR
*str
)
84 DWORD len
= WideCharToMultiByte( CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
85 if ((ret
= malloc( len
)))
86 WideCharToMultiByte( CP_ACP
, 0, str
, -1, ret
, len
, NULL
, NULL
);
91 static inline char *strdup_wu( const WCHAR
*str
)
96 DWORD len
= WideCharToMultiByte( CP_UTF8
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
97 if ((ret
= malloc( len
)))
98 WideCharToMultiByte( CP_UTF8
, 0, str
, -1, ret
, len
, NULL
, NULL
);
103 static inline char *strdup_au( const char *src
)
106 WCHAR
*ret
= strdup_aw( src
);
109 dst
= strdup_wu( ret
);
115 static inline char *strdup_ua( const char *src
)
118 WCHAR
*ret
= strdup_uw( src
);
121 dst
= strdup_wa( ret
);
127 extern const char *debugstr_type( unsigned short ) DECLSPEC_HIDDEN
;
129 struct get_searchlist_params
135 struct get_serverlist_params
138 DNS_ADDR_ARRAY
*addrs
;
159 extern unixlib_handle_t resolv_handle
;
161 #define RESOLV_CALL( func, params ) __wine_unix_call( resolv_handle, unix_ ## func, params )