d3d11/tests: Add some tests for Map() on deferred contexts.
[wine.git] / dlls / dnsapi / dnsapi.h
blobbcd6a6d5bc37d5748c96e2d35aa70cf57e0f0329
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 "wine/heap.h"
23 static inline char *strdup_a( const char *src )
25 char *dst;
26 if (!src) return NULL;
27 dst = heap_alloc( (lstrlenA( src ) + 1) * sizeof(char) );
28 if (dst) lstrcpyA( dst, src );
29 return dst;
32 static inline char *strdup_u( const char *src )
34 char *dst;
35 if (!src) return NULL;
36 dst = heap_alloc( (strlen( src ) + 1) * sizeof(char) );
37 if (dst) strcpy( dst, src );
38 return dst;
41 static inline WCHAR *strdup_w( const WCHAR *src )
43 WCHAR *dst;
44 if (!src) return NULL;
45 dst = heap_alloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) );
46 if (dst) lstrcpyW( dst, src );
47 return dst;
50 static inline WCHAR *strdup_aw( const char *str )
52 WCHAR *ret = NULL;
53 if (str)
55 DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
56 if ((ret = heap_alloc( len * sizeof(WCHAR) )))
57 MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
59 return ret;
62 static inline WCHAR *strdup_uw( const char *str )
64 WCHAR *ret = NULL;
65 if (str)
67 DWORD len = MultiByteToWideChar( CP_UTF8, 0, str, -1, NULL, 0 );
68 if ((ret = heap_alloc( len * sizeof(WCHAR) )))
69 MultiByteToWideChar( CP_UTF8, 0, str, -1, ret, len );
71 return ret;
74 static inline char *strdup_wa( const WCHAR *str )
76 char *ret = NULL;
77 if (str)
79 DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
80 if ((ret = heap_alloc( len )))
81 WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
83 return ret;
86 static inline char *strdup_wu( const WCHAR *str )
88 char *ret = NULL;
89 if (str)
91 DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL );
92 if ((ret = heap_alloc( len )))
93 WideCharToMultiByte( CP_UTF8, 0, str, -1, ret, len, NULL, NULL );
95 return ret;
98 static inline char *strdup_au( const char *src )
100 char *dst = NULL;
101 WCHAR *ret = strdup_aw( src );
102 if (ret)
104 dst = strdup_wu( ret );
105 heap_free( ret );
107 return dst;
110 static inline char *strdup_ua( const char *src )
112 char *dst = NULL;
113 WCHAR *ret = strdup_uw( src );
114 if (ret)
116 dst = strdup_wa( ret );
117 heap_free( ret );
119 return dst;
122 extern const char *type_to_str( unsigned short ) DECLSPEC_HIDDEN;
124 extern DNS_STATUS CDECL resolv_get_serverlist( IP4_ARRAY *, DWORD * ) DECLSPEC_HIDDEN;
125 extern DNS_STATUS CDECL resolv_query( const char *, WORD, DWORD, DNS_RECORDA ** ) DECLSPEC_HIDDEN;
126 extern DNS_STATUS CDECL resolv_set_serverlist( const IP4_ARRAY * ) DECLSPEC_HIDDEN;
128 struct resolv_funcs
130 DNS_STATUS (CDECL *get_serverlist)( IP4_ARRAY *addrs, DWORD *len );
131 DNS_STATUS (CDECL *query)( const char *name, WORD type, DWORD options, DNS_RECORDA **result );
132 DNS_STATUS (CDECL *set_serverlist)( const IP4_ARRAY *addrs );
135 extern const struct resolv_funcs *resolv_funcs;