kernelbase: Use nameless unions/structs for loader data.
[wine.git] / dlls / dnsapi / dnsapi.h
blob89324dd9c298d5fc4d103e41bb6505a7149032ff
1 /*
2 * DNS support
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
21 #include <stdlib.h>
22 #include "windef.h"
23 #include "winbase.h"
24 #include "winnls.h"
25 #include "winternl.h"
26 #include "wine/unixlib.h"
28 static inline WCHAR *strdup_aw( const char *str )
30 WCHAR *ret = NULL;
31 if (str)
33 DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
34 if ((ret = malloc( len * sizeof(WCHAR) )))
35 MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
37 return ret;
40 static inline WCHAR *strdup_uw( const char *str )
42 WCHAR *ret = NULL;
43 if (str)
45 DWORD len = MultiByteToWideChar( CP_UTF8, 0, str, -1, NULL, 0 );
46 if ((ret = malloc( len * sizeof(WCHAR) )))
47 MultiByteToWideChar( CP_UTF8, 0, str, -1, ret, len );
49 return ret;
52 static inline char *strdup_wa( const WCHAR *str )
54 char *ret = NULL;
55 if (str)
57 DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
58 if ((ret = malloc( len )))
59 WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
61 return ret;
64 static inline char *strdup_wu( const WCHAR *str )
66 char *ret = NULL;
67 if (str)
69 DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL );
70 if ((ret = malloc( len )))
71 WideCharToMultiByte( CP_UTF8, 0, str, -1, ret, len, NULL, NULL );
73 return ret;
76 static inline char *strdup_au( const char *src )
78 char *dst = NULL;
79 WCHAR *ret = strdup_aw( src );
80 if (ret)
82 dst = strdup_wu( ret );
83 free( ret );
85 return dst;
88 static inline char *strdup_ua( const char *src )
90 char *dst = NULL;
91 WCHAR *ret = strdup_uw( src );
92 if (ret)
94 dst = strdup_wa( ret );
95 free( ret );
97 return dst;
100 extern const char *debugstr_type( unsigned short ) DECLSPEC_HIDDEN;
102 struct get_searchlist_params
104 WCHAR *list;
105 DWORD *len;
108 struct get_serverlist_params
110 USHORT family;
111 DNS_ADDR_ARRAY *addrs;
112 DWORD *len;
115 struct query_params
117 const char *name;
118 WORD type;
119 DWORD options;
120 void *buf;
121 DWORD *len;
124 enum unix_funcs
126 unix_get_searchlist,
127 unix_get_serverlist,
128 unix_set_serverlist,
129 unix_query,
132 #define RESOLV_CALL( func, params ) WINE_UNIX_CALL( unix_ ## func, params )