ReactOS  0.4.13-dev-99-g7e18b6d
extensions.c File Reference
#include "precomp.h"
#include <winsock2.h>
#include <mswsock.h>
Include dependency graph for extensions.c:

Go to the source code of this file.

Functions

BOOL WINAPI TransmitFile (SOCKET Socket, HANDLE File, DWORD NumberOfBytesToWrite, DWORD NumberOfBytesPerSend, LPOVERLAPPED Overlapped, LPTRANSMIT_FILE_BUFFERS TransmitBuffers, DWORD Flags)
 
BOOL WINAPI AcceptEx (SOCKET ListenSocket, SOCKET AcceptSocket, PVOID OutputBuffer, DWORD ReceiveDataLength, DWORD LocalAddressLength, DWORD RemoteAddressLength, LPDWORD BytesReceived, LPOVERLAPPED Overlapped)
 
VOID WINAPI GetAcceptExSockaddrs (PVOID OutputBuffer, DWORD ReceiveDataLength, DWORD LocalAddressLength, DWORD RemoteAddressLength, LPSOCKADDR *LocalSockaddr, LPINT LocalSockaddrLength, LPSOCKADDR *RemoteSockaddr, LPINT RemoteSockaddrLength)
 

Variables

LPFN_TRANSMITFILE pfnTransmitFile = NULL
 
LPFN_GETACCEPTEXSOCKADDRS pfnGetAcceptExSockaddrs = NULL
 
LPFN_ACCEPTEX pfnAcceptEx = NULL
 

Function Documentation

◆ AcceptEx()

BOOL WINAPI AcceptEx ( SOCKET  ListenSocket,
SOCKET  AcceptSocket,
PVOID  OutputBuffer,
DWORD  ReceiveDataLength,
DWORD  LocalAddressLength,
DWORD  RemoteAddressLength,
LPDWORD  BytesReceived,
LPOVERLAPPED  Overlapped 
)

Definition at line 61 of file extensions.c.

