20#define Swap(a, b, c) { (c) = (a); (a) = (b); (b) = (c); }
21#define FreeAddrInfoW(a) freeaddrinfo((LPADDRINFO)a)
32 wsprintfW(AddressBuffer,
L"%u.%u.%u.%u.in-addr.arpa.",
80 }
while ((Addrinfo = Addrinfo->ai_next));
94 CHAR *
cp = AnsiAddressString;
105 sizeof(AnsiAddressString),
118 if (*++
cp ==
'x' || *
cp ==
'X')
221 for (Next = ptResult; Next;)
270 for (Addresses = Hostent->
h_addr_list; *Addresses; Addresses++)
280 Next = &((*Next)->ai_next);
315 WCHAR ReverseBuffer[76];
354 Restrictions.dwSize =
sizeof(Restrictions);
355 Restrictions.lpszServiceInstanceName = ReverseBuffer;
356 Restrictions.lpServiceClassId = &LookupGuid;
357 Restrictions.dwNameSpace =
NS_DNS;
374 Reply = Restrictions;
375 if (!Reply.lpszServiceInstanceName)
390 if (
wcslen(Reply.lpszServiceInstanceName) + 1 >
399 wcscpy(pNodeBuffer, Reply.lpszServiceInstanceName);
443 PCHAR Alias = szFQDN2;
462 if (*pptResult)
break;
477 if (!iError && bAI_CANONNAME)
483 if (!(*pptResult)->ai_canonname)
495 (*pptResult)->ai_canonname,
526 WCHAR CanonicalName[0x42];
527 CHAR AnsiServiceName[256];
528 CHAR AnsiNodeName[256];
529 DPRINT(
"GetAddrInfoW: %S, %S, %p, %p\n", pszNodeName, pszServiceName, ptHints, pptResult);
535 if (!(pszNodeName) && !(pszServiceName))
546 if ((ptHints->ai_addrlen) ||
547 (ptHints->ai_canonname) ||
548 (ptHints->ai_addr) ||
557 iFlags = ptHints->ai_flags;
565 iFamily = ptHints->ai_family;
573 iSocketType = ptHints->ai_socktype;
574 if ((iSocketType != 0) &&
584 iProtocol = ptHints->ai_protocol;
596 sizeof(AnsiServiceName),
607 wPort = wTcpPort = wUdpPort =
htons(wPort);
611 if (iSocketType == 0)
623 if ((iSocketType == 0) || (iSocketType ==
SOCK_DGRAM))
629 if (ptService) wPort = wUdpPort = ptService->
s_port;
633 if ((iSocketType == 0) || (iSocketType ==
SOCK_STREAM))
639 if (ptService) wPort = wTcpPort = ptService->
s_port;
650 if (iSocketType == 0)
653 if (wTcpPort && !wUdpPort)
655 if (!wTcpPort && wUdpPort)
674 *pptResult =
NewAddrInfo(iSocketType, iProtocol, wPort, dwAddress);
680 if (!iError && pszNodeName)
702 if (!(*pptResult)->ai_canonname)
730 sizeof(AnsiNodeName),
744 if (!iError && bClone)
821 if (!UnicodeNodeName)
833 if (!UnicodeServName)
881 DWORD AddressLength, AddrSize;
886 DPRINT(
"GetNameInfoW: %p, %d, %p, %ld, %p, %ld, %d\n",
900 if (pSockaddr->sa_family ==
AF_INET)
907 else if (pSockaddr->sa_family ==
AF_INET6)
922 if ((
DWORD)SockaddrLength < AddressLength)
937 pSockaddr->sa_family);
955 if (pSockaddr->sa_family ==
AF_INET)
960 else if (pSockaddr->sa_family ==
AF_INET6)
1011 WCHAR ServiceBuffer[17];
1012 DWORD HostLength = 0, ServLength = 0;
1014 DPRINT(
"getnameinfo: %p, %p, %p, %lx\n",
host, serv,
sa, salen);
1031 ServiceString = ServiceBuffer;
1032 ServLength =
sizeof(ServiceBuffer) /
sizeof(
WCHAR);
std::map< E_STRING, PART_TEST > parts
int strcmp(const char *String1, const char *String2)
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
ACPI_SIZE strlen(const char *String)
char * strcpy(char *DstString, const char *SrcString)
INT WSAAPI GetNameInfoW(IN CONST SOCKADDR *pSockaddr, IN socklen_t SockaddrLength, OUT PWCHAR pNodeBuffer, IN DWORD NodeBufferSize, OUT PWCHAR pServiceBuffer, IN DWORD ServiceBufferSize, IN INT Flags)
static PADDRINFOW WINAPI NewAddrInfo(IN INT SocketType, IN INT Protocol, IN WORD Port, IN DWORD Address)
VOID WINAPI Dns_SplitHostFromDomainNameW(IN LPWSTR DomainName)
static INT WINAPI CloneAddrInfo(IN WORD Port, IN PADDRINFOW ptResult)
static INT WINAPI ConvertAddrinfoFromUnicodeToAnsi(IN PADDRINFOW Addrinfo)
static INT WINAPI GetServiceNameForPort(IN LPWSTR pServiceBuffer, IN DWORD ServiceBufferSize, IN WORD Port, IN DWORD Flags)
static INT WINAPI QueryDNS(IN LPCSTR NodeName, IN INT SocketType, IN INT Protocol, IN WORD Port, OUT CHAR Alias[NI_MAXHOST], OUT PADDRINFOW *pptResult)
static INT WINAPI LookupAddressForName(IN LPCSTR NodeName, IN INT SocketType, IN INT Protocol, IN WORD Port, IN BOOL bAI_CANONNAME, OUT PADDRINFOW *pptResult)
static INT WINAPI LookupNodeByAddr(IN LPWSTR pNodeBuffer, IN DWORD NodeBufferSize, IN BOOLEAN OnlyNodeName, IN PVOID Addr, IN DWORD AddrSize, IN INT AddressFamily)
VOID WSAAPI Dns_Ip4AddressToReverseName_W(IN LPWSTR AddressBuffer, IN IN_ADDR Address)
INT WSAAPI GetAddrInfoW(IN PCWSTR pszNodeName, IN PCWSTR pszServiceName, IN const ADDRINFOW *ptHints, OUT PADDRINFOW *pptResult)
static BOOL WINAPI ParseV4Address(IN PCWSTR AddressString, OUT PDWORD pAddress)
static struct sockaddr_in sa
#define HeapFree(x, y, z)
#define WideCharToMultiByte
#define MultiByteToWideChar
IN PDCB IN POEM_STRING IN PUNICODE_STRING UnicodeName
PHOSTENT WSAAPI gethostbyname(IN const char FAR *name)
PSERVENT WSAAPI getservbyname(IN const char FAR *name, IN const char FAR *proto)
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 * u
struct in_addr * PIN_ADDR
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define IN6_IS_ADDR_V4MAPPED(a)
_In_ NDIS_ERROR_CODE ErrorCode
IN PCO_ADDRESS_FAMILY AddressFamily
INT WSAAPI WSALookupServiceEnd(IN HANDLE hLookup)
INT WINAPI WSALookupServiceNextW(IN HANDLE hLookup, IN DWORD dwControlFlags, IN OUT LPDWORD lpdwBufferLength, OUT LPWSAQUERYSETW lpqsResults)
INT WINAPI WSALookupServiceBeginW(IN LPWSAQUERYSETW lpqsRestrictions, IN DWORD dwControlFlags, OUT LPHANDLE lphLookup)
INT WSAAPI WSAAddressToStringW(IN LPSOCKADDR lpsaAddress, IN DWORD dwAddressLength, IN LPWSAPROTOCOL_INFOW lpProtocolInfo, OUT LPWSTR lpszAddressString, IN OUT LPDWORD lpdwAddressStringLength)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
namespace GUID const ADDRINFOEXW * hints
static const ADDRINFOW PADDRINFOW *static const WCHAR * servname
struct addrinfoW * ai_next
struct sockaddr * ai_addr
struct sockaddr * ai_addr
struct addrinfo * ai_next
#define SVCID_DNS_TYPE_PTR
#define RtlZeroMemory(Destination, Length)
#define RtlMoveMemory(Destination, Source, Length)
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
DWORD WINAPI GetLastError(void)
#define WSAHOST_NOT_FOUND
#define WSASERVICE_NOT_FOUND
struct sockaddr_in SOCKADDR_IN
struct sockaddr_in * PSOCKADDR_IN
struct sockaddr * PSOCKADDR
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
FORCEINLINE DWORD WsQuickProlog(VOID)
LPSTR WSAAPI AnsiDupFromUnicode(IN LPCWSTR UnicodeString)
LPWSTR WSAAPI UnicodeDupFromAnsi(IN LPCSTR AnsiString)
SOCKADDR_IN6_LH * PSOCKADDR_IN6
SOCKADDR_IN6_LH SOCKADDR_IN6
_In_ PADDRINFOEXW AddrInfo
_Must_inspect_result_ _In_ ULONG Flags