dwmapi: Clear DWM_TIMING_INFO structure before returning.
[wine.git] / dlls / dnsapi / dnsapi.h
blobf27cce9a99ddbf299d4e5a3c4eccc0531a1b7442
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 char *strdup_a( const char *src )
30 char *dst;
31 if (!src) return NULL;
32 dst = malloc( (lstrlenA( src ) + 1) * sizeof(char) );
33 if (dst) lstrcpyA( dst, src );
34 return dst;
37 static inline char *strdup_u( const char *src )
39 char *dst;
40 if (!src) return NULL;
41 dst = malloc( (strlen( src ) + 1) * sizeof(char) );
42 if (dst) strcpy( dst, src );
43 return dst;
46 static inline WCHAR *strdup_w( const WCHAR *src )
48 WCHAR *dst;
49 if (!src) return NULL;
50 dst = malloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) );
51 if (dst) lstrcpyW( dst, src );
52 return dst;
55 static inline WCHAR *strdup_aw( const char *str )
57 WCHAR *ret = NULL;
58 if (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 );
64 return ret;
67 static inline WCHAR *strdup_uw( const char *str )
69 WCHAR *ret = NULL;
70 if (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 );
76 return ret;
79 static inline char *strdup_wa( const WCHAR *str )
81 char *ret = NULL;
82 if (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 );
88 return ret;
91 static inline char *strdup_wu( const WCHAR *str )
93 char *ret = NULL;
94 if (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 );
100 return ret;
103 static inline char *strdup_au( const char *src )
105 char *dst = NULL;
106 WCHAR *ret = strdup_aw( src );
107 if (ret)
109 dst = strdup_wu( ret );
110 free( ret );
112 return dst;
115 static inline char *strdup_ua( const char *src )
117 char *dst = NULL;
118 WCHAR *ret = strdup_uw( src );
119 if (ret)
121 dst = strdup_wa( ret );
122 free( ret );
124 return dst;
127 extern const char *debugstr_type( unsigned short ) DECLSPEC_HIDDEN;
129 struct get_searchlist_params
131 DNS_TXT_DATAW *list;
132 DWORD *len;
135 struct get_serverlist_params
137 USHORT family;
138 DNS_ADDR_ARRAY *addrs;
139 DWORD *len;
142 struct query_params
144 const char *name;
145 WORD type;
146 DWORD options;
147 void *buf;
148 DWORD *len;
151 enum unix_funcs
153 unix_get_searchlist,
154 unix_get_serverlist,
155 unix_set_serverlist,
156 unix_query,
159 extern unixlib_handle_t resolv_handle;
161 #define RESOLV_CALL( func, params ) __wine_unix_call( resolv_handle, unix_ ## func, params )