ReactOS 0.4.15-dev-7677-g8209aa5
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),
79 sizeof(pfnAcceptEx),
80 &cbBytesReturned,
81 NULL,
83 {
84 return FALSE;
85 }
86
87 if (WSAIoctl(ListenSocket,
89 &GetAcceptExSockaddrsGUID,
90 sizeof(GetAcceptExSockaddrsGUID),
93 &cbBytesReturned,
94 NULL,
96 {
98 return FALSE;
99 }
100
101 return pfnAcceptEx(ListenSocket,
104 ReceiveDataLength,
105 LocalAddressLength,
106 RemoteAddressLength,
107 BytesReceived,
108 Overlapped);
109}
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
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
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WSAID_GETACCEPTEXSOCKADDRS
Definition: mswsock.h:77
#define WSAID_ACCEPTEX
Definition: mswsock.h:74
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
LPFN_GETACCEPTEXSOCKADDRS pfnGetAcceptExSockaddrs
Definition: extensions.c:16
LPFN_ACCEPTEX pfnAcceptEx
Definition: extensions.c:17
#define SOCKET_ERROR
Definition: winsock.h:333
#define SIO_GET_EXTENSION_FUNCTION_POINTER
Definition: ws2def.h:167
_Must_inspect_result_ _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _In_opt_ PWSK_SOCKET AcceptSocket
Definition: wsk.h:173

◆ 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:115
_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
_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:117

◆ 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,
43 {
44 return FALSE;
45 }
46
47 return pfnTransmitFile(Socket,
48 File,
49 NumberOfBytesToWrite,
50 NumberOfBytesPerSend,
51 Overlapped,
52 TransmitBuffers,
53 Flags);
54}
Definition: File.h:16
#define WSAID_TRANSMITFILE
Definition: mswsock.h:71
LPFN_TRANSMITFILE pfnTransmitFile
Definition: extensions.c:15
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

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().