ReactOS  0.4.15-dev-1201-gb2cf5a4
precomp.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <windns.h>
#include <reactos/windns_undoc.h>
#include <ndk/rtlfuncs.h>
#include <dnsrslvr_c.h>
#include <adns.h>
Include dependency graph for precomp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  WINDNS_CONTEXT
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define NTOS_MODE_USER
 

Typedefs

typedef struct WINDNS_CONTEXTPWINDNS_CONTEXT
 

Functions

static LPWSTR dns_strdup_uw (const char *str)
 
static LPWSTR dns_strdup_aw (LPCSTR str)
 
static LPSTR dns_strdup_a (LPCSTR src)
 
static chardns_strdup_u (const char *src)
 
static LPWSTR dns_strdup_w (LPCWSTR src)
 
static LPSTR dns_strdup_wa (LPCWSTR str)
 
static chardns_strdup_wu (LPCWSTR str)
 
static chardns_strdup_au (LPCSTR src)
 
static LPSTR dns_strdup_ua (const char *src)
 
DNS_STATUS DnsIntTranslateAdnsToDNS_STATUS (int Status)
 
void DnsIntFreeRecordList (PDNS_RECORD ToFree)
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 18 of file precomp.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 19 of file precomp.h.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 25 of file precomp.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 17 of file precomp.h.

Typedef Documentation

◆ PWINDNS_CONTEXT

Function Documentation

◆ dns_strdup_a()

static LPSTR dns_strdup_a ( LPCSTR  src)
inlinestatic

Definition at line 61 of file precomp.h.

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 }
char * LPSTR
Definition: xmlstorage.h:182
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
GLenum src
Definition: glext.h:6340
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
GLenum GLenum dst
Definition: glext.h:6340

Referenced by dns_strcpyX().

◆ dns_strdup_au()

static char* dns_strdup_au ( LPCSTR  src)
inlinestatic

Definition at line 115 of file precomp.h.

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 }
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:595
int ret
static LPWSTR dns_strdup_aw(LPCSTR str)
Definition: precomp.h:49
GLenum src
Definition: glext.h:6340
static char * dns_strdup_wu(LPCWSTR str)
Definition: precomp.h:103
GLenum GLenum dst
Definition: glext.h:6340
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by dns_strcpyX().

◆ dns_strdup_aw()

static LPWSTR dns_strdup_aw ( LPCSTR  str)
inlinestatic

Definition at line 49 of file precomp.h.

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) ))))
56  MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
57  }
58  return ret;
59 }
#define CP_ACP
Definition: compat.h:109
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:110
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by dns_strcpyX(), dns_strdup_au(), DnsNameCompare_A(), and DnsValidateName_A().

◆ dns_strdup_u()

static char* dns_strdup_u ( const char src)
inlinestatic

Definition at line 71 of file precomp.h.

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 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by dns_strcpyX().

◆ dns_strdup_ua()

static LPSTR dns_strdup_ua ( const char src)
inlinestatic

Definition at line 128 of file precomp.h.

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 }
char * LPSTR
Definition: xmlstorage.h:182
static LPWSTR dns_strdup_uw(const char *str)
Definition: precomp.h:37
static LPSTR dns_strdup_wa(LPCWSTR str)
Definition: precomp.h:91
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:595
int ret
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by dns_strcpyX().

◆ dns_strdup_uw()

static LPWSTR dns_strdup_uw ( const char str)
inlinestatic

Definition at line 37 of file precomp.h.

38 {
39  LPWSTR ret = NULL;
40  if (str)
41  {
42  DWORD len = MultiByteToWideChar( CP_UTF8, 0, str, -1, NULL, 0 );
43  if ((ret = HeapAlloc(GetProcessHeap(),0,( len * sizeof(WCHAR) ))))
44  MultiByteToWideChar( CP_UTF8, 0, str, -1, ret, len );
45  }
46  return ret;
47 }
#define CP_UTF8
Definition: nls.h:20
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:110
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by dns_strcpyX(), dns_strdup_ua(), and DnsValidateName_UTF8().

◆ dns_strdup_w()

static LPWSTR dns_strdup_w ( LPCWSTR  src)
inlinestatic

Definition at line 81 of file precomp.h.

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 }
#define lstrlenW
Definition: compat.h:609
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum src
Definition: glext.h:6340
#define lstrcpyW
Definition: compat.h:608
GLenum GLenum dst
Definition: glext.h:6340
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by dns_strcpyX().

◆ dns_strdup_wa()

static LPSTR dns_strdup_wa ( LPCWSTR  str)
inlinestatic

