ReactOS 0.4.15-dev-5666-gc548b97
extensions.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS WinSock DLL
4 * FILE: stubs.c
5 * PURPOSE: WSAIoctl wrappers for Microsoft extensions to Winsock
6 * PROGRAMMERS: KJK::Hyperion <hackbunny@reactos.com>
7 * REVISIONS:
8 */
9
10#include "precomp.h"
11
12#include <winsock2.h>
13#include <mswsock.h>
14
15LPFN_TRANSMITFILE pfnTransmitFile = NULL;
16LPFN_GETACCEPTEXSOCKADDRS pfnGetAcceptExSockaddrs = NULL;
17LPFN_ACCEPTEX pfnAcceptEx = NULL;
18/*
19 * @implemented
20 */
21BOOL
25 DWORD NumberOfBytesToWrite,
26 DWORD NumberOfBytesPerSend,
27 LPOVERLAPPED Overlapped,
28 LPTRANSMIT_FILE_BUFFERS TransmitBuffers,
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}
55
56/*
57* @implemented
58*/
59BOOL
61AcceptEx(SOCKET ListenSocket,
64 DWORD ReceiveDataLength,
65 DWORD LocalAddressLength,
66 DWORD RemoteAddressLength,
67 LPDWORD BytesReceived,
68 LPOVERLAPPED Overlapped)
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}
110
111
112/*
113* @implemented
114*/
115VOID
116WINAPI
118 DWORD ReceiveDataLength,
119 DWORD LocalAddressLength,
120 DWORD RemoteAddressLength,
125{
127 {
129 ReceiveDataLength,
130 LocalAddressLength,
131 RemoteAddressLength,
136 }
137}
138/* EOF */
Definition: File.h:16
#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 int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_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
#define WSAID_GETACCEPTEXSOCKADDRS
Definition: mswsock.h:77
#define WSAID_TRANSMITFILE
Definition: mswsock.h:71
_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
#define WSAID_ACCEPTEX
Definition: mswsock.h:74
uint32_t * LPDWORD
Definition: typedefs.h:59
_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
VOID WINAPI GetAcceptExSockaddrs(PVOID OutputBuffer, DWORD ReceiveDataLength, DWORD LocalAddressLength, DWORD RemoteAddressLength, LPSOCKADDR *LocalSockaddr, LPINT LocalSockaddrLength, LPSOCKADDR *RemoteSockaddr, LPINT RemoteSockaddrLength)
Definition: extensions.c:117
BOOL WINAPI AcceptEx(SOCKET ListenSocket, SOCKET AcceptSocket, PVOID OutputBuffer, DWORD ReceiveDataLength, DWORD LocalAddressLength, DWORD RemoteAddressLength, LPDWORD BytesReceived, LPOVERLAPPED Overlapped)
Definition: extensions.c:61
LPFN_TRANSMITFILE pfnTransmitFile
Definition: extensions.c:15
BOOL WINAPI TransmitFile(SOCKET Socket, HANDLE File, DWORD NumberOfBytesToWrite, DWORD NumberOfBytesPerSend, LPOVERLAPPED Overlapped, LPTRANSMIT_FILE_BUFFERS TransmitBuffers, DWORD Flags)
Definition: extensions.c:23
LPFN_ACCEPTEX pfnAcceptEx
Definition: extensions.c:17
int * LPINT
Definition: windef.h:178
#define WINAPI
Definition: msvc.h:6
UINT_PTR SOCKET
Definition: winsock.h:47
#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
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170