65 PVOID HelperDLLContext;
73 TRACE(
"Creating Socket, getting TDI Name - AddressFamily (%d) SocketType (%d) Protocol (%d).\n",
129 TRACE(
"Unknown Protocol (%d). We will try SOCK_STREAM.\n",
Protocol);
149 TRACE(
"Unknown SocketType (%d). We will try IPPROTO_TCP.\n",
SocketType);
169 ERR(
"SockGetTdiName: Status %x\n",
Status);
223 TRACE(
"Connectionless socket\n");
363 ERR(
"Failed to open socket. Status 0x%08x\n",
Status);
416 TRACE(
"Success %x\n", Sock);
527 lpProtocolInfo->dwServiceFlags3 =
HandleToUlong(hDuplicatedSharedData);
528 lpProtocolInfo->dwServiceFlags4 =
HandleToUlong(hDuplicatedHandle);
608 ERR(
"MSAFD: Unhandled NTSTATUS value: 0x%x\n",
Status);
632 LONG LingerWait = -1;
652 ERR(
"NtCreateEvent failed: 0x%08x\n",
Status);
666 if (lpErrno) *lpErrno =
Status;
667 ERR(
"WSHNotify failed. Error 0x%#x\n",
Status);
676 WARN(
"Socket is closing.\n");
695 ULONG SendsInProgress;
720 if (!SendsInProgress)
734 WARN(
"Would block!\n");
749 LingerWait -= SleepWait;
771 sizeof(DisconnectInfo),
801 while (CurrentSocket->NextSocket)
803 if (CurrentSocket->NextSocket == Socket)
805 CurrentSocket->
NextSocket = CurrentSocket->NextSocket->NextSocket;
809 CurrentSocket = CurrentSocket->NextSocket;
847 const struct sockaddr *SocketAddress,
848 int SocketAddressLength,
870 if (!SocketAddress || SocketAddressLength < Socket->SharedData->SizeOfLocalAddress)
911 SocketAddressLength -
sizeof(SocketAddress->
sa_family));
971 if (lpErrno) *lpErrno =
Status;
1054 if (lpErrno) *lpErrno =
Status;
1076 ULONG PollBufferSize;
1089 if (readfds !=
NULL)
1091 for (
i = 0;
i < readfds->fd_count;
i++)
1093 FD_SET(readfds->fd_array[
i], &selectfds);
1096 if (writefds !=
NULL)
1098 for (
i = 0;
i < writefds->fd_count;
i++)
1100 FD_SET(writefds->fd_array[
i], &selectfds);
1103 if (exceptfds !=
NULL)
1105 for (
i = 0;
i < exceptfds->fd_count;
i++)
1107 FD_SET(exceptfds->fd_array[
i], &selectfds);
1113 if ( HandleCount == 0 )
1115 WARN(
"No handles! Returning SOCKET_ERROR\n", HandleCount);
1120 PollBufferSize =
sizeof(*PollInfo) + ((HandleCount - 1) *
sizeof(
AFD_HANDLE));
1122 TRACE(
"HandleCount: %u BufferSize: %u\n", HandleCount, PollBufferSize);
1128 Timeout.u.HighPart = 0x7FFFFFFF;
1129 TRACE(
"Infinite timeout\n");
1144 TRACE(
"Timeout: Orig %d.%06d kernel %d\n",
1160 ERR(
"NtCreateEvent failed, 0x%08x\n",
Status);
1187 if (readfds !=
NULL) {
1188 for (
i = 0;
i < readfds->fd_count;
i++)
1190 for (
j = 0;
j < HandleCount;
j++)
1195 if (
j >= HandleCount)
1197 ERR(
"Error while counting readfds %ld > %ld\n",
j, HandleCount);
1206 ERR(
"Invalid socket handle provided in readfds %d\n", readfds->fd_array[
i]);
1221 if (writefds !=
NULL)
1223 for (
i = 0;
i < writefds->fd_count;
i++)
1225 for (
j = 0;
j < HandleCount;
j++)
1230 if (
j >= HandleCount)
1232 ERR(
"Error while counting writefds %ld > %ld\n",
j, HandleCount);
1241 ERR(
"Invalid socket handle provided in writefds %d\n", writefds->fd_array[
i]);
1253 if (exceptfds !=
NULL)
1255 for (
i = 0;
i < exceptfds->fd_count;
i++)
1257 for (
j = 0;
j < HandleCount;
j++)
1262 if (
j > HandleCount)
1264 ERR(
"Error while counting exceptfds %ld > %ld\n",
j, HandleCount);
1273 TRACE(
"Invalid socket handle provided in exceptfds %d\n", exceptfds->fd_array[
i]);
1323 for (
i = 0;
i < HandleCount;
i++)
1327 for(
x = 1;
x;
x<<=1)
1332 TRACE(
"Invalid socket handle found %d\n",
Handle);
1345 TRACE(
"Event %x on handle %x\n",
1356 TRACE(
"Event %x on handle %x\n",
1363 TRACE(
"Event %x on handle %x\n",
1370 TRACE(
"Event %x on handle %x\n",
1379 TRACE(
"Event %x on handle %x\n",
1404 TRACE(
"*lpErrno = %x\n", *lpErrno);
1407 HandleCount = (readfds ? readfds->fd_count : 0) +
1408 (writefds && writefds != readfds ? writefds->fd_count : 0) +
1409 (exceptfds && exceptfds != readfds && exceptfds != writefds ? exceptfds->fd_count : 0);
1411 TRACE(
"%d events\n", HandleCount);
1419 SYSTEMTIME st1970 = { 1970, 1, 0, 1, 0, 0, 0, 0 };
1428 return (
DWORD)((
Time.ll - u1970.ll) / 10000000ULL);
1452 ULONG PendingDataLength = 0;
1453 PVOID CalleeDataBuffer;
1454 WSABUF CallerData, CalleeID, CallerID, CalleeData;
1460 UCHAR ReceiveBuffer[0x1A];
1475 if ((SocketAddress && !SocketAddressLength) ||
1476 (SocketAddressLength && !SocketAddress) ||
1477 (SocketAddressLength && *SocketAddressLength <
sizeof(
SOCKADDR)))
1529 0xA +
sizeof(*ListenReceiveData));
1544 if (lpfnCondition !=
NULL)
1560 sizeof(PendingAcceptData),
1562 sizeof(PendingAcceptData));
1580 if (PendingDataLength)
1600 sizeof(PendingAcceptData),
1641 CallerID.
len =
sizeof(*RemoteAddress);
1644 CallerData.
buf = PendingData;
1645 CallerData.
len = PendingDataLength;
1652 if (!CalleeDataBuffer) {
1655 CalleeData.
buf = CalleeDataBuffer;
1656 CalleeData.
len = 4096;
1666 CallBack = (lpfnCondition)(&CallerID,
1675 if (((CallBack ==
CF_ACCEPT) && GroupID) != 0)
1779 if (!AcceptSocketInfo)
1796 if( SocketAddressLength )
1797 *SocketAddressLength =
sizeof(*RemoteAddress);
1817 if (lpErrno) *lpErrno =
Status;
1831 const struct sockaddr * SocketAddress,
1832 int SocketAddressLength,
1844 ULONG ConnectDataLength;
1845 ULONG InConnectDataLength;
1846 INT BindAddressLength;
1849 int SocketDataLength;
1883 &BindAddressLength);
1890 if (lpCallerData !=
NULL)
1892 ConnectDataLength = lpCallerData->
len;
1947 if (lpCalleeData !=
NULL)
1949 InConnectDataLength = lpCalleeData->
len;
1956 &InConnectDataLength,
1957 sizeof(InConnectDataLength),
1973 ConnectInfo->
Root = 0;
1980 ERR(
"Async Connect UNIMPLEMENTED!\n");
2010 if (lpCalleeData !=
NULL)
2053 if (lpErrno) *lpErrno = Errno;
2067 if (lpErrno) *lpErrno = Errno;
2134 sizeof(DisconnectInfo),
2162 ULONG TdiAddressSize;
2177 if (!
Name || !NameLength)
2197 if ( TdiAddress ==
NULL )
2204 SocketAddress = &TdiAddress->
Address;
2236 TRACE(
"NameLength %d Address: %x Port %x\n",
2264 ULONG TdiAddressSize;
2284 if (!
Name || !NameLength)
2303 if ( SocketAddress ==
NULL )
2340 TRACE(
"NameLength %d Address: %x Port %x\n",
2421 NeedsCompletion =
FALSE;
2429 cbRet =
sizeof(
ULONG);
2433 if (cbOutBuffer <
sizeof(
ULONG))
2438 NeedsCompletion =
FALSE;
2442 cbRet =
sizeof(
ULONG);
2449 cbRet =
sizeof(
BOOL);
2453 if (cbOutBuffer <
sizeof(
BOOL))
2469 cbRet =
sizeof(
BOOL);
2474 if (cbOutBuffer == 0)
2476 cbRet =
sizeof(
PVOID);
2481 if (cbInBuffer <
sizeof(
GUID) ||
2482 cbOutBuffer <
sizeof(
PVOID))
2490 GUID ConnectExGUID = WSAID_CONNECTEX;
2491 GUID DisconnectExGUID = WSAID_DISCONNECTEX;
2497 cbRet =
sizeof(
PVOID);
2501 else if (
IsEqualGUID(&ConnectExGUID, lpvInBuffer))
2504 cbRet =
sizeof(
PVOID);
2508 else if (
IsEqualGUID(&DisconnectExGUID, lpvInBuffer))
2511 cbRet =
sizeof(
PVOID);
2515 else if (
IsEqualGUID(&GetAcceptExSockaddrsGUID, lpvInBuffer))
2518 cbRet =
sizeof(
PVOID);
2524 ERR(
"SIO_GET_EXTENSION_FUNCTION_POINTER UNIMPLEMENTED\n");
2529 ERR(
"Querying unknown extension function: %x\n", ((
GUID*)lpvInBuffer)->Data1);
2542 if (cbOutBuffer <
sizeof(
INT))
2576 lpCompletionRoutine,
2587 if (lpCompletionRoutine !=
NULL)
2601 if (lpcbBytesReturned)
2602 *lpcbBytesReturned = cbRet;
2632 if (!OptionLength || !OptionValue)
2750 DbgPrint(
"MSAFD: Get unknown optname %x\n", OptionName);
2778 (
LPINT)OptionLength);
2779 if (lpErrno) *lpErrno = Errno;
2816 if (optlen <
sizeof(
BOOL))
2825 if (optlen <
sizeof(
BOOL))
2834 if (optlen <
sizeof(
BOOL))
2843 if (optlen <
sizeof(
BOOL))
2852 if (optlen <
sizeof(
BOOL))
2861 if (optlen <
sizeof(
struct linger))
2872 if (optlen <
sizeof(
ULONG))
2896 if (optlen <
sizeof(
ULONG))
2903 if (*(
PULONG)optval > 0x2000)
2904 *(
PULONG)optval = 0x2000;
2924 if (optlen <
sizeof(
INT))
2936 if (optlen <
sizeof(
DWORD))
2948 if (optlen <
sizeof(
DWORD))
2966 ERR(
"MSAFD: Set unknown optname %x\n", optname);
2980 if (lpErrno) *lpErrno = Errno;
3007 if (((
LOBYTE(wVersionRequested) == 2) && (
HIBYTE(wVersionRequested) < 2)) ||
3008 (
LOBYTE(wVersionRequested) < 2))
3010 ERR(
"WSPStartup NOT SUPPORTED for version 0x%X\n", wVersionRequested);
3023 lpProcTable->lpWSPBind =
WSPBind;
3036 lpProcTable->lpWSPIoctl =
WSPIoctl;
3039 lpProcTable->lpWSPRecv =
WSPRecv;
3043 lpProcTable->lpWSPSend =
WSPSend;
3050 lpWSPData->wVersion =
MAKEWORD(2, 2);
3051 lpWSPData->wHighVersion =
MAKEWORD(2, 2);
3074 if (!lpsaAddress || !lpszAddressString || !lpdwAddressStringLength)
3080 switch (lpsaAddress->sa_family)
3090 (
unsigned int)(
ntohl(((
SOCKADDR_IN *)lpsaAddress)->sin_addr.s_addr) >> 24 & 0xff),
3091 (
unsigned int)(
ntohl(((
SOCKADDR_IN *)lpsaAddress)->sin_addr.s_addr) >> 16 & 0xff),
3092 (
unsigned int)(
ntohl(((
SOCKADDR_IN *)lpsaAddress)->sin_addr.s_addr) >> 8 & 0xff),
3093 (
unsigned int)(
ntohl(((
SOCKADDR_IN *)lpsaAddress)->sin_addr.s_addr) & 0xff),
3109 if (*lpdwAddressStringLength <
size)
3111 *lpdwAddressStringLength =
size;
3116 *lpdwAddressStringLength =
size;
3132 LONG inetaddr = 0, ip_part;
3136 if (!lpAddressLength || !lpAddress || !AddressString)
3145 if (lpProtocolInfo !=
NULL)
3147 sockaddr->sin_family = lpProtocolInfo->iAddressFamily;
3166 bp = &AddressString;
3169 while (*bp < &AddressString[
wcslen(AddressString)])
3171 ip_part =
wcstol(*bp, bp, 10);
3173 if (ip_part < 0 || ip_part > 255)
3178 inetaddr = (inetaddr << 8) + ip_part;
3180 if ((*bp)[0] == 0 || (*bp)[0] ==
L':')
3183 if ((*bp)[0] !=
L'.')
3202 if ((*bp)[0] ==
L':')
3207 if ((*bp)[0] <
L'0' || (*bp)[0] >
L'9')
3222 *lpAddressLength =
sizeof(*sockaddr);
3225 sockaddr->sin_addr.s_addr = inetaddr;
3230 if (lpErrno && !*lpErrno)
3250 TRACE(
"Leaving.\n");
3271 ULONG AfdInformationClass,
3300 if (Overlapped ==
NULL)
3313 TRACE(
"Opened without flag WSA_FLAG_OVERLAPPED. Do nothing.\n");
3322 Event = Overlapped->hEvent;
3331 ERR(
"Not enough memory for APC Context\n");
3370 TRACE(
"Leaving (Pending)\n");
3382 if (LargeInteger !=
NULL)
3386 if (Boolean !=
NULL)
3398 ULONG AfdInformationClass,
3431 if (LargeInteger !=
NULL)
3435 if (Boolean !=
NULL)
3441 if (Overlapped ==
NULL)
3454 TRACE(
"Opened without flag WSA_FLAG_OVERLAPPED. Do nothing.\n");
3463 Event = Overlapped->hEvent;
3472 ERR(
"Not enough memory for APC Context\n");
3511 TRACE(
"Leaving (Pending)\n");
3527 while (CurrentSocket)
3532 return CurrentSocket;
3577 sizeof(ContextData),
3596 DWORD AsyncThreadId;
3617 ERR(
"Failed to create completion port: 0x%08x\n",
Status);
3624 ObjectHandleFlagInformation,
3626 sizeof(HandleFlags));
3668 (
PVOID*)&AsyncCompletionRoutine,
3675 (*AsyncCompletionRoutine)(AsyncContext, &IOSB);
3732 sizeof(CompletionInfo),
3740 ObjectHandleFlagInformation,
3742 sizeof(HandleFlags));
3773 for (
x = 1;
x;
x<<=1)
3882 ULONG lNetworkEvents;
3907 if (lNetworkEvents &
FD_OOB)
3928 if (lNetworkEvents &
FD_QOS)
3981 FreeContext =
FALSE;
4002 if (!(Socket->SharedData->AsyncDisabledEvents &
Event))
4008 Socket->SharedData->AsyncDisabledEvents &=
~Event;
4011 if ((Socket->SharedData->AsyncEvents & (~Socket->SharedData->AsyncDisabledEvents)) == 0 )
4018 if (!AsyncData)
return;
4024 Socket->SharedData->SequenceNumber++;
4052 TRACE(
"Loading MSAFD.DLL \n");
4067 TRACE(
"MSAFD.DLL has been loaded\n");
4085 TRACE(
"DllMain of msafd.dll (leaving)\n");
#define InterlockedIncrement
#define InterlockedDecrement
#define UlongToHandle(ul)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
BOOL WINAPI DllMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
#define DLL_THREAD_DETACH
#define DLL_PROCESS_ATTACH
#define DLL_PROCESS_DETACH
#define INVALID_HANDLE_VALUE
#define GetCurrentProcess()
#define HeapFree(x, y, z)
#define DLL_THREAD_ATTACH
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
BOOL WINAPI SetThreadPriority(IN HANDLE hThread, IN int nPriority)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
INT WSPAPI WSPAddressToString(IN LPSOCKADDR lpsaAddress, IN DWORD dwAddressLength, IN LPWSAPROTOCOL_INFOW lpProtocolInfo, OUT LPWSTR lpszAddressString, IN OUT LPDWORD lpdwAddressStringLength, OUT LPINT lpErrno)
int WSPAPI WSPListen(SOCKET Handle, int Backlog, LPINT lpErrno)
INT WSPAPI WSPSetSockOpt(IN SOCKET s, IN INT level, IN INT optname, IN CONST CHAR FAR *optval, IN INT optlen, OUT LPINT lpErrno)
VOID SockAsyncSelectCompletionRoutine(PVOID Context, PIO_STATUS_BLOCK IoStatusBlock)
INT WSPAPI WSPCleanup(OUT LPINT lpErrno)
int GetSocketInformation(PSOCKET_INFORMATION Socket, ULONG AfdInformationClass, PBOOLEAN Boolean OPTIONAL, PULONG Ulong OPTIONAL, PLARGE_INTEGER LargeInteger OPTIONAL, LPWSAOVERLAPPED Overlapped OPTIONAL, LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine OPTIONAL)
int WSPAPI WSPConnect(SOCKET Handle, const struct sockaddr *SocketAddress, int SocketAddressLength, LPWSABUF lpCallerData, LPWSABUF lpCalleeData, LPQOS lpSQOS, LPQOS lpGQOS, LPINT lpErrno)
INT WSPAPI WSPGetSockOpt(IN SOCKET Handle, IN INT Level, IN INT OptionName, OUT CHAR FAR *OptionValue, IN OUT LPINT OptionLength, OUT LPINT lpErrno)
HANDLE SockAsyncCompletionPort
INT WSPAPI WSPBind(SOCKET Handle, const struct sockaddr *SocketAddress, int SocketAddressLength, LPINT lpErrno)
BOOLEAN SockCreateOrReferenceAsyncThread(VOID)
VOID SockProcessAsyncSelect(PSOCKET_INFORMATION Socket, PASYNC_DATA AsyncData)
LIST_ENTRY SockHelpersListHead
HANDLE SockAsyncHelperAfdHandle
DWORD GetCurrentTimeInSeconds(VOID)
PSOCKET_INFORMATION GetSocketStructure(SOCKET Handle)
INT WSPAPI WSPGetPeerName(IN SOCKET s, OUT LPSOCKADDR Name, IN OUT LPINT NameLength, OUT LPINT lpErrno)
int WSPAPI WSPSelect(IN int nfds, IN OUT fd_set *readfds OPTIONAL, IN OUT fd_set *writefds OPTIONAL, IN OUT fd_set *exceptfds OPTIONAL, IN const struct timeval *timeout OPTIONAL, OUT LPINT lpErrno)
int CreateContext(PSOCKET_INFORMATION Socket)
VOID SockProcessQueuedAsyncSelect(PVOID Context, PIO_STATUS_BLOCK IoStatusBlock)
int SetSocketInformation(PSOCKET_INFORMATION Socket, ULONG AfdInformationClass, PBOOLEAN Boolean OPTIONAL, PULONG Ulong OPTIONAL, PLARGE_INTEGER LargeInteger OPTIONAL, LPWSAOVERLAPPED Overlapped OPTIONAL, LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine OPTIONAL)
INT WSPAPI WSPDuplicateSocket(IN SOCKET Handle, IN DWORD dwProcessId, OUT LPWSAPROTOCOL_INFOW lpProtocolInfo, OUT LPINT lpErrno)
ULONG NTAPI SockAsyncThread(PVOID ThreadParam)
int WSPAPI WSPShutdown(SOCKET Handle, int HowTo, LPINT lpErrno)
INT WSPAPI WSPStringToAddress(IN LPWSTR AddressString, IN INT AddressFamily, IN LPWSAPROTOCOL_INFOW lpProtocolInfo, OUT LPSOCKADDR lpAddress, IN OUT LPINT lpAddressLength, OUT LPINT lpErrno)
_Must_inspect_result_ int WSPAPI WSPStartup(_In_ WORD wVersionRequested, _In_ LPWSPDATA lpWSPData, _In_ LPWSAPROTOCOL_INFOW lpProtocolInfo, _In_ WSPUPCALLTABLE UpcallTable, _Out_ LPWSPPROC_TABLE lpProcTable)
INT WSPAPI WSPIoctl(IN SOCKET Handle, 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)
ULONG SockAsyncThreadRefCount
INT WSPAPI WSPCloseSocket(IN SOCKET Handle, OUT LPINT lpErrno)
INT TranslateNtStatusError(NTSTATUS Status)
_Must_inspect_result_ SOCKET WSPAPI WSPAccept(_In_ SOCKET Handle, _Out_writes_bytes_to_opt_(*addrlen, *addrlen) struct sockaddr FAR *SocketAddress, _Inout_opt_ LPINT SocketAddressLength, _In_opt_ LPCONDITIONPROC lpfnCondition, _In_opt_ DWORD_PTR dwCallbackData, _Out_ LPINT lpErrno)
SOCKET WSPAPI WSPSocket(int AddressFamily, int SocketType, int Protocol, LPWSAPROTOCOL_INFOW lpProtocolInfo, GROUP g, DWORD dwFlags, LPINT lpErrno)
VOID NTAPI AfdInfoAPC(PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG Reserved)
INT WSPAPI WSPGetSockName(IN SOCKET Handle, OUT LPSOCKADDR Name, IN OUT LPINT NameLength, OUT LPINT lpErrno)
BOOLEAN SockAsyncSelectCalled
VOID SockReenableAsyncSelectEvent(IN PSOCKET_INFORMATION Socket, IN ULONG Event)
BOOLEAN SockGetAsyncSelectHelperAfdHandle(VOID)
PSOCKET_INFORMATION SocketListHead
CRITICAL_SECTION SocketListLock
LPWPUCOMPLETEOVERLAPPEDREQUEST lpWPUCompleteOverlappedRequest
INT WSPAPI WSPEnumNetworkEvents(IN SOCKET Handle, IN WSAEVENT hEventObject, OUT LPWSANETWORKEVENTS lpNetworkEvents, OUT LPINT lpErrno)
int WSPAPI WSPEventSelect(IN SOCKET Handle, IN WSAEVENT hEventObject, IN long lNetworkEvents, OUT LPINT lpErrno)
INT WSPAPI WSPCancelBlockingCall(OUT LPINT lpErrno)
BOOL WSPAPI WSPConnectEx(IN SOCKET s, IN const struct sockaddr *name, IN int namelen, IN PVOID lpSendBuffer, IN DWORD dwSendDataLength, OUT LPDWORD lpdwBytesSent, IN OUT LPOVERLAPPED lpOverlapped)
BOOL WSPAPI WSPAcceptEx(IN SOCKET sListenSocket, IN SOCKET sAcceptSocket, OUT PVOID lpOutputBuffer, IN DWORD dwReceiveDataLength, IN DWORD dwLocalAddressLength, IN DWORD dwRemoteAddressLength, OUT LPDWORD lpdwBytesReceived, IN OUT LPOVERLAPPED lpOverlapped)
VOID WSPAPI WSPGetAcceptExSockaddrs(IN PVOID lpOutputBuffer, IN DWORD dwReceiveDataLength, IN DWORD dwLocalAddressLength, IN DWORD dwRemoteAddressLength, OUT struct sockaddr **LocalSockaddr, OUT LPINT LocalSockaddrLength, OUT struct sockaddr **RemoteSockaddr, OUT LPINT RemoteSockaddrLength)
BOOL WSPAPI WSPDisconnectEx(IN SOCKET hSocket, IN LPOVERLAPPED lpOverlapped, IN DWORD dwFlags, IN DWORD reserved)
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)
BOOL WSPAPI WSPGetQOSByName(IN SOCKET s, IN OUT LPWSABUF lpQOSName, OUT LPQOS lpQOS, OUT LPINT lpErrno)
enum _SOCKET_STATE SOCKET_STATE
FORCEINLINE DWORD MsafdReturnWithErrno(NTSTATUS Status, LPINT Errno, DWORD Received, LPDWORD ReturnedBytes)
struct _AFDAPCCONTEXT * PAFDAPCCONTEXT
VOID(* PASYNC_COMPLETION_ROUTINE)(PVOID Context, PIO_STATUS_BLOCK IoStatusBlock)
#define SO_SYNCHRONOUS_NONALERT
struct _IO_STATUS_BLOCK * PIO_STATUS_BLOCK
#define InitializeListHead(ListHead)
@ FileCompletionInformation
struct _FILE_FULL_EA_INFORMATION FILE_FULL_EA_INFORMATION
GLint GLint GLint GLint GLint x
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
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 GLint GLint j
int SockGetTdiName(PINT AddressFamily, PINT SocketType, PINT Protocol, GROUP Group, DWORD Flags, PUNICODE_STRING TransportName, PVOID *HelperDllContext, PHELPER_DATA *HelperDllData, PDWORD Events)
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_CASE_INSENSITIVE
NTSYSAPI LONGLONG WINAPI RtlConvertLongToLargeInteger(LONG)
NTSYSAPI LONGLONG WINAPI RtlEnlargedIntegerMultiply(INT, INT)
#define PROCESS_DUP_HANDLE
NTSTATUS NTAPI NtSetIoCompletion(IN HANDLE IoCompletionPortHandle, IN PVOID CompletionKey, IN PVOID CompletionContext, IN NTSTATUS CompletionStatus, IN ULONG CompletionInformation)
NTSTATUS NTAPI NtRemoveIoCompletion(IN HANDLE IoCompletionHandle, OUT PVOID *KeyContext, OUT PVOID *ApcContext, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER Timeout OPTIONAL)
NTSTATUS NTAPI NtCreateIoCompletion(OUT PHANDLE IoCompletionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG NumberOfConcurrentThreads)
BOOL WINAPI PostQueuedCompletionStatus(IN HANDLE CompletionHandle, IN DWORD dwNumberOfBytesTransferred, IN ULONG_PTR dwCompletionKey, IN LPOVERLAPPED lpOverlapped)
_In_ BOOL _In_ HANDLE hProcess
#define IO_COMPLETION_ALL_ACCESS
static OUT PIO_STATUS_BLOCK IoStatusBlock
#define InitializeObjectAttributes(p, n, a, r, s)
static PLARGE_INTEGER Time
#define WSAID_GETACCEPTEXSOCKADDRS
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED lpOverlapped
IN PCO_ADDRESS_FAMILY AddressFamily
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE _In_opt_ PVOID ApcContext
#define _Must_inspect_result_
#define _Out_writes_bytes_to_opt_(s, c)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI NTSTATUS NTAPI NtSetInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
VOID(* PIO_APC_ROUTINE)(IN PVOID ApcContext, IN PIO_STATUS_BLOCK IoStatusBlock, IN ULONG Reserved)
NTSTATUS NTAPI NtCreateEvent(OUT PHANDLE EventHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN EVENT_TYPE EventType, IN BOOLEAN InitialState)
#define STATUS_INVALID_ADDRESS
#define STATUS_NETWORK_UNREACHABLE
#define STATUS_ADDRESS_ALREADY_EXISTS
#define STATUS_FILE_CLOSED
#define STATUS_HOST_UNREACHABLE
#define STATUS_REMOTE_DISCONNECT
#define STATUS_INVALID_CONNECTION
#define STATUS_ACCESS_VIOLATION
#define STATUS_REMOTE_NOT_LISTENING
#define STATUS_LOCAL_DISCONNECT
#define STATUS_PROTOCOL_NOT_SUPPORTED
NTSTATUS NTAPI NtSetInformationObject(IN HANDLE ObjectHandle, IN OBJECT_INFORMATION_CLASS ObjectInformationClass, IN PVOID ObjectInformation, IN ULONG Length)
#define IsEqualGUID(rguid1, rguid2)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define AFD_INFO_SEND_WINDOW_SIZE
#define AFD_SHARE_WILDCARD
#define AFD_INFO_RECEIVE_WINDOW_SIZE
struct _AFD_POLL_INFO * PAFD_POLL_INFO
#define AFD_DISCONNECT_RECV
struct _AFD_CREATE_PACKET * PAFD_CREATE_PACKET
#define IOCTL_AFD_SET_INFO
#define AFD_INFO_RECEIVE_CONTENT_SIZE
#define IOCTL_AFD_WAIT_FOR_LISTEN
#define AFD_PACKET_COMMAND_LENGTH
#define IOCTL_AFD_GET_SOCK_NAME
#define IOCTL_AFD_DEFER_ACCEPT
#define IOCTL_AFD_START_LISTEN
#define AFD_EVENT_OOB_RECEIVE
#define AFD_EVENT_CONNECT_FAIL
#define AFD_EVENT_RECEIVE
struct _AFD_RECEIVED_ACCEPT_DATA * PAFD_RECEIVED_ACCEPT_DATA
struct _AFD_HANDLE_ AFD_HANDLE
#define AFD_DISCONNECT_ABORT
#define AFD_EVENT_DISCONNECT
#define AFD_ENDPOINT_D_ROOT
#define AFD_INFO_BLOCKING_MODE
#define AFD_ENDPOINT_MULTIPOINT
#define IOCTL_AFD_GET_INFO
#define IOCTL_AFD_SET_CONNECT_DATA
#define IOCTL_AFD_CONNECT
#define AFD_SHARE_EXCLUSIVE
#define IOCTL_AFD_DISCONNECT
#define AFD_ENDPOINT_MESSAGE_ORIENTED
struct _AFD_CREATE_PACKET AFD_CREATE_PACKET
#define AFD_INFO_SENDS_IN_PROGRESS
#define AFD_ENDPOINT_CONNECTIONLESS
#define IOCTL_AFD_GET_PENDING_CONNECT_DATA
#define AFD_EVENT_CONNECT
#define AFD_EVENT_GROUP_QOS
#define IOCTL_AFD_SET_CONNECT_DATA_SIZE
#define IOCTL_AFD_GET_PEER_NAME
#define IOCTL_AFD_SET_CONTEXT
#define AFD_ENDPOINT_C_ROOT
#define AFD_INFO_GROUP_ID_TYPE
#define IOCTL_AFD_GET_CONNECT_DATA
#define AFD_DISCONNECT_SEND
#define STATUS_END_OF_FILE
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_BUFFER_OVERFLOW
INT WSPAPI WSPSendDisconnect(IN SOCKET s, IN LPWSABUF lpOutboundDisconnectData, OUT LPINT lpErrno)
int WSPAPI WSPRecvFrom(SOCKET Handle, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRead, LPDWORD ReceiveFlags, struct sockaddr *SocketAddress, int *SocketAddressLength, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, LPWSATHREADID lpThreadId, LPINT lpErrno)
BOOL WSPAPI WSPGetOverlappedResult(IN SOCKET Handle, IN LPWSAOVERLAPPED lpOverlapped, OUT LPDWORD lpdwBytes, IN BOOL fWait, OUT LPDWORD lpdwFlags, OUT LPINT lpErrno)
INT WSPAPI WSPAsyncSelect(IN SOCKET Handle, IN HWND hWnd, IN UINT wMsg, IN LONG lEvent, OUT LPINT lpErrno)
int WSPAPI WSPSendTo(SOCKET Handle, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesSent, DWORD iFlags, const struct sockaddr *SocketAddress, int SocketAddressLength, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, LPWSATHREADID lpThreadId, LPINT lpErrno)
int WSPAPI WSPSend(SOCKET Handle, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesSent, DWORD iFlags, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, LPWSATHREADID lpThreadId, LPINT lpErrno)
int WSPAPI WSPRecv(SOCKET Handle, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRead, LPDWORD ReceiveFlags, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, LPWSATHREADID lpThreadId, LPINT lpErrno)
INT WSPAPI WSPRecvDisconnect(IN SOCKET s, OUT LPWSABUF lpInboundDisconnectData, OUT LPINT lpErrno)
PULONG MinorVersion OPTIONAL
PSOCKET_INFORMATION lpSocket
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
LPWSAOVERLAPPED lpOverlapped
TRANSPORT_ADDRESS Address
TRANSPORT_ADDRESS RemoteAddress
DWORD SizeOfTransportName
union _AFD_INFO::@3388 Information
LARGE_INTEGER LargeInteger
BOOLEAN UseDelayedAcceptance
TRANSPORT_ADDRESS Address
AFD_POLL_INFO AsyncSelectInfo
PSOCKET_INFORMATION ParentSocket
IO_STATUS_BLOCK IoStatusBlock
BOOLEAN UseDelayedAcceptance
PWSH_GET_SOCKADDR_TYPE WSHGetSockaddrType
PWSH_GET_SOCKET_INFORMATION WSHGetSocketInformation
PWSH_SET_SOCKET_INFORMATION WSHSetSocketInformation
PWSH_GET_WILDCARD_SOCKADDR WSHGetWildcardSockaddr
SOCKADDR_ADDRESS_INFO AddressInfo
SOCKADDR_ENDPOINT_INFO EndpointInfo
SOCK_SHARED_INFO SharedData
BOOLEAN ExclusiveAddressUse
BOOLEAN UseDelayedAcceptance
TRANSPORT_ADDRESS Address
LPWPUMODIFYIFSHANDLE lpWPUModifyIFSHandle
LPWPUPOSTMESSAGE lpWPUPostMessage
SOCKET fd_array[FD_SETSIZE]
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
struct _TRANSPORT_ADDRESS TRANSPORT_ADDRESS
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_ACCESS_DENIED
#define STATUS_INVALID_PARAMETER
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine
DWORD WINAPI GetLastError(void)
#define CreateFileMapping
HANDLE WINAPI GetCurrentThread(void)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define FILE_MAP_ALL_ACCESS
#define THREAD_PRIORITY_ABOVE_NORMAL
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
_Reserved_ PVOID Reserved
_In_ DWORD dwIoControlCode
#define WSAVERNOTSUPPORTED
#define WSA_FLAG_MULTIPOINT_D_LEAF
#define XP1_MULTIPOINT_DATA_PLANE
#define XP1_CONNECTIONLESS
#define WSA_FLAG_MULTIPOINT_C_ROOT
#define WSA_OPERATION_ABORTED
#define XP1_SUPPORT_MULTIPOINT
#define XP1_QOS_SUPPORTED
#define XP1_PSEUDO_STREAM
#define XP1_MULTIPOINT_CONTROL_PLANE
void(CALLBACK * LPWSAOVERLAPPED_COMPLETION_ROUTINE)(IN DWORD dwError, IN DWORD cbTransferred, IN LPWSAOVERLAPPED lpOverlapped, IN DWORD dwFlags)
#define XP1_MESSAGE_ORIENTED
#define WSA_FLAG_MULTIPOINT_D_ROOT
#define SO_PROTOCOL_INFOW
#define WSA_FLAG_MULTIPOINT_C_LEAF
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)
struct sockaddr_in SOCKADDR_IN
#define WSAMAKESELECTREPLY(e, error)
#define IS_INTRESOURCE(i)
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
#define SO_CONDITIONAL_ACCEPT
#define SO_EXCLUSIVEADDRUSE
#define SIO_ADDRESS_LIST_QUERY
struct _SOCKET_ADDRESS_LIST SOCKET_ADDRESS_LIST
#define SO_GROUP_PRIORITY
#define SIO_GET_EXTENSION_FUNCTION_POINTER
int(WSPAPI * LPWPUCOMPLETEOVERLAPPEDREQUEST)(_In_ SOCKET s, _Inout_ LPWSAOVERLAPPED lpOverlapped, _In_ DWORD dwError, _In_ DWORD cbTransferred, _Out_ LPINT lpErrno)
#define WSH_NOTIFY_LISTEN
@ SockaddrEndpointInfoWildcard
@ SockaddrAddressInfoBroadcast
#define WSH_NOTIFY_CONNECT_ERROR
#define WSH_NOTIFY_ACCEPT
#define WSH_NOTIFY_CONNECT
_Must_inspect_result_ _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _In_opt_ PWSK_SOCKET AcceptSocket
_Must_inspect_result_ _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR RemoteAddress
#define DUPLICATE_SAME_ACCESS