2006-02-17 00:04:10 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS Ancillary Function Driver DLL
|
2015-11-02 17:35:58 +00:00
|
|
|
* FILE: dll/win32/msafd/msafd.h
|
2006-02-17 00:04:10 +00:00
|
|
|
* PURPOSE: Ancillary Function Driver DLL header
|
|
|
|
*/
|
2014-01-23 18:01:03 +00:00
|
|
|
|
2006-02-17 00:04:10 +00:00
|
|
|
#ifndef __MSAFD_H
|
|
|
|
#define __MSAFD_H
|
|
|
|
|
2014-01-23 18:01:03 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2006-02-17 00:04:10 +00:00
|
|
|
#define WIN32_NO_STATUS
|
2013-01-24 23:00:42 +00:00
|
|
|
#define _INC_WINDOWS
|
|
|
|
#define COM_NO_WINDOWS_H
|
2014-01-23 18:01:03 +00:00
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
2006-02-17 00:04:10 +00:00
|
|
|
#include <ws2spi.h>
|
|
|
|
#define NTOS_MODE_USER
|
2011-08-14 17:31:30 +00:00
|
|
|
#include <ndk/exfuncs.h>
|
|
|
|
#include <ndk/iofuncs.h>
|
|
|
|
#include <ndk/obfuncs.h>
|
|
|
|
#include <ndk/rtlfuncs.h>
|
2006-02-17 00:04:10 +00:00
|
|
|
|
|
|
|
/* This includes ntsecapi.h so it needs to come after the NDK */
|
|
|
|
#include <wsahelp.h>
|
|
|
|
#include <tdi.h>
|
|
|
|
#include <afd/shared.h>
|
2016-10-13 20:30:42 +00:00
|
|
|
#include <mswsock.h>
|
2017-12-09 12:24:35 +00:00
|
|
|
|
|
|
|
#include <wine/debug.h>
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msafd);
|
|
|
|
|
2014-11-10 13:06:48 +00:00
|
|
|
#include "include/helpers.h"
|
2011-08-11 15:12:53 +00:00
|
|
|
|
2006-02-17 00:04:10 +00:00
|
|
|
extern HANDLE GlobalHeap;
|
|
|
|
extern WSPUPCALLTABLE Upcalls;
|
|
|
|
extern LPWPUCOMPLETEOVERLAPPEDREQUEST lpWPUCompleteOverlappedRequest;
|
|
|
|
extern LIST_ENTRY SockHelpersListHead;
|
|
|
|
extern HANDLE SockEvent;
|
|
|
|
extern HANDLE SockAsyncCompletionPort;
|
|
|
|
extern BOOLEAN SockAsyncSelectCalled;
|
|
|
|
|
|
|
|
typedef enum _SOCKET_STATE {
|
|
|
|
SocketOpen,
|
|
|
|
SocketBound,
|
|
|
|
SocketBoundUdp,
|
|
|
|
SocketConnected,
|
|
|
|
SocketClosed
|
|
|
|
} SOCKET_STATE, *PSOCKET_STATE;
|
|
|
|
|
|
|
|
typedef struct _SOCK_SHARED_INFO {
|
|
|
|
SOCKET_STATE State;
|
2016-10-07 17:51:03 +00:00
|
|
|
LONG RefCount;
|
2006-02-17 00:04:10 +00:00
|
|
|
INT AddressFamily;
|
|
|
|
INT SocketType;
|
|
|
|
INT Protocol;
|
|
|
|
INT SizeOfLocalAddress;
|
|
|
|
INT SizeOfRemoteAddress;
|
|
|
|
struct linger LingerData;
|
|
|
|
ULONG SendTimeout;
|
|
|
|
ULONG RecvTimeout;
|
|
|
|
ULONG SizeOfRecvBuffer;
|
|
|
|
ULONG SizeOfSendBuffer;
|
2016-11-10 17:55:00 +00:00
|
|
|
ULONG ConnectTime;
|
2006-02-17 00:04:10 +00:00
|
|
|
struct {
|
|
|
|
BOOLEAN Listening:1;
|
|
|
|
BOOLEAN Broadcast:1;
|
|
|
|
BOOLEAN Debug:1;
|
|
|
|
BOOLEAN OobInline:1;
|
|
|
|
BOOLEAN ReuseAddresses:1;
|
|
|
|
BOOLEAN ExclusiveAddressUse:1;
|
|
|
|
BOOLEAN NonBlocking:1;
|
|
|
|
BOOLEAN DontUseWildcard:1;
|
|
|
|
BOOLEAN ReceiveShutdown:1;
|
|
|
|
BOOLEAN SendShutdown:1;
|
|
|
|
BOOLEAN UseDelayedAcceptance:1;
|
|
|
|
BOOLEAN UseSAN:1;
|
|
|
|
}; // Flags
|
|
|
|
DWORD CreateFlags;
|
|
|
|
DWORD ServiceFlags1;
|
|
|
|
DWORD ProviderFlags;
|
|
|
|
GROUP GroupID;
|
|
|
|
DWORD GroupType;
|
|
|
|
INT GroupPriority;
|
|
|
|
INT SocketLastError;
|
|
|
|
HWND hWnd;
|
|
|
|
LONG Unknown;
|
|
|
|
DWORD SequenceNumber;
|
|
|
|
UINT wMsg;
|
|
|
|
LONG AsyncEvents;
|
|
|
|
LONG AsyncDisabledEvents;
|
2016-10-07 17:51:03 +00:00
|
|
|
SOCKADDR WSLocalAddress;
|
|
|
|
SOCKADDR WSRemoteAddress;
|
2006-02-17 00:04:10 +00:00
|
|
|
} SOCK_SHARED_INFO, *PSOCK_SHARED_INFO;
|
|
|
|
|
|
|
|
typedef struct _SOCKET_INFORMATION {
|
|
|
|
SOCKET Handle;
|
2016-10-07 17:51:03 +00:00
|
|
|
PSOCK_SHARED_INFO SharedData;
|
|
|
|
HANDLE SharedDataHandle;
|
2006-02-17 00:04:10 +00:00
|
|
|
DWORD HelperEvents;
|
|
|
|
PHELPER_DATA HelperData;
|
|
|
|
PVOID HelperContext;
|
|
|
|
PSOCKADDR LocalAddress;
|
|
|
|
PSOCKADDR RemoteAddress;
|
|
|
|
HANDLE TdiAddressHandle;
|
|
|
|
HANDLE TdiConnectionHandle;
|
|
|
|
PVOID AsyncData;
|
|
|
|
HANDLE EventObject;
|
|
|
|
LONG NetworkEvents;
|
|
|
|
CRITICAL_SECTION Lock;
|
|
|
|
PVOID SanData;
|
|
|
|
BOOL TrySAN;
|
2015-11-07 10:48:38 +00:00
|
|
|
WSAPROTOCOL_INFOW ProtocolInfo;
|
2010-06-07 00:24:27 +00:00
|
|
|
struct _SOCKET_INFORMATION *NextSocket;
|
2006-02-17 00:04:10 +00:00
|
|
|
} SOCKET_INFORMATION, *PSOCKET_INFORMATION;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _SOCKET_CONTEXT {
|
|
|
|
SOCK_SHARED_INFO SharedData;
|
|
|
|
ULONG SizeOfHelperData;
|
|
|
|
ULONG Padding;
|
|
|
|
SOCKADDR LocalAddress;
|
|
|
|
SOCKADDR RemoteAddress;
|
|
|
|
/* Plus Helper Data */
|
|
|
|
} SOCKET_CONTEXT, *PSOCKET_CONTEXT;
|
|
|
|
|
|
|
|
typedef struct _ASYNC_DATA {
|
|
|
|
PSOCKET_INFORMATION ParentSocket;
|
|
|
|
DWORD SequenceNumber;
|
|
|
|
IO_STATUS_BLOCK IoStatusBlock;
|
|
|
|
AFD_POLL_INFO AsyncSelectInfo;
|
|
|
|
} ASYNC_DATA, *PASYNC_DATA;
|
|
|
|
|
2016-10-13 20:30:42 +00:00
|
|
|
typedef struct _AFDAPCCONTEXT
|
|
|
|
{
|
|
|
|
LPWSAOVERLAPPED lpOverlapped;
|
|
|
|
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine;
|
|
|
|
PSOCKET_INFORMATION lpSocket;
|
|
|
|
} AFDAPCCONTEXT, *PAFDAPCCONTEXT;
|
|
|
|
|
2018-04-23 09:42:32 +00:00
|
|
|
_Must_inspect_result_
|
2006-02-17 00:04:10 +00:00
|
|
|
SOCKET
|
|
|
|
WSPAPI
|
|
|
|
WSPAccept(
|
2018-04-23 09:42:32 +00:00
|
|
|
_In_ SOCKET s,
|
|
|
|
_Out_writes_bytes_to_opt_(*addrlen, *addrlen) struct sockaddr FAR * addr,
|
|
|
|
_Inout_opt_ LPINT addrlen,
|
|
|
|
_In_opt_ LPCONDITIONPROC lpfnCondition,
|
|
|
|
_In_opt_ DWORD_PTR dwCallbackData,
|
|
|
|
_Out_ LPINT lpErrno);
|
2006-02-17 00:04:10 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
WSPAsyncSelect(
|
2011-10-03 14:40:39 +00:00
|
|
|
IN SOCKET s,
|
|
|
|
IN HWND hWnd,
|
|
|
|
IN UINT wMsg,
|
|
|
|
IN LONG lEvent,
|
2006-02-17 00:04:10 +00:00
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
INT
|
|
|
|
WSPAPI WSPBind(
|
|
|
|
IN SOCKET s,
|
2011-10-03 14:40:39 +00:00
|
|
|
IN CONST SOCKADDR *name,
|
|
|
|
IN INT namelen,
|
2006-02-17 00:04:10 +00:00
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
INT
|
|
|
|
WSPAPI
|
|
|
|
WSPCancelBlockingCall(
|
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
INT
|
|
|
|
WSPAPI
|
|
|
|
WSPCleanup(
|
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
INT
|
|
|
|
WSPAPI
|
|
|
|
WSPCloseSocket(
|
|
|
|
IN SOCKET s,
|
|
|
|
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
|
|
|
|
WSPDuplicateSocket(
|
|
|
|
IN SOCKET s,
|
|
|
|
IN DWORD dwProcessId,
|
|
|
|
OUT LPWSAPROTOCOL_INFOW lpProtocolInfo,
|
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
INT
|
|
|
|
WSPAPI
|
|
|
|
WSPEnumNetworkEvents(
|
2011-10-03 14:40:39 +00:00
|
|
|
IN SOCKET s,
|
|
|
|
IN WSAEVENT hEventObject,
|
|
|
|
OUT LPWSANETWORKEVENTS lpNetworkEvents,
|
2006-02-17 00:04:10 +00:00
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
INT
|
|
|
|
WSPAPI
|
|
|
|
WSPEventSelect(
|
|
|
|
IN SOCKET s,
|
|
|
|
IN WSAEVENT hEventObject,
|
|
|
|
IN LONG lNetworkEvents,
|
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
BOOL
|
|
|
|
WSPAPI
|
|
|
|
WSPGetOverlappedResult(
|
|
|
|
IN SOCKET s,
|
|
|
|
IN LPWSAOVERLAPPED lpOverlapped,
|
|
|
|
OUT LPDWORD lpcbTransfer,
|
|
|
|
IN BOOL fWait,
|
|
|
|
OUT LPDWORD lpdwFlags,
|
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
INT
|
|
|
|
WSPAPI
|
|
|
|
WSPGetPeerName(
|
2011-10-03 14:40:39 +00:00
|
|
|
IN SOCKET s,
|
|
|
|
OUT LPSOCKADDR name,
|
|
|
|
IN OUT LPINT namelen,
|
2006-02-17 00:04:10 +00:00
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
BOOL
|
|
|
|
WSPAPI
|
|
|
|
WSPGetQOSByName(
|
2011-10-03 14:40:39 +00:00
|
|
|
IN SOCKET s,
|
|
|
|
IN OUT LPWSABUF lpQOSName,
|
|
|
|
OUT LPQOS lpQOS,
|
2006-02-17 00:04:10 +00:00
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
INT
|
|
|
|
WSPAPI
|
|
|
|
WSPGetSockName(
|
|
|
|
IN SOCKET s,
|
|
|
|
OUT LPSOCKADDR name,
|
|
|
|
IN OUT LPINT namelen,
|
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
INT
|
|
|
|
WSPAPI
|
|
|
|
WSPGetSockOpt(
|
|
|
|
IN SOCKET s,
|
|
|
|
IN INT level,
|
|
|
|
IN INT optname,
|
|
|
|
OUT CHAR FAR* optval,
|
|
|
|
IN OUT LPINT optlen,
|
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
INT
|
|
|
|
WSPAPI
|
|
|
|
WSPListen(
|
|
|
|
IN SOCKET s,
|
|
|
|
IN INT backlog,
|
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
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
|
|
|
|
WSPRecvDisconnect(
|
|
|
|
IN SOCKET s,
|
|
|
|
OUT LPWSABUF lpInboundDisconnectData,
|
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
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
|
|
|
|
WSPSelect(
|
|
|
|
IN INT nfds,
|
2010-04-07 15:16:21 +00:00
|
|
|
IN OUT fd_set *readfds,
|
|
|
|
IN OUT fd_set *writefds,
|
|
|
|
IN OUT fd_set *exceptfds,
|
|
|
|
IN CONST struct timeval *timeout,
|
2006-02-17 00:04:10 +00:00
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
INT
|
|
|
|
WSPAPI
|
|
|
|
WSPSendDisconnect(
|
|
|
|
IN SOCKET s,
|
|
|
|
IN LPWSABUF lpOutboundDisconnectData,
|
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
INT
|
|
|
|
WSPAPI
|
|
|
|
WSPSetSockOpt(
|
|
|
|
IN SOCKET s,
|
|
|
|
IN INT level,
|
|
|
|
IN INT optname,
|
|
|
|
IN CONST CHAR FAR* optval,
|
|
|
|
IN INT optlen,
|
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
INT
|
|
|
|
WSPAPI
|
|
|
|
WSPShutdown(
|
|
|
|
IN SOCKET s,
|
|
|
|
IN INT how,
|
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
INT
|
|
|
|
WSPAPI
|
|
|
|
WSPStringToAddress(
|
|
|
|
IN LPWSTR AddressString,
|
|
|
|
IN INT AddressFamily,
|
|
|
|
IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
|
|
|
|
OUT LPSOCKADDR lpAddress,
|
|
|
|
IN OUT LPINT lpAddressLength,
|
|
|
|
OUT LPINT lpErrno);
|
|
|
|
|
2019-02-16 12:46:40 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
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
|
|
|
|
WSPDisconnectEx(
|
|
|
|
IN SOCKET hSocket,
|
|
|
|
IN LPOVERLAPPED lpOverlapped,
|
|
|
|
IN DWORD dwFlags,
|
|
|
|
IN DWORD reserved);
|
|
|
|
|
|
|
|
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);
|
2006-02-17 00:04:10 +00:00
|
|
|
|
|
|
|
PSOCKET_INFORMATION GetSocketStructure(
|
|
|
|
SOCKET Handle
|
|
|
|
);
|
|
|
|
|
2010-05-28 03:55:50 +00:00
|
|
|
INT TranslateNtStatusError( NTSTATUS Status );
|
|
|
|
|
2006-02-17 00:04:10 +00:00
|
|
|
VOID DeleteSocketStructure( SOCKET Handle );
|
|
|
|
|
|
|
|
int GetSocketInformation(
|
|
|
|
PSOCKET_INFORMATION Socket,
|
|
|
|
ULONG AfdInformationClass,
|
2011-07-04 17:37:45 +00:00
|
|
|
PBOOLEAN Boolean OPTIONAL,
|
|
|
|
PULONG Ulong OPTIONAL,
|
2016-10-25 07:54:00 +00:00
|
|
|
PLARGE_INTEGER LargeInteger OPTIONAL,
|
|
|
|
LPWSAOVERLAPPED Overlapped OPTIONAL,
|
|
|
|
LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine OPTIONAL
|
2006-02-17 00:04:10 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
int SetSocketInformation(
|
|
|
|
PSOCKET_INFORMATION Socket,
|
|
|
|
ULONG AfdInformationClass,
|
2011-07-04 17:37:45 +00:00
|
|
|
PBOOLEAN Boolean OPTIONAL,
|
|
|
|
PULONG Ulong OPTIONAL,
|
2016-10-25 07:54:00 +00:00
|
|
|
PLARGE_INTEGER LargeInteger OPTIONAL,
|
|
|
|
LPWSAOVERLAPPED Overlapped OPTIONAL,
|
|
|
|
LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine OPTIONAL
|
2006-02-17 00:04:10 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
int CreateContext(
|
|
|
|
PSOCKET_INFORMATION Socket
|
|
|
|
);
|
|
|
|
|
2017-10-27 22:47:30 +00:00
|
|
|
ULONG
|
|
|
|
NTAPI
|
|
|
|
SockAsyncThread(
|
2006-02-17 00:04:10 +00:00
|
|
|
PVOID ThreadParam
|
|
|
|
);
|
|
|
|
|
2011-10-03 14:40:39 +00:00
|
|
|
VOID
|
2006-02-17 00:04:10 +00:00
|
|
|
SockProcessAsyncSelect(
|
|
|
|
PSOCKET_INFORMATION Socket,
|
|
|
|
PASYNC_DATA AsyncData
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
SockAsyncSelectCompletionRoutine(
|
|
|
|
PVOID Context,
|
|
|
|
PIO_STATUS_BLOCK IoStatusBlock
|
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
SockCreateOrReferenceAsyncThread(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN SockGetAsyncSelectHelperAfdHandle(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID SockProcessQueuedAsyncSelect(
|
|
|
|
PVOID Context,
|
|
|
|
PIO_STATUS_BLOCK IoStatusBlock
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
SockReenableAsyncSelectEvent (
|
|
|
|
IN PSOCKET_INFORMATION Socket,
|
|
|
|
IN ULONG Event
|
|
|
|
);
|
|
|
|
|
|
|
|
typedef VOID (*PASYNC_COMPLETION_ROUTINE)(PVOID Context, PIO_STATUS_BLOCK IoStatusBlock);
|
2011-10-03 14:40:39 +00:00
|
|
|
|
2010-06-27 17:21:03 +00:00
|
|
|
FORCEINLINE
|
2014-05-04 09:15:06 +00:00
|
|
|
DWORD
|
2010-06-27 17:21:03 +00:00
|
|
|
MsafdReturnWithErrno(NTSTATUS Status,
|
|
|
|
LPINT Errno,
|
|
|
|
DWORD Received,
|
|
|
|
LPDWORD ReturnedBytes)
|
|
|
|
{
|
|
|
|
if (Errno)
|
|
|
|
{
|
|
|
|
*Errno = TranslateNtStatusError(Status);
|
|
|
|
|
|
|
|
if (ReturnedBytes)
|
|
|
|
*ReturnedBytes = (*Errno == 0) ? Received : 0;
|
|
|
|
|
|
|
|
return (*Errno == 0) ? 0 : SOCKET_ERROR;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-10-03 15:01:48 +00:00
|
|
|
DbgPrint("%s: Received invalid lpErrno pointer!\n", __FUNCTION__);
|
2010-06-27 17:21:03 +00:00
|
|
|
|
|
|
|
if (ReturnedBytes)
|
|
|
|
*ReturnedBytes = (Status == STATUS_SUCCESS) ? Received : 0;
|
|
|
|
|
|
|
|
return (Status == STATUS_SUCCESS) ? 0 : SOCKET_ERROR;
|
|
|
|
}
|
|
|
|
}
|
2006-02-17 00:04:10 +00:00
|
|
|
|
|
|
|
#endif /* __MSAFD_H */
|