69 {
70  GUID AcceptExGUID = WSAID_ACCEPTEX;
71  GUID GetAcceptExSockaddrsGUID = WSAID_GETACCEPTEXSOCKADDRS;
72  DWORD cbBytesReturned;
73 
74  if (WSAIoctl(ListenSocket,
76  &AcceptExGUID,
77  sizeof(AcceptExGUID),
78  &pfnAcceptEx,
79  sizeof(pfnAcceptEx),
80  &cbBytesReturned,
81  NULL,
82  NULL) == SOCKET_ERROR)
83  {
84  return FALSE;
85  }
86 
87  if (WSAIoctl(ListenSocket,
89  &GetAcceptExSockaddrsGUID,
90  sizeof(GetAcceptExSockaddrsGUID),
93  &cbBytesReturned,
94  NULL,
95  NULL) == SOCKET_ERROR)
96  {
97  pfnAcceptEx = NULL;
98  return FALSE;
99  }
100 
101  return pfnAcceptEx(ListenSocket,
102  AcceptSocket,
103  OutputBuffer,
104  ReceiveDataLength,
105  LocalAddressLength,
106  RemoteAddressLength,
107  BytesReceived,
108  Overlapped);
109 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define SIO_GET_EXTENSION_FUNCTION_POINTER
Definition: ws2def.h:167
INT WSAAPI WSAIoctl(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)
Definition: ioctl.c:46
#define WSAID_GETACCEPTEXSOCKADDRS
Definition: mswsock.h:77
smooth NULL
Definition: ftsmooth.c:416
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
LPFN_ACCEPTEX pfnAcceptEx
Definition: extensions.c:17
unsigned long DWORD
Definition: ntddk_ex.h:95
LPFN_GETACCEPTEXSOCKADDRS pfnGetAcceptExSockaddrs
Definition: extensions.c:16
#define WSAID_ACCEPTEX
Definition: mswsock.h:74
_Must_inspect_result_ _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _In_opt_ PWSK_SOCKET AcceptSocket
Definition: wsk.h:170

◆ GetAcceptExSockaddrs()

VOID WINAPI GetAcceptExSockaddrs ( PVOID  OutputBuffer,
DWORD  ReceiveDataLength,
DWORD  LocalAddressLength,
DWORD  RemoteAddressLength,
LPSOCKADDR LocalSockaddr,
LPINT  LocalSockaddrLength,
LPSOCKADDR RemoteSockaddr,
LPINT  RemoteSockaddrLength 
)

Definition at line 117 of file extensions.c.

125 {
127  {
129  ReceiveDataLength,
130  LocalAddressLength,
131  RemoteAddressLength,
136  }
137 }
_In_ DWORD _In_ DWORD _In_ DWORD _Outptr_result_bytebuffer_ LocalSockaddrLength struct sockaddr ** LocalSockaddr
Definition: mswsock.h:114
_In_ DWORD _In_ DWORD _In_ DWORD _Outptr_result_bytebuffer_ LocalSockaddrLength struct sockaddr _Out_ LPINT LocalSockaddrLength
Definition: mswsock.h:114
_In_ DWORD _In_ DWORD _In_ DWORD _Outptr_result_bytebuffer_ LocalSockaddrLength struct sockaddr _Out_ LPINT _Outptr_result_bytebuffer_ RemoteSockaddrLength struct sockaddr ** RemoteSockaddr
Definition: mswsock.h:116
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
LPFN_GETACCEPTEXSOCKADDRS pfnGetAcceptExSockaddrs
Definition: extensions.c:16
_In_ DWORD _In_ DWORD _In_ DWORD _Outptr_result_bytebuffer_ LocalSockaddrLength struct sockaddr _Out_ LPINT _Outptr_result_bytebuffer_ RemoteSockaddrLength struct sockaddr _Out_ LPINT RemoteSockaddrLength
Definition: mswsock.h:116

◆ TransmitFile()

BOOL WINAPI TransmitFile ( SOCKET  Socket,
HANDLE  File,
DWORD  NumberOfBytesToWrite,
DWORD  NumberOfBytesPerSend,
LPOVERLAPPED  Overlapped,
LPTRANSMIT_FILE_BUFFERS  TransmitBuffers,
DWORD  Flags 
)

Definition at line 23 of file extensions.c.

30 {
31  GUID TransmitFileGUID = WSAID_TRANSMITFILE;
32  DWORD cbBytesReturned;
33 
34  if (WSAIoctl(Socket,
36  &TransmitFileGUID,
37  sizeof(TransmitFileGUID),
39  sizeof(pfnTransmitFile),
40  &cbBytesReturned,
41  NULL,
42  NULL) == SOCKET_ERROR)
43  {
44  return FALSE;
45  }
46 
47  return pfnTransmitFile(Socket,
48  File,
49  NumberOfBytesToWrite,
50  NumberOfBytesPerSend,
51  Overlapped,
52  TransmitBuffers,
53  Flags);
54 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define SIO_GET_EXTENSION_FUNCTION_POINTER
Definition: ws2def.h:167
INT WSAAPI WSAIoctl(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)
Definition: ioctl.c:46
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define WSAID_TRANSMITFILE
Definition: mswsock.h:71
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
LPFN_TRANSMITFILE pfnTransmitFile
Definition: extensions.c:15
Definition: File.h:15

Variable Documentation

◆ pfnAcceptEx

LPFN_ACCEPTEX pfnAcceptEx = NULL

Definition at line 17 of file extensions.c.

Referenced by AcceptEx().

◆ pfnGetAcceptExSockaddrs

LPFN_GETACCEPTEXSOCKADDRS pfnGetAcceptExSockaddrs = NULL

Definition at line 16 of file extensions.c.

Referenced by AcceptEx(), and GetAcceptExSockaddrs().

◆ pfnTransmitFile

LPFN_TRANSMITFILE pfnTransmitFile = NULL

Definition at line 15 of file extensions.c.

Referenced by TransmitFile().