ReactOS 0.4.15-dev-8131-g4988de4
precomp.h
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS System Libraries
4 * FILE: lib/dnsapi/precomp.h
5 * PURPOSE: Win32 DNS API Library Header
6 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
7 */
8
9#ifndef _DNSAPI_H
10#define _DNSAPI_H
11
12/* INCLUDES ******************************************************************/
13
14#include <stdarg.h>
15
16/* PSDK/NDK Headers */
17#define WIN32_NO_STATUS
18#define _INC_WINDOWS
19#define COM_NO_WINDOWS_H
20#include <windef.h>
21#include <winbase.h>
22#include <winnls.h>
23#include <windns.h>
25#define NTOS_MODE_USER
26#include <ndk/rtlfuncs.h>
27
28#include <dnsrslvr_c.h>
29
30#include <adns.h>
31
32typedef struct
33{
36
37static inline LPWSTR dns_strdup_uw( const char *str )
38{
39 LPWSTR ret = NULL;
40 if (str)
41 {
43 if ((ret = HeapAlloc(GetProcessHeap(),0,( len * sizeof(WCHAR) ))))
45 }
46 return ret;
47}
48
50{
51 LPWSTR ret = NULL;
52 if (str)
53 {
54 DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
55 if ((ret = HeapAlloc(GetProcessHeap(), 0, ( len * sizeof(WCHAR) ))))
57 }
58 return ret;
59}
60
61static inline LPSTR dns_strdup_a( LPCSTR src )
62{
63 LPSTR dst;
64
65 if (!src) return NULL;
66 dst = HeapAlloc(GetProcessHeap(), 0, (lstrlenA( src ) + 1) * sizeof(char) );
67 if (dst) lstrcpyA( dst, src );
68 return dst;
69}
70
71static inline char *dns_strdup_u( const char *src )
72{
73 char *dst;
74
75 if (!src) return NULL;
76 dst = HeapAlloc(GetProcessHeap(), 0, (strlen( src ) + 1) * sizeof(char) );
77 if (dst) strcpy( dst, src );
78 return dst;
79}
80
82{
83 LPWSTR dst;
84
85 if (!src) return NULL;
86 dst = HeapAlloc(GetProcessHeap(), 0, (lstrlenW( src ) + 1) * sizeof(WCHAR) );
87 if (dst) lstrcpyW( dst, src );
88 return dst;
89}
90
92{
93 LPSTR ret = NULL;
94 if (str)
95 {
97 if ((ret = HeapAlloc(GetProcessHeap(), 0, len )))
99 }
100 return ret;
101}
102
103static inline char *dns_strdup_wu( LPCWSTR str )
104{
105 LPSTR ret = NULL;
106 if (str)
107 {
109 if ((ret = HeapAlloc(GetProcessHeap(), 0, len )))
111 }
112 return ret;
113}
114
115static inline char *dns_strdup_au( LPCSTR src )
116{
117 char *dst = NULL;
119
120 if (ret)
121 {
122 dst = dns_strdup_wu( ret );
123 HeapFree( GetProcessHeap(), 0, ret );
124 }
125 return dst;
126}
127
128static inline LPSTR dns_strdup_ua( const char *src )
129{
130 LPSTR dst = NULL;
132
133 if (ret)
134 {
135 dst = dns_strdup_wa( ret );
136 HeapFree( GetProcessHeap(), 0, ret );
137 }
138 return dst;
139}
140
143
144#endif /* _DNSAPI_H */
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrlenW
Definition: compat.h:750
static LPSTR dns_strdup_a(LPCSTR src)
Definition: precomp.h:61
static LPWSTR dns_strdup_w(LPCWSTR src)
Definition: precomp.h:81
static char * dns_strdup_au(LPCSTR src)
Definition: precomp.h:115
static char * dns_strdup_u(const char *src)
Definition: precomp.h:71
static char * dns_strdup_wu(LPCWSTR str)
Definition: precomp.h:103
static LPWSTR dns_strdup_aw(LPCSTR str)
Definition: precomp.h:49
struct WINDNS_CONTEXT * PWINDNS_CONTEXT
static LPWSTR dns_strdup_uw(const char *str)
Definition: precomp.h:37
static LPSTR dns_strdup_wa(LPCWSTR str)
Definition: precomp.h:91
void DnsIntFreeRecordList(PDNS_RECORD ToFree)
Definition: query.c:889
static LPSTR dns_strdup_ua(const char *src)
Definition: precomp.h:128
DNS_STATUS DnsIntTranslateAdnsToDNS_STATUS(int Status)
Definition: adns.c:17
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:25
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLenum GLsizei len
Definition: glext.h:6722
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
const WCHAR * str
#define CP_UTF8
Definition: nls.h:20
adns_state State
Definition: precomp.h:34
int ret
#define PDNS_RECORD
Definition: windns.h:636
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185