ReactOS  0.4.14-dev-604-gcfdd483
rnr.c File Reference
#include <ws2_32.h>
#include <debug.h>
Include dependency graph for rnr.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

INT WSAAPI WSAAddressToStringA (IN LPSOCKADDR lpsaAddress, IN DWORD dwAddressLength, IN LPWSAPROTOCOL_INFOA lpProtocolInfo, OUT LPSTR lpszAddressString, IN OUT LPDWORD lpdwAddressStringLength)
 
INT WSAAPI WSAAddressToStringW (IN LPSOCKADDR lpsaAddress, IN DWORD dwAddressLength, IN LPWSAPROTOCOL_INFOW lpProtocolInfo, OUT LPWSTR lpszAddressString, IN OUT LPDWORD lpdwAddressStringLength)
 
INT WSAAPI WSALookupServiceEnd (IN HANDLE hLookup)
 
INT WSAAPI WSALookupServiceBeginA (IN LPWSAQUERYSETA lpqsRestrictions, IN DWORD dwControlFlags, OUT LPHANDLE lphLookup)
 
INT WINAPI WSALookupServiceBeginW (IN LPWSAQUERYSETW lpqsRestrictions, IN DWORD dwControlFlags, OUT LPHANDLE lphLookup)
 
INT WINAPI WSALookupServiceNextW (IN HANDLE hLookup, IN DWORD dwControlFlags, IN OUT LPDWORD lpdwBufferLength, OUT LPWSAQUERYSETW lpqsResults)
 
INT WSAAPI WSALookupServiceNextA (IN HANDLE hLookup, IN DWORD dwControlFlags, IN OUT LPDWORD lpdwBufferLength, OUT LPWSAQUERYSETA lpqsResults)
 
INT WSPAPI WSANSPIoctl (HANDLE hLookup, DWORD dwControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer, LPVOID lpvOutBuffer, DWORD cbOutBuffer, LPDWORD lpcbBytesReturned, LPWSACOMPLETION lpCompletion)
 
INT WSAAPI WSARemoveServiceClass (IN LPGUID lpServiceClassId)
 
INT WSAAPI WSASetServiceA (IN LPWSAQUERYSETA lpqsRegInfo, IN WSAESETSERVICEOP essOperation, IN DWORD dwControlFlags)
 
INT WSAAPI WSASetServiceW (IN LPWSAQUERYSETW lpqsRegInfo, IN WSAESETSERVICEOP essOperation, IN DWORD dwControlFlags)
 
INT WSAAPI WSAGetServiceClassInfoA (IN LPGUID lpProviderId, IN LPGUID lpServiceClassId, IN OUT LPDWORD lpdwBufferLength, OUT LPWSASERVICECLASSINFOA lpServiceClassInfo)
 
INT WSAAPI WSAGetServiceClassInfoW (IN LPGUID lpProviderId, IN LPGUID lpServiceClassId, IN OUT LPDWORD lpdwBufferLength, OUT LPWSASERVICECLASSINFOW lpServiceClassInfo)
 
INT WSAAPI WSAGetServiceClassNameByClassIdA (IN LPGUID lpServiceClassId, OUT LPSTR lpszServiceClassName, IN OUT LPDWORD lpdwBufferLength)
 
INT WSAAPI WSAGetServiceClassNameByClassIdW (IN LPGUID lpServiceClassId, OUT LPWSTR lpszServiceClassName, IN OUT LPDWORD lpdwBufferLength)
 
INT WSAAPI WSAInstallServiceClassA (IN LPWSASERVICECLASSINFOA lpServiceClassInfo)
 
INT WSAAPI WSAInstallServiceClassW (IN LPWSASERVICECLASSINFOW lpServiceClassInfo)
 
VOID WSAAPI NSProviderInfoFromContext (IN PNSCATALOG_ENTRY Entry, IN PNSPROVIDER_ENUM_CONTEXT Context)
 
BOOL WSAAPI NSProvidersEnumerationProc (PVOID EnumContext, PNSCATALOG_ENTRY Entry)
 
INT WSAAPI WSAEnumNameSpaceProvidersInternal (IN OUT LPDWORD lpdwBufferLength, OUT LPWSANAMESPACE_INFOA lpnspBuffer, BOOLEAN Unicode)
 
INT WSAAPI WSAEnumNameSpaceProvidersA (IN OUT LPDWORD lpdwBufferLength, OUT LPWSANAMESPACE_INFOA lpnspBuffer)
 
INT WSAAPI WSAEnumNameSpaceProvidersW (IN OUT LPDWORD lpdwBufferLength, OUT LPWSANAMESPACE_INFOW lpnspBuffer)
 
INT WSAAPI WSAStringToAddressA (IN LPSTR AddressString, IN INT AddressFamily, IN LPWSAPROTOCOL_INFOA lpProtocolInfo, OUT LPSOCKADDR lpAddress, IN OUT LPINT lpAddressLength)
 
INT WSAAPI WSAStringToAddressW (IN LPWSTR AddressString, IN INT AddressFamily, IN LPWSAPROTOCOL_INFOW lpProtocolInfo, OUT LPSOCKADDR lpAddress, IN OUT LPINT lpAddressLength)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file rnr.c.

Function Documentation

◆ NSProviderInfoFromContext()

VOID WSAAPI NSProviderInfoFromContext ( IN PNSCATALOG_ENTRY  Entry,
IN PNSPROVIDER_ENUM_CONTEXT  Context 
)

Definition at line 707 of file rnr.c.

