ReactOS  0.4.14-dev-50-g13bb5e2
msafdlib.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS WinSock 2 NSP
4  * FILE: include/reactos/winsock/msafdlib.h
5  * PURPOSE: Winsock 2 SPI Utility Header
6  */
7 
8 #define NO_BLOCKING_HOOK 0
9 #define MAYBE_BLOCKING_HOOK 1
10 #define ALWAYS_BLOCKING_HOOK 2
11 
12 #define NO_TIMEOUT 0
13 #define SEND_TIMEOUT 1
14 #define RECV_TIMEOUT 2
15 
16 #define MAX_TDI_ADDRESS_LENGTH 32
17 
18 #define WSA_FLAG_MULTIPOINT_ALL (WSA_FLAG_MULTIPOINT_C_ROOT |\
19  WSA_FLAG_MULTIPOINT_C_LEAF |\
20  WSA_FLAG_MULTIPOINT_D_ROOT |\
21  WSA_FLAG_MULTIPOINT_D_LEAF)
22 
23 
24 /* Socket State */
25 typedef enum _SOCKET_STATE
26 {
34 
35 /*
36  * Shared Socket Information.
37  * It's called shared because we send it to Kernel-Mode for safekeeping
38  */
39 typedef struct _SOCK_SHARED_INFO {
43  INT Protocol;
46  struct linger LingerData;
51  struct {
54  BOOLEAN Debug:1;
63  BOOLEAN UseSAN:1;
64  }; // Flags
69  GROUP GroupID;
73  HWND hWnd;
74  LONG Unknown;
76  UINT wMsg;
80 
81 /* Socket Helper Data. Holds information about the WSH Libraries */
82 typedef struct _HELPER_DATA {
84  LONG RefCount;
104  WCHAR TransportName[1];
106 
107 typedef struct _ASYNC_DATA
108 {
114 
115 /* The actual Socket Structure represented by a handle. Internal to us */
116 typedef struct _SOCKET_INFORMATION {
117  union {
119  struct {
121  SOCKET Handle;
122  };
123  };
138  PVOID SanData;
140 
141 /* The blob of data we send to Kernel-Mode for safekeeping */
142 typedef struct _SOCKET_CONTEXT {
145  ULONG Padding;
148  /* Plus Helper Data */
150 
151 typedef struct _SOCK_RW_LOCK
152 {
153  volatile LONG ReaderCount;
157 
158 typedef struct _WINSOCK_TEB_DATA
159 {
168 
169 typedef INT
171 
172 typedef struct _SOCK_ICF_DATA
173 {
180 
181 typedef PVOID
183  IN HANDLE Heap,
184  IN ULONG Flags,
185  IN ULONG Size
186 );
187 
188 extern HANDLE SockPrivateHeap;
201 extern LONG gWSM_NSPStartupRef;
202 extern LONG gWSM_NSPCallRef;
209 extern BOOLEAN g_fRnrLockInit;
211 
212 BOOL
213 WSPAPI
215 
216 BOOL
217 WSPAPI
219 
220 INT
221 WSPAPI
223 
224 PVOID
225 WSPAPI
227  IN ULONG Flags,
228  IN ULONG Size);
229 
230 NTSTATUS
231 WSPAPI
234  IN ULONG SpinCount
235 );
236 
237 VOID
238 WSPAPI
240 
241 VOID
242 WSPAPI
244 
245 VOID
246 WSPAPI
248 
249 VOID
250 WSPAPI
252 
253 NTSTATUS
254 WSPAPI
256 
257 INT
258 WSPAPI
260  IN ULONG Ioctl,
261  IN PVOID Buffer,
263  OUT PULONG BufferReturned);
264 
265 INT
266 WSPAPI
268  IN GROUP Group,
269  IN PSOCKADDR SocketAddress,
270  IN INT SocketAddressLength);
271 
272 BOOL
273 WSPAPI
275  IN SOCKET SocketHandle,
276  IN DWORD BlockingFlags,
277  IN DWORD TimeoutFlags);
278 
279 BOOLEAN
280 WSPAPI
282 
283 INT
284 WSPAPI
286  IN DWORD Event);
287 
288 INT
289 WSPAPI
291  IN BOOLEAN Force);
292 
293 INT
294 WSPAPI
296  IN PSOCKADDR Sockaddr,
297  IN INT SockaddrLength);
298 
299 INT
300 WSPAPI
302  OUT PINT SockaddrLength,
303  IN PTRANSPORT_ADDRESS TdiAddress);
304 
305 INT
306 WSPAPI
308 
309 VOID
310 WSPAPI
313  DWORD Reserved);
314 
315 VOID
316 WSPAPI
318 
319 INT
320 WSPAPI
322  IN ULONG AfdInformationClass,
323  IN PVOID ExtraData OPTIONAL,
325  IN OUT PBOOLEAN Boolean OPTIONAL,
327  IN OUT PLARGE_INTEGER LargeInteger OPTIONAL);
328 
329 INT
330 WSPAPI
332  IN ULONG AfdInformationClass,
333  IN PBOOLEAN Boolean OPTIONAL,
335  IN PLARGE_INTEGER LargeInteger OPTIONAL);
336 
337 INT
338 WSPAPI
340 
341 VOID
342 WSPAPI
344 
345 VOID
346 WSPAPI
348 
350 WSPAPI
352  IN BOOLEAN Import);
353 
354 INT
355 WSPAPI
357 
358 VOID
359 WSPAPI
361 
362 VOID
363 WSPAPI
365 
366 VOID
367 WSPAPI
369 
370 VOID
371 WSPAPI
373 
374 VOID
375 WSPAPI
377 
378 INT
379 WSPAPI
381 
382 INT
383 WSPAPI
385  INT SocketType,
386  INT Protocol,
387  LPGUID ProviderId,
388  GROUP g,
389  DWORD dwFlags,
390  DWORD ProviderFlags,
391  DWORD ServiceFlags,
393  PSOCKET_INFORMATION *NewSocket);
394 
395 INT
396 WSPAPI
398 
400 INT
401 WSPAPI
403 {
404  /* Make sure we aren't terminating and get our thread data */
405  if (!(SockProcessTerminating) &&
406  (SockWspStartupCount > 0) &&
407  ((*ThreadData = NtCurrentTeb()->WinSockData)))
408  {
409  /* Everything is good, return */
410  return NO_ERROR;
411  }
412 
413  /* Something didn't work out, use the slow path */
415 }
416 
418 VOID
419 WSPAPI
421 {
422  /* Dereference and see if it's the last count */
423  if (!InterlockedDecrement(&Helper->RefCount))
424  {
425  /* Destroy the Helper DLL */
426  SockFreeHelperDll(Helper);
427  }
428 }
429 
430 #define MSAFD_IS_DGRAM_SOCK(s) \
431  (s->SharedData.ServiceFlags1 & XP1_CONNECTIONLESS)
432 
433 /* Global data that we want to share access with */
435 extern BOOLEAN SockSanEnabled;
437 
438 typedef VOID
440  PVOID Context,
442 );
443 
444 /* Internal Helper Functions */
445 INT
446 WSPAPI
448  PWSTR TransportName,
450  PHELPER_DATA *HelperDllData
451 );
452 
453 INT
454 WSPAPI
456  PWSTR TransportName,
458 );
459 
460 INT
461 WSPAPI
463  PWSTR *TransportList
464 );
465 
466 BOOL
467 WSPAPI
470  OUT PBOOLEAN AfMatch,
471  IN INT SocketType,
472  OUT PBOOLEAN SockMatch,
473  IN INT Protocol,
474  OUT PBOOLEAN ProtoMatch);
475 
476 INT
477 WSPAPI
479  IN HWND hWnd,
480  IN UINT wMsg,
481  IN LONG Events);
482 
483 INT
484 WSPAPI
486  IN WSAEVENT EventObject,
487  IN LONG Events);
488 
489 BOOLEAN
490 WSPAPI
492 
493 BOOLEAN
494 WSPAPI
496 
497 INT
498 WSPAPI
500  PINT SocketType,
501  PINT Protocol,
502  LPGUID ProviderId,
503  GROUP Group,
504  DWORD Flags,
505  PUNICODE_STRING TransportName,
506  PVOID *HelperDllContext,
507  PHELPER_DATA *HelperDllData,
508  PDWORD Events);
509 
510 INT
511 WSPAPI
513  PVOID ThreadParam
514 );
515 
516 VOID
517 WSPAPI
519  PASYNC_DATA AsyncData);
520 
521 VOID
522 WSPAPI
524  IN PVOID Context,
526 
527 INT
528 WSPAPI
530  IN ULONG Event);
531 
532 VOID
533 WSPAPI
536 
537 VOID
538 WSPAPI
540  PVOID Context,
542 );
543 
544 /* Public functions, but not exported! */
545 SOCKET
546 WSPAPI
547 WSPAccept(
548  IN SOCKET s,
550  IN OUT LPINT addrlen,
551  IN LPCONDITIONPROC lpfnCondition,
552  IN DWORD dwCallbackData,
553  OUT LPINT lpErrno);
554 
555 INT
556 WSPAPI
558  IN LPSOCKADDR lpsaAddress,
559  IN DWORD dwAddressLength,
560  IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
561  OUT LPWSTR lpszAddressString,
562  IN OUT LPDWORD lpdwAddressStringLength,
563  OUT LPINT lpErrno);
564 
565 INT
566 WSPAPI
568  IN SOCKET s,
569  IN HWND hWnd,
570  IN UINT wMsg,
571  IN LONG lEvent,
572  OUT LPINT lpErrno);
573 
574 INT
576  IN SOCKET s,
577  IN CONST SOCKADDR *name,
578  IN INT namelen,
579  OUT LPINT lpErrno);
580 
581 INT
582 WSPAPI
584  OUT LPINT lpErrno);
585 
586 INT
587 WSPAPI
588 WSPCleanup(
589  OUT LPINT lpErrno);
590 
591 INT
592 WSPAPI
594  IN SOCKET s,
595  OUT LPINT lpErrno);
596 
597 INT
598 WSPAPI
599 WSPConnect(
600  IN SOCKET s,
602  IN INT namelen,
603  IN LPWSABUF lpCallerData,
604  OUT LPWSABUF lpCalleeData,
605  IN LPQOS lpSQOS,
606  IN LPQOS lpGQOS,
607  OUT LPINT lpErrno);
608 
609 INT
610 WSPAPI
612  IN SOCKET s,
613  IN DWORD dwProcessId,
614  OUT LPWSAPROTOCOL_INFOW lpProtocolInfo,
615  OUT LPINT lpErrno);
616 
617 INT
618 WSPAPI
620  IN SOCKET s,
621  IN WSAEVENT hEventObject,
622  OUT LPWSANETWORKEVENTS lpNetworkEvents,
623  OUT LPINT lpErrno);
624 
625 INT
626 WSPAPI
628  IN SOCKET s,
629  IN WSAEVENT hEventObject,
630  IN LONG lNetworkEvents,
631  OUT LPINT lpErrno);
632 
633 BOOL
634 WSPAPI
636  IN SOCKET s,
638  OUT LPDWORD lpcbTransfer,
639  IN BOOL fWait,
640  OUT LPDWORD lpdwFlags,
641  OUT LPINT lpErrno);
642 
643 INT
644 WSPAPI
646  IN SOCKET s,
648  IN OUT LPINT namelen,
649  OUT LPINT lpErrno);
650 
651 BOOL
652 WSPAPI
654  IN SOCKET s,
655  IN OUT LPWSABUF lpQOSName,
656  OUT LPQOS lpQOS,
657  OUT LPINT lpErrno);
658 
659 INT
660 WSPAPI
662  IN SOCKET s,
665  OUT LPINT lpErrno);
666 
667 INT
668 WSPAPI
670  IN SOCKET s,
671  IN INT level,
672  IN INT optname,
673  OUT CHAR FAR* optval,
674  IN OUT LPINT optlen,
675  OUT LPINT lpErrno);
676 
677 INT
678 WSPAPI
679 WSPIoctl(
680  IN SOCKET s,
682  IN LPVOID lpvInBuffer,
683  IN DWORD cbInBuffer,
684  OUT LPVOID lpvOutBuffer,
685  IN DWORD cbOutBuffer,
686  OUT LPDWORD lpcbBytesReturned,
688  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
689  IN LPWSATHREADID lpThreadId,
690  OUT LPINT lpErrno);
691 
692 SOCKET
693 WSPAPI
695  IN SOCKET s,
697  IN INT namelen,
698  IN LPWSABUF lpCallerData,
699  OUT LPWSABUF lpCalleeData,
700  IN LPQOS lpSQOS,
701  IN LPQOS lpGQOS,
702  IN DWORD dwFlags,
703  OUT LPINT lpErrno);
704 
705 INT
706 WSPAPI
707 WSPListen(
708  IN SOCKET s,
709  IN INT backlog,
710  OUT LPINT lpErrno);
711 
712 INT
713 WSPAPI
714 WSPRecv(
715  IN SOCKET s,
716  IN OUT LPWSABUF lpBuffers,
717  IN DWORD dwBufferCount,
718  OUT LPDWORD lpNumberOfBytesRecvd,
719  IN OUT LPDWORD lpFlags,
721  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
722  IN LPWSATHREADID lpThreadId,
723  OUT LPINT lpErrno);
724 
725 INT
726 WSPAPI
728  IN SOCKET s,
729  OUT LPWSABUF lpInboundDisconnectData,
730  OUT LPINT lpErrno);
731 
732 INT
733 WSPAPI
735  IN SOCKET s,
736  IN OUT LPWSABUF lpBuffers,
737  IN DWORD dwBufferCount,
738  OUT LPDWORD lpNumberOfBytesRecvd,
739  IN OUT LPDWORD lpFlags,
740  OUT LPSOCKADDR lpFrom,
741  IN OUT LPINT lpFromlen,
743  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
744  IN LPWSATHREADID lpThreadId,
745  OUT LPINT lpErrno);
746 
747 INT
748 WSPAPI
749 WSPSelect(
750  IN INT nfds,
751  IN OUT LPFD_SET readfds,
752  IN OUT LPFD_SET writefds,
753  IN OUT LPFD_SET exceptfds,
755  OUT LPINT lpErrno);
756 
757 INT
758 WSPAPI
759 WSPSend(
760  IN SOCKET s,
761  IN LPWSABUF lpBuffers,
762  IN DWORD dwBufferCount,
763  OUT LPDWORD lpNumberOfBytesSent,
764  IN DWORD dwFlags,
766  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
767  IN LPWSATHREADID lpThreadId,
768  OUT LPINT lpErrno);
769 
770 INT
771 WSPAPI
773  IN SOCKET s,
774  IN LPWSABUF lpOutboundDisconnectData,
775  OUT LPINT lpErrno);
776 
777 INT
778 WSPAPI
779 WSPSendTo(
780  IN SOCKET s,
781  IN LPWSABUF lpBuffers,
782  IN DWORD dwBufferCount,
783  OUT LPDWORD lpNumberOfBytesSent,
784  IN DWORD dwFlags,
785  IN CONST SOCKADDR *lpTo,
786  IN INT iTolen,
788  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
789  IN LPWSATHREADID lpThreadId,
790  OUT LPINT lpErrno);
791 
792 INT
793 WSPAPI
795  IN SOCKET s,
796  IN INT level,
797  IN INT optname,
798  IN CONST CHAR FAR* optval,
799  IN INT optlen,
800  OUT LPINT lpErrno);
801 
802 INT
803 WSPAPI
805  IN SOCKET s,
806  IN INT how,
807  OUT LPINT lpErrno);
808 
809 SOCKET
810 WSPAPI
811 WSPSocket(
812  IN INT af,
813  IN INT type,
814  IN INT protocol,
815  IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
816  IN GROUP g,
817  IN DWORD dwFlags,
818  OUT LPINT lpErrno);
819 
820 INT
821 WSPAPI
823  IN LPWSTR AddressString,
825  IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
826  OUT LPSOCKADDR lpAddress,
827  IN OUT LPINT lpAddressLength,
828  OUT LPINT lpErrno);
PWSH_GET_WILDCARD_SOCKADDR WSHGetWildcardSockaddr
Definition: helpers.h:29
INT WSPAPI WSPSetSockOpt(IN SOCKET s, IN INT level, IN INT optname, IN CONST CHAR FAR *optval, IN INT optlen, OUT LPINT lpErrno)
Definition: dllmain.c:2776
VOID WSPAPI SockSanInitialize(VOID)
WCHAR TransportName[1]
Definition: helpers.h:34
Definition: winsock.h:66
BOOL WSPAPI WSPGetOverlappedResult(IN SOCKET s, IN LPWSAOVERLAPPED lpOverlapped, OUT LPDWORD lpcbTransfer, IN BOOL fWait, OUT LPDWORD lpdwFlags, OUT LPINT lpErrno)
Definition: sndrcv.c:96
INT(WINAPI * PWSH_ADDRESS_TO_STRING)(LPSOCKADDR, INT, LPWSAPROTOCOL_INFOW, LPWSTR, LPDWORD)
Definition: wsahelp.h:67
LPWSPUPCALLTABLE SockUpcallTable
HANDLE EventObject
Definition: msafd.h:110
INT WSPAPI SockAsyncSelectHelper(IN PSOCKET_INFORMATION Socket, IN HWND hWnd, IN UINT wMsg, IN LONG Events)
struct _SOCKET_CONTEXT * PSOCKET_CONTEXT
DWORD SockSendBufferWindow
INT WSPAPI SockGetInformation(IN PSOCKET_INFORMATION Socket, IN ULONG AfdInformationClass, IN PVOID ExtraData OPTIONAL, IN ULONG ExtraDataSize, IN OUT PBOOLEAN Boolean OPTIONAL, IN OUT PULONG Ulong OPTIONAL, IN OUT PLARGE_INTEGER LargeInteger OPTIONAL)
VOID WSPAPI SockAsyncSelectCompletion(PVOID Context, PIO_STATUS_BLOCK IoStatusBlock)
INT AddressFamily
Definition: msafd.h:56
_SOCKET_STATE
Definition: msafd.h:45
GLint level
Definition: gl.h:1546
#define IN
Definition: typedefs.h:38
int(CALLBACK * LPCONDITIONPROC)(IN LPWSABUF lpCallerId, IN LPWSABUF lpCallerData, IN OUT LPQOS lpSQOS, IN OUT LPQOS lpGQOS, IN LPWSABUF lpCalleeId, IN LPWSABUF lpCalleeData, OUT GROUP FAR *g, IN DWORD_PTR dwCallbackData)
Definition: winsock2.h:711
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE _In_opt_ PVOID ApcContext
Definition: iofuncs.h:719
DWORD SequenceNumber
Definition: msafd.h:131
BOOLEAN Listening
Definition: msafd.h:68
IN PCO_ADDRESS_FAMILY AddressFamily
Definition: ndis.h:1906
INT WSPAPI WSPGetSockOpt(IN SOCKET s, IN INT level, IN INT optname, OUT CHAR FAR *optval, IN OUT LPINT optlen, OUT LPINT lpErrno)
Definition: dllmain.c:2600
struct _HELPER_DATA HELPER_DATA
CRITICAL_SECTION g_RnrLock
PVOID SockBufferKeyTable
DWORD CatalogEntryId
Definition: dllmain.c:21
BOOLEAN ExclusiveAddressUse
Definition: msafd.h:73
VOID WSPAPI SockReleaseRwLockExclusive(IN PSOCK_RW_LOCK Lock)
INT(WINAPI * PWSH_STRING_TO_ADDRESS)(LPWSTR, DWORD, LPWSAPROTOCOL_INFOW, LPSOCKADDR, LPDWORD)
Definition: wsahelp.h:84
VOID WSPAPI SockSanGetTcpipCatalogId(VOID)
INT WSPAPI WSPRecv(IN SOCKET s, IN OUT LPWSABUF lpBuffers, IN DWORD dwBufferCount, OUT LPDWORD lpNumberOfBytesRecvd, IN OUT LPDWORD lpFlags, IN LPWSAOVERLAPPED lpOverlapped, IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, IN LPWSATHREADID lpThreadId, OUT LPINT lpErrno)
INT WSPAPI WSPConnect(IN SOCKET s, IN CONST SOCKADDR *name, IN INT namelen, IN LPWSABUF lpCallerData, OUT LPWSABUF lpCalleeData, IN LPQOS lpSQOS, IN LPQOS lpGQOS, OUT LPINT lpErrno)
INT WSPAPI SockBuildTdiAddress(OUT PTRANSPORT_ADDRESS TdiAddress, IN PSOCKADDR Sockaddr, IN INT SockaddrLength)
PVOID IcfOpenDynamicFwPort
Definition: msafdlib.h:175
PWSH_GET_BROADCAST_SOCKADDR WSHGetBroadcastSockaddr
Definition: helpers.h:30
INT WSPAPI SockNotifyHelperDll(IN PSOCKET_INFORMATION Socket, IN DWORD Event)
VOID(WSPAPI * PASYNC_COMPLETION_ROUTINE)(PVOID Context, PIO_STATUS_BLOCK IoStatusBlock)
Definition: msafdlib.h:439
PWSH_JOIN_LEAF WSHJoinLeaf
Definition: helpers.h:24
SOCK_RW_LOCK SocketGlobalLock
_In_ const GUID _In_ ULONG ExtraDataSize
Definition: classpnp.h:1236
struct _SOCK_ICF_DATA * PSOCK_ICF_DATA
struct _SOCK_RW_LOCK * PSOCK_RW_LOCK
INT(WINAPI * PICF_CONNECT)(PVOID IcfData)
Definition: msafdlib.h:170
volatile LONG ReaderCount
Definition: msafdlib.h:153
INT WSPAPI WSPDuplicateSocket(IN SOCKET s, IN DWORD dwProcessId, OUT LPWSAPROTOCOL_INFOW lpProtocolInfo, OUT LPINT lpErrno)
Definition: dllmain.c:449
BOOLEAN WSPAPI SockCheckAndInitAsyncSelectHelper(VOID)
uint16_t * PWSTR
Definition: typedefs.h:54
VOID WSPAPI CloseIcfConnection(IN PSOCK_ICF_DATA IcfData)
VOID WSPAPI SockReleaseRwLockShared(IN PSOCK_RW_LOCK Lock)
struct _SOCKET_INFORMATION * PSOCKET_INFORMATION
INT WSPAPI SockGetTdiName(PINT AddressFamily, PINT SocketType, PINT Protocol, LPGUID ProviderId, GROUP Group, DWORD Flags, PUNICODE_STRING TransportName, PVOID *HelperDllContext, PHELPER_DATA *HelperDllData, PDWORD Events)
_In_opt_ PSID Group
Definition: rtlfuncs.h:1606
static PVOID Mapping[EMS_PHYSICAL_PAGES]
Definition: emsdrv.c:41
char CHAR
Definition: xmlstorage.h:175
#define WSAEVENT
Definition: winsock2.h:585
SOCKET Handle
Definition: msafd.h:99
FORCEINLINE INT WSPAPI SockEnterApiFast(OUT PWINSOCK_TEB_DATA *ThreadData)
Definition: msafdlib.h:402
LONG NTSTATUS
Definition: precomp.h:26
VOID WSPAPI SockProcessQueuedAsyncSelect(PVOID Context, PIO_STATUS_BLOCK IoStatusBlock)
Definition: dllmain.c:3949
#define INT
Definition: polytest.cpp:20
INT(WINAPI * PWSH_IOCTL)(PVOID, SOCKET, HANDLE, HANDLE, DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE, LPBOOL)
Definition: wsahelp.h:76
BOOL WSPAPI SockIsTripleInMapping(IN PWINSOCK_MAPPING Mapping, IN INT AddressFamily, OUT PBOOLEAN AfMatch, IN INT SocketType, OUT PBOOLEAN SockMatch, IN INT Protocol, OUT PBOOLEAN ProtoMatch)
SOCKET WSPAPI WSPAccept(IN SOCKET s, OUT LPSOCKADDR addr, IN OUT LPINT addrlen, IN LPCONDITIONPROC lpfnCondition, IN DWORD dwCallbackData, OUT LPINT lpErrno)
LIST_ENTRY SockHelperDllListHead
HANDLE SockSanCleanUpCompleteEvent
BOOLEAN Broadcast
Definition: msafd.h:69
HWND hWnd
Definition: settings.c:17
PAFD_ACCEPT_DATA AcceptData
Definition: msafdlib.h:162
BOOLEAN OobInline
Definition: msafd.h:71
INT(WINAPI * PWSH_OPEN_SOCKET)(PINT, PINT, PINT, PUNICODE_STRING, PVOID, PDWORD)
Definition: wsahelp.h:81
HANDLE WriterWaitEvent
Definition: msafdlib.h:154
INT WSPAPI WSPAddressToString(IN LPSOCKADDR lpsaAddress, IN DWORD dwAddressLength, IN LPWSAPROTOCOL_INFOW lpProtocolInfo, OUT LPWSTR lpszAddressString, IN OUT LPDWORD lpdwAddressStringLength, OUT LPINT lpErrno)
Definition: dllmain.c:3050
NTSTATUS WSPAPI SockDeleteRwLock(IN PSOCK_RW_LOCK Lock)
BOOLEAN SendShutdown
Definition: msafd.h:77
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOLEAN WSPAPI SockCheckAndReferenceAsyncThread(VOID)
INT WSPAPI SockGetConnectData(IN PSOCKET_INFORMATION Socket, IN ULONG Ioctl, IN PVOID Buffer, IN ULONG BufferLength, OUT PULONG BufferReturned)
BOOLEAN UseDelayedAcceptance
Definition: msafd.h:78
VOID WSPAPI SockFreeHelperDll(IN PHELPER_DATA Helper)
HINSTANCE SockModuleHandle
DWORD SequenceNumber
Definition: msafd.h:90
PVOID(NTAPI * PRTL_HEAP_ALLOCATE)(IN HANDLE Heap, IN ULONG Flags, IN ULONG Size)
Definition: msafdlib.h:182
Definition: dhcpd.h:245
SOCK_SHARED_INFO SharedData
Definition: msafdlib.h:124
enum _SOCKET_STATE SOCKET_STATE
DWORD CatalogEntryId
Definition: msafdlib.h:66
enum _SOCKET_STATE * PSOCKET_STATE
BOOL WSPAPI SockWaitForSingleObject(IN HANDLE Handle, IN SOCKET SocketHandle, IN DWORD BlockingFlags, IN DWORD TimeoutFlags)
INT WSPAPI WSPEventSelect(IN SOCKET s, IN WSAEVENT hEventObject, IN LONG lNetworkEvents, OUT LPINT lpErrno)
Definition: event.c:17
INT WSPAPI WSPGetSockName(IN SOCKET s, OUT LPSOCKADDR name, IN OUT LPINT namelen, OUT LPINT lpErrno)
Definition: dllmain.c:2152
#define NO_ERROR
Definition: dderror.h:5
GLint namelen
Definition: glext.h:7232
VOID WSPAPI SockAcquireRwLockExclusive(IN PSOCK_RW_LOCK Lock)
int32_t INT
Definition: typedefs.h:56
SOCKET SocketHandle
Definition: msafdlib.h:161
INT(WINAPI * PWSH_GET_SOCKET_INFORMATION)(PVOID, SOCKET, HANDLE, HANDLE, INT, INT, PCHAR, LPINT)
Definition: wsahelp.h:72
PVOID IcfDisconnect
Definition: msafdlib.h:177
DWORD CreateFlags
Definition: msafd.h:81
ULONG SizeOfHelperData
Definition: msafd.h:122
ULONG SockBufferKeyTableSize
PSOCKADDR RemoteAddress
Definition: msafd.h:106
BOOLEAN ReuseAddresses
Definition: msafd.h:72
INT WSPAPI WSPSend(IN SOCKET s, IN LPWSABUF lpBuffers, IN DWORD dwBufferCount, OUT LPDWORD lpNumberOfBytesSent, IN DWORD dwFlags, IN LPWSAOVERLAPPED lpOverlapped, IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, IN LPWSATHREADID lpThreadId, OUT LPINT lpErrno)
HANDLE hInstance
Definition: helpers.h:15
INT WSPAPI SockSetInformation(IN PSOCKET_INFORMATION Socket, IN ULONG AfdInformationClass, IN PBOOLEAN Boolean OPTIONAL, IN PULONG Ulong OPTIONAL, IN PLARGE_INTEGER LargeInteger OPTIONAL)
INT MinWSAddressLength
Definition: helpers.h:16
INT WSPAPI WSPRecvDisconnect(IN SOCKET s, OUT LPWSABUF lpInboundDisconnectData, OUT LPINT lpErrno)
Definition: sndrcv.c:919
INT(WINAPI * PWSH_GET_BROADCAST_SOCKADDR)(PVOID, PSOCKADDR, PINT)
Definition: wsahelp.h:69
INT WSPAPI SockLoadTransportMapping(PWSTR TransportName, PWINSOCK_MAPPING *Mapping)
Definition: helpers.c:161
CRITICAL_SECTION Lock
Definition: msafd.h:112
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
INT WSPAPI WSPListen(IN SOCKET s, IN INT backlog, OUT LPINT lpErrno)
BOOL WSPAPI WSPGetQOSByName(IN SOCKET s, IN OUT LPWSABUF lpQOSName, OUT LPQOS lpQOS, OUT LPINT lpErrno)
Definition: stubs.c:26
DWORD ProviderFlags
Definition: msafd.h:83
PWINSOCK_MAPPING Mapping
Definition: helpers.h:21
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
struct _SOCK_SHARED_INFO SOCK_SHARED_INFO
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOLEAN UseSAN
Definition: msafd.h:79
long LONG
Definition: pedump.c:60
enum _SOCKET_STATE SOCKET_STATE
_In_ ULONG BufferLength
Definition: usbdlib.h:225
PWSH_STRING_TO_ADDRESS WSHStringToAddress
Definition: helpers.h:32
struct _SOCKET_CONTEXT SOCKET_CONTEXT
SOCKET WSPAPI WSPJoinLeaf(IN SOCKET s, IN CONST SOCKADDR *name, IN INT namelen, IN LPWSABUF lpCallerData, OUT LPWSABUF lpCalleeData, IN LPQOS lpSQOS, IN LPQOS lpGQOS, IN DWORD dwFlags, OUT LPINT lpErrno)
Definition: stubs.c:40
BOOLEAN SockSanEnabled
INT WSPAPI SockEnterApiSlow(OUT PWINSOCK_TEB_DATA *ThreadData)
#define FAR
Definition: guiddef.h:36
HINSTANCE NlsMsgSourcemModuleHandle
INT WSPAPI WSPCancelBlockingCall(OUT LPINT lpErrno)
Definition: stubs.c:15
PVOID WSPAPI SockInitializeHeap(IN HANDLE Heap, IN ULONG Flags, IN ULONG Size)
struct _SOCK_ICF_DATA SOCK_ICF_DATA
ULONG SizeOfSendBuffer
Definition: msafd.h:65
INT MaxWSAddressLength
Definition: helpers.h:17
INT WSPAPI WSPAsyncSelect(IN SOCKET s, IN HWND hWnd, IN UINT wMsg, IN LONG lEvent, OUT LPINT lpErrno)
Definition: sndrcv.c:17
BOOL WSPAPI MSWSOCK_Initialize(VOID)
struct _SOCK_SHARED_INFO * PSOCK_SHARED_INFO
BOOL WSPAPI MSAFD_SockThreadInitialize(VOID)
unsigned char BOOLEAN
struct _SOCKET_INFORMATION * ParentSocket
Definition: msafdlib.h:109
INT WSPAPI WSPCleanup(OUT LPINT lpErrno)
Definition: dllmain.c:3234
LIST_ENTRY Helpers
Definition: helpers.h:13
#define FORCEINLINE
Definition: ntbasedef.h:221
PWSH_GET_SOCKADDR_TYPE WSHGetSockaddrType
Definition: helpers.h:28
INT WSPAPI SockGetTdiHandles(IN PSOCKET_INFORMATION Socket)
VOID WSPAPI SockAcquireRwLockShared(IN PSOCK_RW_LOCK Lock)
ULONG Padding
Definition: msafd.h:123
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
HANDLE SockAsyncQueuePort
HANDLE IcfHandle
Definition: msafdlib.h:174
PHELPER_DATA HelperData
Definition: msafd.h:103
Definition: bufpool.h:45
HINSTANCE DllHandle
Definition: msafdlib.h:178
PWAH_HANDLE_TABLE SockContextTable
NTSTATUS WSPAPI SockInitializeRwLockAndSpinCount(IN PSOCK_RW_LOCK Lock, IN ULONG SpinCount)
AFD_POLL_INFO AsyncSelectInfo
Definition: msafd.h:133
INT WSPAPI SockIsAddressConsistentWithConstrainedGroup(IN PSOCKET_INFORMATION Socket, IN GROUP Group, IN PSOCKADDR SocketAddress, IN INT SocketAddressLength)
void * PVOID
Definition: retypes.h:9
struct _WINSOCK_TEB_DATA * PWINSOCK_TEB_DATA
BOOLEAN UseDelayedAcceptance
Definition: helpers.h:20
LONG SockWspStartupCount
INT WSPAPI SockReenableAsyncSelectEvent(IN PSOCKET_INFORMATION Socket, IN ULONG Event)
Definition: dllmain.c:3983
CRITICAL_SECTION MSWSOCK_SocketLock
BOOLEAN WSPAPI SockIsSocketConnected(IN PSOCKET_INFORMATION Socket)
INT WSPAPI SockLoadTransportList(PWSTR *TransportList)
Definition: helpers.c:232
INT WSPAPI WSPSelect(IN INT nfds, IN OUT LPFD_SET readfds, IN OUT LPFD_SET writefds, IN OUT LPFD_SET exceptfds, IN CONST LPTIMEVAL timeout, OUT LPINT lpErrno)
BOOLEAN ReceiveShutdown
Definition: msafd.h:76
INT WSPAPI WSPStringToAddress(IN LPWSTR AddressString, IN INT AddressFamily, IN LPWSAPROTOCOL_INFOW lpProtocolInfo, OUT LPSOCKADDR lpAddress, IN OUT LPINT lpAddressLength, OUT LPINT lpErrno)
Definition: dllmain.c:3110
BOOLEAN Debug
Definition: msafd.h:70
INT WSPAPI SockEventSelectHelper(IN PSOCKET_INFORMATION Socket, IN WSAEVENT EventObject, IN LONG Events)
PWSH_OPEN_SOCKET WSHOpenSocket
Definition: helpers.h:22
BOOLEAN NonBlocking
Definition: msafd.h:74
_In_ HANDLE Handle
Definition: extypes.h:390
GLboolean GLboolean g
Definition: glext.h:6204
struct _ASYNC_DATA ASYNC_DATA
DWORD ServiceFlags1
Definition: msafd.h:82
int * PINT
Definition: windef.h:177
PICF_CONNECT IcfConnect
Definition: msafdlib.h:176
INT WSPAPI SockSocket(INT AddressFamily, INT SocketType, INT Protocol, LPGUID ProviderId, GROUP g, DWORD dwFlags, DWORD ProviderFlags, DWORD ServiceFlags, DWORD CatalogEntryId, PSOCKET_INFORMATION *NewSocket)
PWSH_OPEN_SOCKET2 WSHOpenSocket2
Definition: helpers.h:23
DWORD HelperEvents
Definition: msafd.h:102
INT SocketType
Definition: msafd.h:57
GROUP GroupID
Definition: msafd.h:84
INT WSPAPI WSPCloseSocket(IN SOCKET s, OUT LPINT lpErrno)
Definition: dllmain.c:623
PASYNC_DATA AsyncData
Definition: msafdlib.h:133
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG gWSM_NSPCallRef
VOID WSPAPI SockHandleAsyncIndication(IN PASYNC_COMPLETION_ROUTINE Callback, IN PVOID Context, IN PIO_STATUS_BLOCK IoStatusBlock)
WSAPROTOCOL_INFOW SockTcpProviderInfo
LONG gWSM_NSPStartupRef
#define WINAPI
Definition: msvc.h:8
HANDLE SockPrivateHeap
unsigned int GROUP
Definition: winsock2.h:640
PWSH_NOTIFY WSHNotify
Definition: helpers.h:25
unsigned long DWORD
Definition: ntddk_ex.h:95
INT SizeOfRemoteAddress
Definition: msafd.h:60
BOOL SockProcessTerminating
INT WSPAPI WSPIoctl(IN SOCKET s, IN DWORD dwIoControlCode, IN LPVOID lpvInBuffer, IN DWORD cbInBuffer, OUT LPVOID lpvOutBuffer, IN DWORD cbOutBuffer, OUT LPDWORD lpcbBytesReturned, IN LPWSAOVERLAPPED lpOverlapped, IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, IN LPWSATHREADID lpThreadId, OUT LPINT lpErrno)
Definition: dllmain.c:2357
PWSH_ADDRESS_TO_STRING WSHAddressToString
Definition: helpers.h:31
struct _SOCKET_INFORMATION SOCKET_INFORMATION
VOID WSPAPI SockDereferenceSocket(IN PSOCKET_INFORMATION Socket)
INT WSPAPI SockCloseSocket(IN PSOCKET_INFORMATION Socket)
char * PBOOLEAN
Definition: retypes.h:11
BOOLEAN CancelIo
Definition: msafdlib.h:164
HANDLE EventHandle
Definition: msafdlib.h:160
GLenum const GLvoid * addr
Definition: glext.h:9621
#define InterlockedDecrement
Definition: armddk.h:52
INT SizeOfLocalAddress
Definition: msafd.h:59
PWSH_GET_SOCKET_INFORMATION WSHGetSocketInformation
Definition: helpers.h:26
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
INT WSPAPI WSPRecvFrom(IN SOCKET s, IN OUT LPWSABUF lpBuffers, IN DWORD dwBufferCount, OUT LPDWORD lpNumberOfBytesRecvd, IN OUT LPDWORD lpFlags, OUT LPSOCKADDR lpFrom, IN OUT LPINT lpFromlen, IN LPWSAOVERLAPPED lpOverlapped, IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, IN LPWSATHREADID lpThreadId, OUT LPINT lpErrno)
INT WSPAPI SockUpdateWindowSizes(IN PSOCKET_INFORMATION Socket, IN BOOLEAN Force)
#define VOID
Definition: acefi.h:82
INT MinTDIAddressLength
Definition: helpers.h:18
BOOLEAN DontUseWildcard
Definition: msafd.h:75
HANDLE lEvent
Definition: tftpd.cpp:56
struct _HELPER_DATA * PHELPER_DATA
BOOLEAN g_fRnrLockInit
INT(WINAPI * PWSH_OPEN_SOCKET2)(PINT, PINT, PINT, GROUP, DWORD, PUNICODE_STRING, PVOID *, PDWORD)
Definition: wsahelp.h:82
GLdouble s
Definition: gl.h:2039
Definition: typedefs.h:117
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
PSOCKET_INFORMATION WSPAPI SockFindAndReferenceSocket(IN SOCKET Handle, IN BOOLEAN Import)
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID WSPAPI SockCancelIo(IN SOCKET Handle)
VOID WSPAPI SockProcessAsyncSelect(PSOCKET_INFORMATION Socket, PASYNC_DATA AsyncData)
Definition: dllmain.c:3866
HANDLE TdiConnectionHandle
Definition: msafd.h:108
HANDLE TdiAddressHandle
Definition: msafd.h:107
_In_ USHORT SocketType
Definition: wsk.h:182
Status
Definition: gdiplustypes.h:24
SOCKET WSPAPI WSPSocket(IN INT af, IN INT type, IN INT protocol, IN LPWSAPROTOCOL_INFOW lpProtocolInfo, IN GROUP g, IN DWORD dwFlags, OUT LPINT lpErrno)
LONG SockProcessPendingAPCCount
SOCKADDR RemoteAddress
Definition: msafd.h:125
IO_STATUS_BLOCK IoStatusBlock
Definition: msafd.h:132
DWORD SockReceiveBufferWindow
INT WSPAPI SockLoadHelperDll(PWSTR TransportName, PWINSOCK_MAPPING Mapping, PHELPER_DATA *HelperDllData)
Definition: helpers.c:298
LONG SockAsyncThreadReferenceCount
struct linger LingerData
Definition: msafd.h:61
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
ULONG SizeOfRecvBuffer
Definition: msafd.h:64
PWSH_IOCTL WSHIoctl
Definition: helpers.h:33
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED lpOverlapped
Definition: mswsock.h:90
INT WSPAPI SockAsyncThread(PVOID ThreadParam)
Definition: dllmain.c:3641
HANDLE Events[2]
Definition: schedsvc.c:40
struct _ASYNC_DATA * PASYNC_DATA
INT WSPAPI SockBuildSockaddr(OUT PSOCKADDR Sockaddr, OUT PINT SockaddrLength, IN PTRANSPORT_ADDRESS TdiAddress)
PWSH_SET_SOCKET_INFORMATION WSHSetSocketInformation
Definition: helpers.h:27
PSOCKADDR LocalAddress
Definition: msafd.h:105
LONG Unknown
Definition: msafd.h:89
LONG AsyncDisabledEvents
Definition: msafd.h:93
INT WSPAPI WSPBind(IN SOCKET s, IN CONST SOCKADDR *name, IN INT namelen, OUT LPINT lpErrno)
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
unsigned int * PULONG
Definition: retypes.h:1
unsigned int UINT
Definition: ndis.h:50
struct _WINSOCK_TEB_DATA WINSOCK_TEB_DATA
VOID WSPAPI SockIoCompletion(IN PVOID ApcContext, IN PIO_STATUS_BLOCK IoStatusBlock, DWORD Reserved)
INT WSPAPI WSPSendTo(IN SOCKET s, IN LPWSABUF lpBuffers, IN DWORD dwBufferCount, OUT LPDWORD lpNumberOfBytesSent, IN DWORD dwFlags, IN CONST SOCKADDR *lpTo, IN INT iTolen, IN LPWSAOVERLAPPED lpOverlapped, IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, IN LPWSATHREADID lpThreadId, OUT LPINT lpErrno)
DWORD * PDWORD
Definition: pedump.c:68
INT WSPAPI WSPShutdown(IN SOCKET s, IN INT how, OUT LPINT lpErrno)
INT(WINAPI * PWSH_JOIN_LEAF)(PVOID, SOCKET, HANDLE, HANDLE, PVOID, SOCKET, PSOCKADDR, DWORD, LPWSABUF, LPWSABUF, LPQOS, LPQOS, DWORD)
Definition: wsahelp.h:78
INT WSPAPI WSPGetPeerName(IN SOCKET s, OUT LPSOCKADDR name, IN OUT LPINT namelen, OUT LPINT lpErrno)
Definition: dllmain.c:2254
ULONG RecvTimeout
Definition: msafd.h:63
INT(WINAPI * PWSH_GET_SOCKADDR_TYPE)(PSOCKADDR, DWORD, PSOCKADDR_INFO)
Definition: wsahelp.h:71
INT SocketLastError
Definition: msafd.h:87
VOID WSPAPI NewIcfConnection(IN PSOCK_ICF_DATA IcfData)
Definition: name.c:36
SOCKET_STATE State
Definition: msafd.h:54
#define OUT
Definition: typedefs.h:39
SOCK_SHARED_INFO SharedData
Definition: msafd.h:121
void(CALLBACK * LPWSAOVERLAPPED_COMPLETION_ROUTINE)(IN DWORD dwError, IN DWORD cbTransferred, IN LPWSAOVERLAPPED lpOverlapped, IN DWORD dwFlags)
Definition: winsock2.h:722
SOCKADDR LocalAddress
Definition: msafd.h:124
uint32_t * LPDWORD
Definition: typedefs.h:57
struct tagContext Context
Definition: acpixf.h:1024
PVOID RnrThreadData
Definition: msafdlib.h:166
FORCEINLINE VOID WSPAPI SockDereferenceHelperDll(IN PHELPER_DATA Helper)
Definition: msafdlib.h:420
unsigned int ULONG
Definition: retypes.h:1
ULONG SendTimeout
Definition: msafd.h:62
DWORD GroupType
Definition: msafd.h:85
INT MaxTDIAddressLength
Definition: helpers.h:19
BOOLEAN SockAsyncSelectCalled
Definition: dllmain.c:29
struct _SOCK_RW_LOCK SOCK_RW_LOCK
UINT_PTR SOCKET
Definition: winsock.h:47
VOID WSPAPI InitializeIcfConnection(IN PSOCK_ICF_DATA IcfData)
LONG NetworkEvents
Definition: msafd.h:111
INT GroupPriority
Definition: msafd.h:86
PVOID HelperContext
Definition: msafd.h:104
WCHAR * LPWSTR
Definition: xmlstorage.h:184
INT WSPAPI SockSetHandleContext(IN PSOCKET_INFORMATION Socket)
unsigned long Ulong
Definition: utypes.h:42
INT WSPAPI WSPSendDisconnect(IN SOCKET s, IN LPWSABUF lpOutboundDisconnectData, OUT LPINT lpErrno)
Definition: sndrcv.c:931
INT WSPAPI SockCreateAsyncQueuePort(VOID)
LPFNPSPCALLBACK Callback
Definition: desk.c:111
LONG AsyncEvents
Definition: msafd.h:92
INT WSPAPI WSPEnumNetworkEvents(IN SOCKET s, IN WSAEVENT hEventObject, OUT LPWSANETWORKEVENTS lpNetworkEvents, OUT LPINT lpErrno)
Definition: event.c:133
INT(WINAPI * PWSH_NOTIFY)(PVOID, SOCKET, HANDLE, HANDLE, DWORD)
Definition: wsahelp.h:80
#define CONST
Definition: pedump.c:81
INT(WINAPI * PWSH_SET_SOCKET_INFORMATION)(PVOID, SOCKET, HANDLE, HANDLE, INT, INT, PCHAR, INT)
Definition: wsahelp.h:83
INT WSPAPI NtStatusToSocketError(IN NTSTATUS Status)
INT(WINAPI * PWSH_GET_WILDCARD_SOCKADDR)(PVOID, PSOCKADDR, PINT)
Definition: wsahelp.h:73
WSH_HANDLE WshContext
Definition: msafdlib.h:118
RTL_CRITICAL_SECTION Lock
Definition: msafdlib.h:155
LONG RefCount
Definition: helpers.h:14
_Inout_ PVCB _In_ BOOLEAN Force
Definition: cdprocs.h:1425
int * LPINT
Definition: windef.h:178
#define WSPAPI
Definition: ws2spi.h:39
PRTL_HEAP_ALLOCATE SockAllocateHeapRoutine
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
_In_ DWORD dwIoControlCode
Definition: winddi.h:1700