Definition at line 91 of file precomp.h.

92 {
93  LPSTR ret = NULL;
94  if (str)
95  {
96  DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
97  if ((ret = HeapAlloc(GetProcessHeap(), 0, len )))
98  WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
99  }
100  return ret;
101 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
char * LPSTR
Definition: xmlstorage.h:182
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722

Referenced by dns_strcpyX(), and dns_strdup_ua().

◆ dns_strdup_wu()

static char* dns_strdup_wu ( LPCWSTR  str)
inlinestatic

Definition at line 103 of file precomp.h.

104 {
105  LPSTR ret = NULL;
106  if (str)
107  {
108  DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL );
109  if ((ret = HeapAlloc(GetProcessHeap(), 0, len )))
110  WideCharToMultiByte( CP_UTF8, 0, str, -1, ret, len, NULL, NULL );
111  }
112  return ret;
113 }
#define WideCharToMultiByte
Definition: compat.h:111
char * LPSTR
Definition: xmlstorage.h:182
#define CP_UTF8
Definition: nls.h:20
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722

Referenced by dns_strcpyX(), and dns_strdup_au().

◆ DnsIntFreeRecordList()

void DnsIntFreeRecordList ( PDNS_RECORD  ToFree)

Definition at line 889 of file query.c.

890 {
891  UINT i;
892  PDNS_RECORD next = 0;
893 
894  while(ToDelete)
895  {
896  if(ToDelete->pName)
897  RtlFreeHeap(RtlGetProcessHeap(), 0, ToDelete->pName);
898 
899  switch(ToDelete->wType)
900  {
901  case DNS_TYPE_CNAME:
902  case DNS_TYPE_PTR:
903  case DNS_TYPE_NS:
904  case DNS_TYPE_MB:
905  case DNS_TYPE_MD:
906  case DNS_TYPE_MF:
907  case DNS_TYPE_MG:
908  case DNS_TYPE_MR:
909  RtlFreeHeap(RtlGetProcessHeap(), 0, ToDelete->Data.PTR.pNameHost);
910  break;
911 
912  case DNS_TYPE_MINFO:
913  case DNS_TYPE_MX:
914  RtlFreeHeap(RtlGetProcessHeap(), 0, ToDelete->Data.MX.pNameExchange);
915  break;
916 
917  case DNS_TYPE_HINFO:
918  for(i = 0; i < ToDelete->Data.TXT.dwStringCount; i++)
919  RtlFreeHeap(RtlGetProcessHeap(), 0, ToDelete->Data.TXT.pStringArray[i]);
920 
921  RtlFreeHeap(RtlGetProcessHeap(), 0, ToDelete->Data.TXT.pStringArray);
922  break;
923  }
924 
925  next = ToDelete->pNext;
926  RtlFreeHeap(RtlGetProcessHeap(), 0, ToDelete);
927  ToDelete = next;
928  }
929 }
#define DNS_TYPE_MG
Definition: windns.h:48
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define DNS_TYPE_HINFO
Definition: windns.h:53
#define DNS_TYPE_CNAME
Definition: windns.h:45
#define DNS_TYPE_MF
Definition: windns.h:44
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DNS_TYPE_MD
Definition: windns.h:43
#define DNS_TYPE_MINFO
Definition: windns.h:54
#define DNS_TYPE_PTR
Definition: windns.h:52
#define DNS_TYPE_MX
Definition: windns.h:55
#define DNS_TYPE_MB
Definition: windns.h:47
#define DNS_TYPE_MR
Definition: windns.h:49
static unsigned __int64 next
Definition: rand_nt.c:6
unsigned int UINT
Definition: ndis.h:50
#define DNS_TYPE_NS
Definition: windns.h:42
#define PDNS_RECORD
Definition: windns.h:636

Referenced by DnsFree(), and DnsQuery_CodePage().

◆ DnsIntTranslateAdnsToDNS_STATUS()

DNS_STATUS DnsIntTranslateAdnsToDNS_STATUS ( int  Status)

Definition at line 17 of file adns.c.

18 {
19  switch(Status)
20  {
21  case adns_s_ok:
22  return ERROR_SUCCESS;
23 
24  case adns_s_nomemory:
25  case adns_s_systemfail:
26  default: /* There really aren't any general errors in the dns part. */
27  return ERROR_OUTOFMEMORY;
28  }
29 }
#define ERROR_SUCCESS
Definition: deptool.c:10
Status
Definition: gdiplustypes.h:24
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by DnsAcquireContextHandle_W(), and Query_Main().