709 {
710  INT size = Context->Unicode ? sizeof(WSANAMESPACE_INFOW) : sizeof(WSANAMESPACE_INFOA);
711  /* Calculate ProviderName string size */
712  INT size1 = Entry->ProviderName ? wcslen(Entry->ProviderName) + 1 : 0;
713  INT size2 = Context->Unicode ? size1 * sizeof(WCHAR) : size1 * sizeof(CHAR);
715  /* Fill NS Provider data */
716  infoW.dwNameSpace = Entry->NamespaceId;
717  infoW.dwVersion = Entry->Version;
718  infoW.fActive = Entry->Enabled;
719  RtlMoveMemory(&infoW.NSProviderId,
720  &Entry->ProviderId,
721  sizeof(infoW.NSProviderId));
722  if (size2)
723  {
724  /* Calculate ProviderName string pointer */
725  infoW.lpszIdentifier = (LPWSTR)((ULONG_PTR)Context->ProtocolBuffer +
726  Context->BufferUsed + size);
727  }
728  else
729  {
730  infoW.lpszIdentifier = NULL;
731  }
732 
733  /* Check if we'll have space */
734  if ((Context->BufferUsed + size + size2) <=
735  (Context->BufferLength))
736  {
737  /* Copy the data */
738  RtlMoveMemory((PVOID)((ULONG_PTR)Context->ProtocolBuffer +
739  Context->BufferUsed),
740  &infoW,
741  size);
742  if (size2)
743  {
744  /* Entry->ProviderName is LPWSTR */
745  if (Context->Unicode)
746  {
747  RtlMoveMemory((PVOID)((ULONG_PTR)Context->ProtocolBuffer +
748  Context->BufferUsed + size),
749  Entry->ProviderName,
750  size2);
751  }
752  else
753  {
754  /* Call the conversion function */
756  0,
757  Entry->ProviderName,
758  -1,
759  (LPSTR)((ULONG_PTR)Context->ProtocolBuffer +
760  Context->BufferUsed + size),
761  size2,
762  NULL,
763  NULL);
764 
765  }
766  }
767 
768  /* Increase the count */
769  Context->Count++;
770  }
771 }
struct _WSANAMESPACE_INFOW WSANAMESPACE_INFOW
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:56
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
static const SecPkgInfoW infoW
Definition: kerberos.c:293
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
base of all file and directory entries
Definition: entries.h:82

Referenced by NSProvidersEnumerationProc().

◆ NSProvidersEnumerationProc()

BOOL WSAAPI NSProvidersEnumerationProc ( PVOID  EnumContext,
PNSCATALOG_ENTRY  Entry 
)

Definition at line 775 of file rnr.c.

777 {
779 
780  /* Calculate ProviderName string size */
781  INT size1 = Entry->ProviderName ? wcslen(Entry->ProviderName) + 1 : 0;
782  INT size2 = Context->Unicode ? size1 * sizeof(WCHAR) : size1 * sizeof(CHAR);
783 
784  /* Copy the information */
786  Context->BufferUsed += Context->Unicode ? (sizeof(WSANAMESPACE_INFOW)+size2) : (sizeof(WSANAMESPACE_INFOA)+size2);
787 
788  /* Continue enumeration */
789  return TRUE;
790 }
struct _WSANAMESPACE_INFOW WSANAMESPACE_INFOW
#define TRUE
Definition: types.h:120
char CHAR
Definition: xmlstorage.h:175
int32_t INT
Definition: typedefs.h:56
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct _NSPROVIDER_ENUM_CONTEXT * PNSPROVIDER_ENUM_CONTEXT
VOID WSAAPI NSProviderInfoFromContext(IN PNSCATALOG_ENTRY Entry, IN PNSPROVIDER_ENUM_CONTEXT Context)
Definition: rnr.c:707
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
base of all file and directory entries
Definition: entries.h:82
struct _WSANAMESPACE_INFOA WSANAMESPACE_INFOA

Referenced by WSAEnumNameSpaceProvidersInternal().

◆ WSAAddressToStringA()

INT WSAAPI WSAAddressToStringA ( IN LPSOCKADDR  lpsaAddress,
IN DWORD  dwAddressLength,
IN LPWSAPROTOCOL_INFOA  lpProtocolInfo,
OUT LPSTR  lpszAddressString,
IN OUT LPDWORD  lpdwAddressStringLength 
)

Definition at line 23 of file rnr.c.

28 {
33  PTCATALOG Catalog;
34  PTCATALOG_ENTRY CatalogEntry;
36  DWORD Length = *lpdwAddressStringLength;
37 
38  DPRINT("WSAAddressToStringA: %p\n", lpsaAddress);
39 
40  /* Enter prolog */
42  {
43  /* Leave now */
45  return SOCKET_ERROR;
46  }
47 
48  /* Allocate the unicode string */
50  if (!UnicodeString)
51  {
52  /* No memory; fail */
54  return SOCKET_ERROR;
55  }
56 
57  /* Get the catalog */
58  Catalog = WsProcGetTCatalog(Process);
59 
60  /* Check if we got custom protocol info */
61  if (lpProtocolInfo)
62  {
63  /* Get the entry ID */
64  CatalogEntryId = lpProtocolInfo->dwCatalogEntryId;
65 
66  /* Get the entry associated with it */
69  &CatalogEntry);
70  }
71  else
72  {
73  /* Get it from the address family */
74  ErrorCode = WsTcGetEntryFromAf(Catalog,
75  lpsaAddress->sa_family,
76  &CatalogEntry);
77  }
78 
79  /* Check for success */
80  if (ErrorCode == ERROR_SUCCESS)
81  {
82  /* Call the provider */
83  Status = CatalogEntry->Provider->Service.lpWSPAddressToString(lpsaAddress,
84  dwAddressLength,
85  &CatalogEntry->
86  ProtocolInfo,
88  lpdwAddressStringLength,
89  &ErrorCode);
90  if (Status == ERROR_SUCCESS)
91  {
92  /* Convert the string */
94  0,
96  -1,
97  lpszAddressString,
98  Length,
99  NULL,
100  NULL);
101  }
102 
103  /* Dereference the entry */
104  WsTcEntryDereference(CatalogEntry);
105 
106  /* Free the unicode string */
108 
109  /* Check for success and return */
110  if (Status == ERROR_SUCCESS) return ERROR_SUCCESS;
111  }
112  else
113  {
114  /* Free the unicode string */
116  }
117 
118  /* Set the error and return */
120  return SOCKET_ERROR;
121 }
#define SOCKET_ERROR
Definition: winsock.h:333
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
Definition: ws2_32p.h:85
DWORD CatalogEntryId
Definition: dllmain.c:21
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
DWORD WSAAPI WsTcGetEntryFromCatalogEntryId(IN PTCATALOG TCatalog, IN DWORD CatalogEntryId, IN PTCATALOG_ENTRY *CatalogEntry)
Definition: dcatalog.c:434
PTPROVIDER Provider
Definition: ws2_32p.h:89
int32_t INT
Definition: typedefs.h:56
WSPPROC_TABLE Service
Definition: ws2_32p.h:80
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
VOID WSAAPI WsTcEntryDereference(IN PTCATALOG_ENTRY CatalogEntry)
Definition: dcatitem.c:51
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define SetLastError(x)
Definition: compat.h:417
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
INT WSAAPI WsApiProlog(OUT PWSPROCESS *Process, OUT PWSTHREAD *Thread)
Definition: wsautil.c:91
LPWSPADDRESSTOSTRING lpWSPAddressToString
Definition: ws2spi.h:462
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
WCHAR * LPWSTR
Definition: xmlstorage.h:184
HANDLE WsSockHeap
Definition: dllmain.c:21
#define WSAENOBUFS
Definition: winerror.h:1968
#define HeapFree(x, y, z)
Definition: compat.h:402
DWORD WSAAPI WsTcGetEntryFromAf(IN PTCATALOG TCatalog, IN INT AddressFamily, IN PTCATALOG_ENTRY *CatalogEntry)
Definition: dcatalog.c:382
PTCATALOG WSAAPI WsProcGetTCatalog(IN PWSPROCESS Process)
Definition: dprocess.c:150

Referenced by START_TEST(), and test_WSAAddressToStringA().

◆ WSAAddressToStringW()

INT WSAAPI WSAAddressToStringW ( IN LPSOCKADDR  lpsaAddress,
IN DWORD  dwAddressLength,
IN LPWSAPROTOCOL_INFOW  lpProtocolInfo,
OUT LPWSTR  lpszAddressString,
IN OUT LPDWORD  lpdwAddressStringLength 
)

Definition at line 128 of file rnr.c.

133 {
138  PTCATALOG Catalog;
139  PTCATALOG_ENTRY CatalogEntry;
140 
141  DPRINT("WSAAddressToStringW: %p\n", lpsaAddress);
142 
143  /* Enter prolog */
145  {
146  /* Leave now */
148  return SOCKET_ERROR;
149  }
150 
151  /* Get the catalog */
152  Catalog = WsProcGetTCatalog(Process);
153 
154  /* Check if we got custom protocol info */
155  if (lpProtocolInfo)
156  {
157  /* Get the entry ID */
158  CatalogEntryId = lpProtocolInfo->dwCatalogEntryId;
159 
160  /* Get the entry associated with it */
163  &CatalogEntry);
164  }
165  else
166  {
167  /* Get it from the address family */
168  ErrorCode = WsTcGetEntryFromAf(Catalog,
169  lpsaAddress->sa_family,
170  &CatalogEntry);
171  }
172 
173  /* Check for success */
174  if (ErrorCode == ERROR_SUCCESS)
175  {
176  /* Call the provider */
177  Status = CatalogEntry->Provider->Service.lpWSPAddressToString(lpsaAddress,
178  dwAddressLength,
179  &CatalogEntry->
180  ProtocolInfo,
181  lpszAddressString,
182  lpdwAddressStringLength,
183  &ErrorCode);
184 
185  /* Dereference the entry */
186  WsTcEntryDereference(CatalogEntry);
187 
188  /* Check for success and return */
189  if (Status == ERROR_SUCCESS) return ERROR_SUCCESS;
190  }
191 
192  /* Set the error and return */
194  return SOCKET_ERROR;
195 }
#define SOCKET_ERROR
Definition: winsock.h:333
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
Definition: ws2_32p.h:85
DWORD CatalogEntryId
Definition: dllmain.c:21
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WSAAPI WsTcGetEntryFromCatalogEntryId(IN PTCATALOG TCatalog, IN DWORD CatalogEntryId, IN PTCATALOG_ENTRY *CatalogEntry)
Definition: dcatalog.c:434
PTPROVIDER Provider
Definition: ws2_32p.h:89
int32_t INT
Definition: typedefs.h:56
WSPPROC_TABLE Service
Definition: ws2_32p.h:80
void DPRINT(...)
Definition: polytest.cpp:61
VOID WSAAPI WsTcEntryDereference(IN PTCATALOG_ENTRY CatalogEntry)
Definition: dcatitem.c:51
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define SetLastError(x)
Definition: compat.h:417
INT WSAAPI WsApiProlog(OUT PWSPROCESS *Process, OUT PWSTHREAD *Thread)
Definition: wsautil.c:91
LPWSPADDRESSTOSTRING lpWSPAddressToString
Definition: ws2spi.h:462
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
DWORD WSAAPI WsTcGetEntryFromAf(IN PTCATALOG TCatalog, IN INT AddressFamily, IN PTCATALOG_ENTRY *CatalogEntry)
Definition: dcatalog.c:382
PTCATALOG WSAAPI WsProcGetTCatalog(IN PWSPROCESS Process)
Definition: dprocess.c:150

Referenced by AllSysInfo(), get_defaultipgateway(), get_dnsserversearchorder(), get_ipaddress(), get_ipsubnet(), GetNameInfoW(), test_WSAAddressToStringW(), and wmain().

◆ WSAEnumNameSpaceProvidersA()

INT WSAAPI WSAEnumNameSpaceProvidersA ( IN OUT LPDWORD  lpdwBufferLength,
OUT LPWSANAMESPACE_INFOA  lpnspBuffer 
)

Definition at line 859 of file rnr.c.

861 {
862  DPRINT("WSAEnumNameSpaceProvidersA: %lx\n", lpnspBuffer);
864 }
void DPRINT(...)
Definition: polytest.cpp:61
INT WSAAPI WSAEnumNameSpaceProvidersInternal(IN OUT LPDWORD lpdwBufferLength, OUT LPWSANAMESPACE_INFOA lpnspBuffer, BOOLEAN Unicode)
Definition: rnr.c:794
_In_ _In_opt_ _Out_writes_bytes_to_opt_ lpdwBufferLength _Inout_ LPDWORD lpdwBufferLength
Definition: winhttp.h:675

◆ WSAEnumNameSpaceProvidersInternal()

INT WSAAPI WSAEnumNameSpaceProvidersInternal ( IN OUT LPDWORD  lpdwBufferLength,
OUT LPWSANAMESPACE_INFOA  lpnspBuffer,
BOOLEAN  Unicode 
)

Definition at line 794 of file rnr.c.

796 {
797  INT Status;
798  PWSPROCESS WsProcess;
799  PNSCATALOG Catalog;
801 
802  DPRINT("WSAEnumNameSpaceProvidersInternal: %lx\n", lpnspBuffer);
803 
804  if (!lpdwBufferLength)
805  {
807  return SOCKET_ERROR;
808  }
809  WsProcess = WsGetProcess();
810  /* Create a catalog object from the current one */
811  Catalog = WsProcGetNsCatalog(WsProcess);
812  if (!Catalog)
813  {
814  /* Fail if we couldn't */
816  return SOCKET_ERROR;
817  }
818 
819  Context.ProtocolBuffer = lpnspBuffer;
820  Context.BufferLength = lpnspBuffer ? *lpdwBufferLength : 0;
821  Context.BufferUsed = 0;
822  Context.Count = 0;
823  Context.Unicode = Unicode;
824  Context.ErrorCode = ERROR_SUCCESS;
825 
827 
828  /* Get status */
829  Status = Context.Count;
830 
831  /* Check the error code */
832  if (Context.ErrorCode == ERROR_SUCCESS)
833  {
834  /* Check if enough space was available */
835  if (Context.BufferLength < Context.BufferUsed)
836  {
837  /* Fail and tell them how much we need */
838  *lpdwBufferLength = Context.BufferUsed;
841  }
842  }
843  else
844  {
845  /* Failure, normalize error */
847  WSASetLastError(Context.ErrorCode);
848  }
849 
850  /* Return */
851  return Status;
852 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define WSAEFAULT
Definition: winerror.h:1945
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WSAAPI NSProvidersEnumerationProc(PVOID EnumContext, PNSCATALOG_ENTRY Entry)
Definition: rnr.c:775
int32_t INT
Definition: typedefs.h:56
FORCEINLINE PWSPROCESS WsGetProcess(VOID)
Definition: ws2_32p.h:885
void DPRINT(...)
Definition: polytest.cpp:61
VOID WSAAPI WSASetLastError(IN INT iError)
Definition: dllmain.c:123
#define WSA_NOT_ENOUGH_MEMORY
Definition: winsock2.h:593
VOID WSAAPI WsNcEnumerateCatalogItems(IN PNSCATALOG Catalog, IN PNSCATALOG_ENUMERATE_PROC Callback, IN PVOID Context)
Definition: nscatalo.c:350
Status
Definition: gdiplustypes.h:24
PNSCATALOG WSAAPI WsProcGetNsCatalog(IN PWSPROCESS Process)
Definition: dprocess.c:166
struct tagContext Context
Definition: acpixf.h:1030
_In_ _In_opt_ _Out_writes_bytes_to_opt_ lpdwBufferLength _Inout_ LPDWORD lpdwBufferLength
Definition: winhttp.h:675

Referenced by WSAEnumNameSpaceProvidersA(), and WSAEnumNameSpaceProvidersW().

◆ WSAEnumNameSpaceProvidersW()

INT WSAAPI WSAEnumNameSpaceProvidersW ( IN OUT LPDWORD  lpdwBufferLength,
OUT LPWSANAMESPACE_INFOW  lpnspBuffer 
)

Definition at line 871 of file rnr.c.

873 {
874  DPRINT("WSAEnumNameSpaceProvidersW: %lx\n", lpnspBuffer);
876 }
#define TRUE
Definition: types.h:120
void DPRINT(...)
Definition: polytest.cpp:61
INT WSAAPI WSAEnumNameSpaceProvidersInternal(IN OUT LPDWORD lpdwBufferLength, OUT LPWSANAMESPACE_INFOA lpnspBuffer, BOOLEAN Unicode)
Definition: rnr.c:794
_In_ _In_opt_ _Out_writes_bytes_to_opt_ lpdwBufferLength _Inout_ LPDWORD lpdwBufferLength
Definition: winhttp.h:675

◆ WSAGetServiceClassInfoA()

INT WSAAPI WSAGetServiceClassInfoA ( IN LPGUID  lpProviderId,
IN LPGUID  lpServiceClassId,
IN OUT LPDWORD  lpdwBufferLength,
OUT LPWSASERVICECLASSINFOA  lpServiceClassInfo 
)

Definition at line 628 of file rnr.c.

632 {
633  DPRINT("WSAGetServiceClassInfoA: %lx\n", lpProviderId);
635  return SOCKET_ERROR;
636 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define WSAEINVAL
Definition: winerror.h:1946
void DPRINT(...)
Definition: polytest.cpp:61
#define SetLastError(x)
Definition: compat.h:417

◆ WSAGetServiceClassInfoW()

INT WSAAPI WSAGetServiceClassInfoW ( IN LPGUID  lpProviderId,
IN LPGUID  lpServiceClassId,
IN OUT LPDWORD  lpdwBufferLength,
OUT LPWSASERVICECLASSINFOW  lpServiceClassInfo 
)

Definition at line 643 of file rnr.c.

647 {
648  DPRINT("WSAGetServiceClassInfoW: %lx\n", lpProviderId);
650  return SOCKET_ERROR;
651 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define WSAEINVAL
Definition: winerror.h:1946
void DPRINT(...)
Definition: polytest.cpp:61
#define SetLastError(x)
Definition: compat.h:417

◆ WSAGetServiceClassNameByClassIdA()

INT WSAAPI WSAGetServiceClassNameByClassIdA ( IN LPGUID  lpServiceClassId,
OUT LPSTR  lpszServiceClassName,
IN OUT LPDWORD  lpdwBufferLength 
)

Definition at line 658 of file rnr.c.

661 {
662  DPRINT("WSAGetServiceClassNameByClassIdA: %lx\n", lpServiceClassId);
664  return SOCKET_ERROR;
665 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define WSAEINVAL
Definition: winerror.h:1946
void DPRINT(...)
Definition: polytest.cpp:61
#define SetLastError(x)
Definition: compat.h:417

◆ WSAGetServiceClassNameByClassIdW()

INT WSAAPI WSAGetServiceClassNameByClassIdW ( IN LPGUID  lpServiceClassId,
OUT LPWSTR  lpszServiceClassName,
IN OUT LPDWORD  lpdwBufferLength 
)

Definition at line 672 of file rnr.c.

675 {
676  DPRINT("WSAGetServiceClassNameByClassIdW: %lx\n", lpServiceClassId);
678  return SOCKET_ERROR;
679 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define WSAEINVAL
Definition: winerror.h:1946
void DPRINT(...)
Definition: polytest.cpp:61
#define SetLastError(x)
Definition: compat.h:417

◆ WSAInstallServiceClassA()

INT WSAAPI WSAInstallServiceClassA ( IN LPWSASERVICECLASSINFOA  lpServiceClassInfo)

Definition at line 686 of file rnr.c.

687 {
688  DPRINT("WSAInstallServiceClassA: %lx\n", lpServiceClassInfo);
690  return SOCKET_ERROR;
691 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define WSAEINVAL
Definition: winerror.h:1946
void DPRINT(...)
Definition: polytest.cpp:61
#define SetLastError(x)
Definition: compat.h:417

◆ WSAInstallServiceClassW()

INT WSAAPI WSAInstallServiceClassW ( IN LPWSASERVICECLASSINFOW  lpServiceClassInfo)

Definition at line 698 of file rnr.c.

699 {
700  DPRINT("WSAInstallServiceClassW: %lx\n", lpServiceClassInfo);
702  return SOCKET_ERROR;
703 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define WSAEINVAL
Definition: winerror.h:1946
void DPRINT(...)
Definition: polytest.cpp:61
#define SetLastError(x)
Definition: compat.h:417

◆ WSALookupServiceBeginA()

INT WSAAPI WSALookupServiceBeginA ( IN LPWSAQUERYSETA  lpqsRestrictions,
IN DWORD  dwControlFlags,
OUT LPHANDLE  lphLookup 
)

Definition at line 245 of file rnr.c.

248 {
249  INT ErrorCode;
250  LPWSAQUERYSETW UnicodeQuerySet = NULL;
251  SIZE_T UnicodeQuerySetSize = 0;
252 
253  DPRINT("WSALookupServiceBeginA: %p\n", lpqsRestrictions);
254 
255  /* Verify pointer */
256  if (IsBadReadPtr(lpqsRestrictions, sizeof(*lpqsRestrictions)) ||
257  IsBadReadPtr(lpqsRestrictions->lpServiceClassId, sizeof(*lpqsRestrictions->lpServiceClassId)))
258  {
259  /* Invalid */
261  return SOCKET_ERROR;
262  }
263 
264  /* Clear the reserved fields */
265  lpqsRestrictions->dwOutputFlags = 0;
266  lpqsRestrictions->lpszComment = NULL;
267  lpqsRestrictions->dwNumberOfCsAddrs = 0;
268 
269  /* Find out the side we'll need */
270  ErrorCode = MapAnsiQuerySetToUnicode(lpqsRestrictions,
271  &UnicodeQuerySetSize,
272  UnicodeQuerySet);
273 
274  /* We should've failed */
275  if (ErrorCode == WSAEFAULT)
276  {
277  /* Allocate the buffer we'll need */
278  UnicodeQuerySet = HeapAlloc(WsSockHeap, 0, UnicodeQuerySetSize);
279  if (UnicodeQuerySet)
280  {
281  /* Do the conversion for real */
282  ErrorCode = MapAnsiQuerySetToUnicode(lpqsRestrictions,
283  &UnicodeQuerySetSize,
284  UnicodeQuerySet);
285  if (ErrorCode == ERROR_SUCCESS)
286  {
287  /* Now call the Unicode function */
288  ErrorCode = WSALookupServiceBeginW(UnicodeQuerySet,
289  dwControlFlags,
290  lphLookup);
291  }
292 
293  /* Free our buffer */
294  HeapFree(WsSockHeap, 0, UnicodeQuerySet);
295  }
296  else
297  {
298  /* No memory to allocate */
300  }
301  }
302 
303  /* Set the error in case of failure */
304  if (ErrorCode != ERROR_SUCCESS)
306 
307  /* Return to caller */
309 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define WSAEFAULT
Definition: winerror.h:1945
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define ERROR_SUCCESS
Definition: deptool.c:10
static LPWSAQUERYSETW
Definition: sock.c:91
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
INT WSAAPI MapAnsiQuerySetToUnicode(IN LPWSAQUERYSETA AnsiSet, IN OUT PSIZE_T SetSize, OUT LPWSAQUERYSETW UnicodeSet)
Definition: qshelpr.c:808
void DPRINT(...)
Definition: polytest.cpp:61
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define SetLastError(x)
Definition: compat.h:417
ULONG_PTR SIZE_T
Definition: typedefs.h:78
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:807
INT WINAPI WSALookupServiceBeginW(IN LPWSAQUERYSETW lpqsRestrictions, IN DWORD dwControlFlags, OUT LPHANDLE lphLookup)
Definition: rnr.c:316
HANDLE WsSockHeap
Definition: dllmain.c:21
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by getxyDataEnt().

◆ WSALookupServiceBeginW()

INT WINAPI WSALookupServiceBeginW ( IN LPWSAQUERYSETW  lpqsRestrictions,
IN DWORD  dwControlFlags,
OUT LPHANDLE  lphLookup 
)

Definition at line 316 of file rnr.c.

319 {
322  INT ErrorCode;
323  PNSQUERY Query;
324 
325  DPRINT("WSALookupServiceBeginW: %p\n", lpqsRestrictions);
326 
327  /* Enter prolog */
329  {
330  /* Leave now */
332  return SOCKET_ERROR;
333  }
334 
335  /* Verify pointers */
336  if (IsBadWritePtr(lphLookup, sizeof(*lphLookup)) ||
337  IsBadReadPtr(lpqsRestrictions, sizeof(*lpqsRestrictions)) ||
338  IsBadReadPtr(lpqsRestrictions->lpServiceClassId, sizeof(*lpqsRestrictions->lpServiceClassId)))
339  {
340  /* They are invalid; fail */
342  return SOCKET_ERROR;
343  }
344 
345  /* Create a new query object */
346  if ((Query = WsNqAllocate()))
347  {
348  /* Initialize it */
350 
351  /* Do the lookup */
353  lpqsRestrictions,
354  dwControlFlags,
356 
357  /* Check for success */
358  if (ErrorCode == ERROR_SUCCESS)
359  {
360  /* Return the handle */
361  *lphLookup = Query;
362  }
363  else
364  {
365  /* Fail */
366  *lphLookup = NULL;
367  WsNqDelete(Query);
368  }
369  }
370  else
371  {
372  /* No memory */
375  }
376 
377  /* Return */
378  return ErrorCode;
379 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define WSAEFAULT
Definition: winerror.h:1945
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
BOOL NTAPI IsBadWritePtr(IN LPVOID lp, IN UINT_PTR ucb)
Definition: except.c:885
#define ERROR_SUCCESS
Definition: deptool.c:10
VOID WSAAPI WsNqDelete(IN PNSQUERY NsQuery)
Definition: nsquery.c:74
int32_t INT
Definition: typedefs.h:56
DWORD WSAAPI WsNqInitialize(IN PNSQUERY NsQuery)
Definition: nsquery.c:42
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
PNSQUERY WSAAPI WsNqAllocate(VOID)
Definition: nsquery.c:22
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define SetLastError(x)
Definition: compat.h:417
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
Definition: query.c:292
INT WSAAPI WsApiProlog(OUT PWSPROCESS *Process, OUT PWSTHREAD *Thread)
Definition: wsautil.c:91
PNSCATALOG WSAAPI WsProcGetNsCatalog(IN PWSPROCESS Process)
Definition: dprocess.c:166
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:807
DWORD WSAAPI WsNqLookupServiceBegin(IN PNSQUERY NsQuery, IN LPWSAQUERYSETW QuerySet, IN DWORD ControlFlags, IN PNSCATALOG Catalog)
Definition: nsquery.c:347
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
#define WSAENOBUFS
Definition: winerror.h:1968

Referenced by LookupNodeByAddr(), and WSALookupServiceBeginA().

◆ WSALookupServiceEnd()

INT WSAAPI WSALookupServiceEnd ( IN HANDLE  hLookup)

Definition at line 202 of file rnr.c.

203 {
206  INT ErrorCode;
207  PNSQUERY Query = hLookup;
208 
209  DPRINT("WSALookupServiceEnd: %lx\n", hLookup);
210 
211  /* Enter prolog */
213  {
214  /* Leave now */
216  return SOCKET_ERROR;
217  }
218 
219  /* Check for a valid handle, then validate and reference it */
221  {
222  /* Fail */
224  return SOCKET_ERROR;
225  }
226 
227  /* Do the lookup */
229 
230  /* Remove the validation reference */
232 
233  /* Remove the keep-alive */
235 
236  /* Return */
237  return ERROR_SUCCESS;
238 }
#define SOCKET_ERROR
Definition: winsock.h:333
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define ERROR_SUCCESS
Definition: deptool.c:10
int32_t INT
Definition: typedefs.h:56
VOID WSAAPI WsNqDereference(IN PNSQUERY Query)
Definition: nsquery.c:105
DWORD WSAAPI WsNqLookupServiceEnd(IN PNSQUERY NsQuery)
Definition: nsquery.c:164
void DPRINT(...)
Definition: polytest.cpp:61
BOOL WSAAPI WsNqValidateAndReference(IN PNSQUERY Query)
Definition: nsquery.c:57
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define SetLastError(x)
Definition: compat.h:417
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
Definition: query.c:292
INT WSAAPI WsApiProlog(OUT PWSPROCESS *Process, OUT PWSTHREAD *Thread)
Definition: wsautil.c:91
#define WSA_INVALID_HANDLE
Definition: winsock2.h:591
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:807
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219

Referenced by getxyDataEnt(), and LookupNodeByAddr().

◆ WSALookupServiceNextA()

INT WSAAPI WSALookupServiceNextA ( IN HANDLE  hLookup,
IN DWORD  dwControlFlags,
IN OUT LPDWORD  lpdwBufferLength,
OUT LPWSAQUERYSETA  lpqsResults 
)

Definition at line 444 of file rnr.c.

448 {
449  LPWSAQUERYSETW UnicodeQuerySet;
450  DWORD UnicodeQuerySetSize;
451  INT ErrorCode;
452 
453  DPRINT("WSALookupServiceNextA: %lx\n", hLookup);
454 
455  /*
456  * Verify pointers. Note that the size of the buffer
457  * pointed by lpqsResults is given by *lpdwBufferLength.
458  */
460  IsBadWritePtr(lpqsResults, *lpdwBufferLength))
461  {
462  /* It is invalid; fail */
464  return SOCKET_ERROR;
465  }
466 
467  UnicodeQuerySetSize = *lpdwBufferLength;
468 
469  /* Check how much the user is giving */
470  if (UnicodeQuerySetSize >= sizeof(WSAQUERYSETW))
471  {
472  /* Allocate the buffer we'll use */
473  UnicodeQuerySet = HeapAlloc(WsSockHeap, 0, UnicodeQuerySetSize);
474  if (!UnicodeQuerySet)
475  {
476  /*
477  * We failed, possibly because the specified size was too large?
478  * Retrieve the needed buffer size with the WSALookupServiceNextW
479  * call and retry again a second time.
480  */
481  UnicodeQuerySetSize = 0;
482  }
483  }
484  else
485  {
486  /*
487  * The buffer is too small. Retrieve the needed buffer size with
488  * the WSALookupServiceNextW call and return it to the caller.
489  */
490  UnicodeQuerySet = NULL;
491  UnicodeQuerySetSize = 0;
492  }
493 
494  /* Call the Unicode Function */
496  dwControlFlags,
497  &UnicodeQuerySetSize,
498  UnicodeQuerySet);
499 
500  /*
501  * Check whether we actually just retrieved the needed buffer size
502  * because our previous local allocation did fail. If so, allocate
503  * a new buffer and retry again.
504  */
505  if ( (!UnicodeQuerySet) && (*lpdwBufferLength >= sizeof(WSAQUERYSETW)) &&
507  {
508  /* Allocate the buffer we'll use */
509  UnicodeQuerySet = HeapAlloc(WsSockHeap, 0, UnicodeQuerySetSize);
510  if (UnicodeQuerySet)
511  {
512  /* Call the Unicode Function */
514  dwControlFlags,
515  &UnicodeQuerySetSize,
516  UnicodeQuerySet);
517  }
518  /*
519  * Otherwise the allocation failed and we
520  * fall back into the error checks below.
521  */
522  }
523 
524  if (ErrorCode == ERROR_SUCCESS)
525  {
526  SIZE_T SetSize = *lpdwBufferLength;
527 
528  /* Now convert back to ANSI */
529  ErrorCode = MapUnicodeQuerySetToAnsi(UnicodeQuerySet,
530  &SetSize,
531  lpqsResults);
532  if (ErrorCode != ERROR_SUCCESS)
533  {
535  }
536  else if (SetSize > MAXDWORD)
537  {
540  }
541  else
542  {
543  *lpdwBufferLength = SetSize;
544  }
545  }
546  else
547  {
548  /* Check if we ran out of space */
549  if (GetLastError() == WSAEFAULT)
550  {
551  /* Return how much space we'll need, including padding */
552  *lpdwBufferLength = UnicodeQuerySetSize +
553  ((sizeof(ULONG) * 6) - (6 * 1));
554  }
555  }
556 
557  /* If we had a local buffer, free it */
558  if (UnicodeQuerySet)
559  HeapFree(WsSockHeap, 0, UnicodeQuerySet);
560 
561  /* Return to caller */
563 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define WSAEFAULT
Definition: winerror.h:1945
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
BOOL NTAPI IsBadWritePtr(IN LPVOID lp, IN UINT_PTR ucb)
Definition: except.c:885
#define ERROR_SUCCESS
Definition: deptool.c:10
static LPWSAQUERYSETW
Definition: sock.c:91
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int32_t INT
Definition: typedefs.h:56
INT WSAAPI MapUnicodeQuerySetToAnsi(IN LPWSAQUERYSETW UnicodeSet, IN OUT PSIZE_T SetSize, OUT LPWSAQUERYSETA AnsiSet)
Definition: qshelpr.c:929
smooth NULL
Definition: ftsmooth.c:416
#define MAXDWORD
void DPRINT(...)
Definition: polytest.cpp:61
#define ERROR_ARITHMETIC_OVERFLOW
Definition: winerror.h:351
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
INT WINAPI WSALookupServiceNextW(IN HANDLE hLookup, IN DWORD dwControlFlags, IN OUT LPDWORD lpdwBufferLength, OUT LPWSAQUERYSETW lpqsResults)
Definition: rnr.c:386
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
WSAQUERYSETW
Definition: winsock2.h:836
ULONG_PTR SIZE_T
Definition: typedefs.h:78
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:807
unsigned int ULONG
Definition: retypes.h:1
_In_ _In_opt_ _Out_writes_bytes_to_opt_ lpdwBufferLength _Inout_ LPDWORD lpdwBufferLength
Definition: winhttp.h:675
HANDLE WsSockHeap
Definition: dllmain.c:21
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by getxyDataEnt().

◆ WSALookupServiceNextW()

INT WINAPI WSALookupServiceNextW ( IN HANDLE  hLookup,
IN DWORD  dwControlFlags,
IN OUT LPDWORD  lpdwBufferLength,
OUT LPWSAQUERYSETW  lpqsResults 
)

Definition at line 386 of file rnr.c.

390 {
393  INT ErrorCode;
394  PNSQUERY Query = hLookup;
395 
396  DPRINT("WSALookupServiceNextW: %lx\n", hLookup);
397 
398  /* Enter prolog */
400  {
401  /* Leave now */
403  return SOCKET_ERROR;
404  }
405 
406  /*
407  * Verify pointers. Note that the size of the buffer
408  * pointed by lpqsResults is given by *lpdwBufferLength.
409  */
411  IsBadWritePtr(lpqsResults, *lpdwBufferLength))
412  {
413  /* It is invalid; fail */
415  return SOCKET_ERROR;
416  }
417 
418  /* Check for a valid handle, then validate and reference it */
420  {
421  /* Fail */
423  return SOCKET_ERROR;
424  }
425 
426  /* Do the lookup */
428  dwControlFlags,
430  lpqsResults);
431 
432  /* Remove the validation reference */
434 
435  /* Return */
436  return ErrorCode;
437 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define WSAEFAULT
Definition: winerror.h:1945
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
BOOL NTAPI IsBadWritePtr(IN LPVOID lp, IN UINT_PTR ucb)
Definition: except.c:885
#define ERROR_SUCCESS
Definition: deptool.c:10
int32_t INT
Definition: typedefs.h:56
VOID WSAAPI WsNqDereference(IN PNSQUERY Query)
Definition: nsquery.c:105
void DPRINT(...)
Definition: polytest.cpp:61
DWORD WSAAPI WsNqLookupServiceNext(PNSQUERY NsQuery, DWORD, PDWORD, OUT LPWSAQUERYSETW QuerySet)
BOOL WSAAPI WsNqValidateAndReference(IN PNSQUERY Query)
Definition: nsquery.c:57
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define SetLastError(x)
Definition: compat.h:417
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
Definition: query.c:292
INT WSAAPI WsApiProlog(OUT PWSPROCESS *Process, OUT PWSTHREAD *Thread)
Definition: wsautil.c:91
#define WSA_INVALID_HANDLE
Definition: winsock2.h:591
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:807
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
_In_ _In_opt_ _Out_writes_bytes_to_opt_ lpdwBufferLength _Inout_ LPDWORD lpdwBufferLength
Definition: winhttp.h:675

Referenced by LookupNodeByAddr(), and WSALookupServiceNextA().

◆ WSANSPIoctl()

INT WSPAPI WSANSPIoctl ( HANDLE  hLookup,
DWORD  dwControlCode,
LPVOID  lpvInBuffer,
DWORD  cbInBuffer,
LPVOID  lpvOutBuffer,
DWORD  cbOutBuffer,
LPDWORD  lpcbBytesReturned,
LPWSACOMPLETION  lpCompletion 
)

Definition at line 570 of file rnr.c.

578 {
579  DPRINT("WSANSPIoctl: %lx\n", hLookup);
580  return 0;
581 }
void DPRINT(...)
Definition: polytest.cpp:61

◆ WSARemoveServiceClass()

INT WSAAPI WSARemoveServiceClass ( IN LPGUID  lpServiceClassId)

Definition at line 588 of file rnr.c.

589 {
590  DPRINT("WSARemoveServiceClass: %lx\n", lpServiceClassId);
592  return SOCKET_ERROR;
593 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define WSAEINVAL
Definition: winerror.h:1946
void DPRINT(...)
Definition: polytest.cpp:61
#define SetLastError(x)
Definition: compat.h:417

◆ WSASetServiceA()

INT WSAAPI WSASetServiceA ( IN LPWSAQUERYSETA  lpqsRegInfo,
IN WSAESETSERVICEOP  essOperation,
IN DWORD  dwControlFlags 
)

Definition at line 600 of file rnr.c.

603 {
604  DPRINT("WSASetServiceA: %lx\n", lpqsRegInfo);
606  return SOCKET_ERROR;
607 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define WSAEINVAL
Definition: winerror.h:1946
void DPRINT(...)
Definition: polytest.cpp:61
#define SetLastError(x)
Definition: compat.h:417

◆ WSASetServiceW()

INT WSAAPI WSASetServiceW ( IN LPWSAQUERYSETW  lpqsRegInfo,
IN WSAESETSERVICEOP  essOperation,
IN DWORD  dwControlFlags 
)

Definition at line 614 of file rnr.c.

617 {
618  DPRINT("WSASetServiceW: %lx\n", lpqsRegInfo);
620  return SOCKET_ERROR;
621 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define WSAEINVAL
Definition: winerror.h:1946
void DPRINT(...)
Definition: polytest.cpp:61
#define SetLastError(x)
Definition: compat.h:417

◆ WSAStringToAddressA()

INT WSAAPI WSAStringToAddressA ( IN LPSTR  AddressString,
IN INT  AddressFamily,
IN LPWSAPROTOCOL_INFOA  lpProtocolInfo,
OUT LPSOCKADDR  lpAddress,
IN OUT LPINT  lpAddressLength 
)

Definition at line 883 of file rnr.c.

888 {
893  PTCATALOG Catalog;
894  PTCATALOG_ENTRY CatalogEntry;
896  DWORD Length = (DWORD)strlen(AddressString) + 1;
897 
898  DPRINT("WSAStringToAddressA: %s\n", AddressString);
899 
900  /* Enter prolog */
902  {
903  /* Leave now */
905  return SOCKET_ERROR;
906  }
907 
908  /* Allocate the unicode string */
910  if (!UnicodeString)
911  {
912  /* No memory; fail */
914  return SOCKET_ERROR;
915  }
916 
917  /* Convert the string */
918  MultiByteToWideChar(CP_ACP, 0, AddressString, -1, UnicodeString, Length);
919 
920  /* Get the catalog */
921  Catalog = WsProcGetTCatalog(Process);
922 
923  /* Check if we got custom protocol info */
924  if (lpProtocolInfo)
925  {
926  /* Get the entry ID */
927  CatalogEntryId = lpProtocolInfo->dwCatalogEntryId;
928 
929  /* Get the entry associated with it */
932  &CatalogEntry);
933  }
934  else
935  {
936  /* Get it from the address family */
937  ErrorCode = WsTcGetEntryFromAf(Catalog, AddressFamily, &CatalogEntry);
938  }
939 
940  /* Check for success */
941  if (ErrorCode == ERROR_SUCCESS)
942  {
943  /* Call the provider */
946  &CatalogEntry->
947  ProtocolInfo,
948  lpAddress,
949  lpAddressLength,
950  &ErrorCode);
951 
952  /* Dereference the entry */
953  WsTcEntryDereference(CatalogEntry);
954 
955  /* Free the unicode string */
957 
958  /* Check for success and return */
959  if (Status == ERROR_SUCCESS) return ERROR_SUCCESS;
960  }
961  else
962  {
963  /* Free the unicode string */
965  }
966 
967  /* Set the error and return */
969  return SOCKET_ERROR;
970 }
#define SOCKET_ERROR
Definition: winsock.h:333
IN PCO_ADDRESS_FAMILY AddressFamily
Definition: ndis.h:1906
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
Definition: ws2_32p.h:85
DWORD CatalogEntryId
Definition: dllmain.c:21
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
#define ERROR_SUCCESS
Definition: deptool.c:10
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CP_ACP
Definition: compat.h:99
DWORD WSAAPI WsTcGetEntryFromCatalogEntryId(IN PTCATALOG TCatalog, IN DWORD CatalogEntryId, IN PTCATALOG_ENTRY *CatalogEntry)
Definition: dcatalog.c:434
PTPROVIDER Provider
Definition: ws2_32p.h:89
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:56
WSPPROC_TABLE Service
Definition: ws2_32p.h:80
void DPRINT(...)
Definition: polytest.cpp:61
VOID WSAAPI WsTcEntryDereference(IN PTCATALOG_ENTRY CatalogEntry)
Definition: dcatitem.c:51
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define SetLastError(x)
Definition: compat.h:417
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
INT WSAAPI WsApiProlog(OUT PWSPROCESS *Process, OUT PWSTHREAD *Thread)
Definition: wsautil.c:91
LPWSPSTRINGTOADDRESS lpWSPStringToAddress
Definition: ws2spi.h:490
Status
Definition: gdiplustypes.h:24
#define MultiByteToWideChar
Definition: compat.h:100
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
WCHAR * LPWSTR
Definition: xmlstorage.h:184
HANDLE WsSockHeap
Definition: dllmain.c:21
#define WSAENOBUFS
Definition: winerror.h:1968
#define HeapFree(x, y, z)
Definition: compat.h:402
DWORD WSAAPI WsTcGetEntryFromAf(IN PTCATALOG TCatalog, IN INT AddressFamily, IN PTCATALOG_ENTRY *CatalogEntry)
Definition: dcatalog.c:382
PTCATALOG WSAAPI WsProcGetTCatalog(IN PWSPROCESS Process)
Definition: dprocess.c:150

Referenced by test_WSAStringToAddressA().

◆ WSAStringToAddressW()

INT WSAAPI WSAStringToAddressW ( IN LPWSTR  AddressString,
IN INT  AddressFamily,
IN LPWSAPROTOCOL_INFOW  lpProtocolInfo,
OUT LPSOCKADDR  lpAddress,
IN OUT LPINT  lpAddressLength 
)

Definition at line 977 of file rnr.c.

982 {
987  PTCATALOG Catalog;
988  PTCATALOG_ENTRY CatalogEntry;
989 
990  DPRINT("WSAStringToAddressW: %S\n", AddressString);
991 
992  /* Enter prolog */
994  {
995  /* Leave now */
997  return SOCKET_ERROR;
998  }
999 
1000  /* Get the catalog */
1001  Catalog = WsProcGetTCatalog(Process);
1002 
1003  /* Check if we got custom protocol info */
1004  if (lpProtocolInfo)
1005  {
1006  /* Get the entry ID */
1007  CatalogEntryId = lpProtocolInfo->dwCatalogEntryId;
1008 
1009  /* Get the entry associated with it */
1012  &CatalogEntry);
1013  }
1014  else
1015  {
1016  /* Get it from the address family */
1017  ErrorCode = WsTcGetEntryFromAf(Catalog, AddressFamily, &CatalogEntry);
1018  }
1019 
1020  /* Check for success */
1021  if (ErrorCode == ERROR_SUCCESS)
1022  {
1023  /* Call the provider */
1024  Status = CatalogEntry->Provider->Service.lpWSPStringToAddress(AddressString,
1025  AddressFamily,
1026  &CatalogEntry->
1027  ProtocolInfo,
1028  lpAddress,
1029  lpAddressLength,
1030  &ErrorCode);
1031 
1032  /* Dereference the entry */
1033  WsTcEntryDereference(CatalogEntry);
1034 
1035  /* Check for success and return */
1036  if (Status == ERROR_SUCCESS) return ERROR_SUCCESS;
1037  }
1038 
1039  /* Set the error and return */
1041  return SOCKET_ERROR;
1042 }
#define SOCKET_ERROR
Definition: winsock.h:333
IN PCO_ADDRESS_FAMILY AddressFamily
Definition: ndis.h:1906
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
Definition: ws2_32p.h:85
DWORD CatalogEntryId
Definition: dllmain.c:21
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WSAAPI WsTcGetEntryFromCatalogEntryId(IN PTCATALOG TCatalog, IN DWORD CatalogEntryId, IN PTCATALOG_ENTRY *CatalogEntry)
Definition: dcatalog.c:434
PTPROVIDER Provider
Definition: ws2_32p.h:89
int32_t INT
Definition: typedefs.h:56
WSPPROC_TABLE Service
Definition: ws2_32p.h:80
void DPRINT(...)
Definition: polytest.cpp:61
VOID WSAAPI WsTcEntryDereference(IN PTCATALOG_ENTRY CatalogEntry)
Definition: dcatitem.c:51
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define SetLastError(x)
Definition: compat.h:417
INT WSAAPI WsApiProlog(OUT PWSPROCESS *Process, OUT PWSTHREAD *Thread)
Definition: wsautil.c:91
LPWSPSTRINGTOADDRESS lpWSPStringToAddress
Definition: ws2spi.h:490
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
DWORD WSAAPI WsTcGetEntryFromAf(IN PTCATALOG TCatalog, IN INT AddressFamily, IN PTCATALOG_ENTRY *CatalogEntry)
Definition: dcatalog.c:382
PTCATALOG WSAAPI WsProcGetTCatalog(IN PWSPROCESS Process)
Definition: dprocess.c:150

Referenced by test_WSAStringToAddressW().