ReactOS 0.4.15-dev-8058-ga7cbb60
ioctl.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS WinSock 2 API
4 * FILE: dll/win32/ws2_32/src/ioctl.c
5 * PURPOSE: Socket I/O Control Code support.
6 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include <ws2_32.h>
12
13#define NDEBUG
14#include <debug.h>
15
16/* FUNCTIONS *****************************************************************/
17
18/*
19 * @implemented
20 */
21INT
24 IN LONG cmd,
25 IN OUT ULONG FAR* argp)
26{
27 DWORD Dummy;
28
29 /* Let WSA do it */
30 return WSAIoctl(s,
31 cmd,
32 argp,
33 sizeof(ULONG),
34 argp,
35 sizeof(ULONG),
36 &Dummy,
37 NULL,
38 NULL);
39}
40
41/*
42 * @implemented
43 */
44INT
48 IN LPVOID lpvInBuffer,
49 IN DWORD cbInBuffer,
50 OUT LPVOID lpvOutBuffer,
51 IN DWORD cbOutBuffer,
52 OUT LPDWORD lpcbBytesReturned,
54 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
55{
56 PWSSOCKET Socket;
57 INT Status;
59 LPWSATHREADID ThreadId;
60 DPRINT("WSAIoctl: %lx, %lx\n", s, dwIoControlCode);
61
62 /* Check for WSAStartup */
63 if ((ErrorCode = WsQuickPrologTid(&ThreadId)) == ERROR_SUCCESS)
64 {
65 /* Get the Socket Context */
66 if ((Socket = WsSockGetSocket(s)))
67 {
68 /* Make the call */
71 lpvInBuffer,
72 cbInBuffer,
73 lpvOutBuffer,
74 cbOutBuffer,
75 lpcbBytesReturned,
77 lpCompletionRoutine,
78 ThreadId,
79 &ErrorCode);
80
81 /* Deference the Socket Context */
82 WsSockDereference(Socket);
83
84 /* Return Provider Value */
85 if (Status == ERROR_SUCCESS) return Status;
86 }
87 else
88 {
89 /* No Socket Context Found */
91 }
92 }
93
94 /* Return with an Error */
96 return SOCKET_ERROR;
97}
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define SetLastError(x)
Definition: compat.h:752
#define FAR
Definition: zlib.h:34
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
Status
Definition: gdiplustypes.h:25
GLdouble s
Definition: gl.h:2039
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED lpOverlapped
Definition: mswsock.h:93
#define ioctlsocket
Definition: ncftp.h:481
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
long LONG
Definition: pedump.c:60
#define DPRINT
Definition: sndvol32.h:71
WSPPROC_TABLE Service
Definition: ws2_32p.h:80
LPWSPIOCTL lpWSPIoctl
Definition: ws2spi.h:477
PTPROVIDER Provider
Definition: ws2_32p.h:199
Definition: ftp_var.h:139
uint32_t * LPDWORD
Definition: typedefs.h:59
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_In_ DWORD dwIoControlCode
Definition: winddi.h:1700
#define WSAENOTSOCK
Definition: winerror.h:1951
void(CALLBACK * LPWSAOVERLAPPED_COMPLETION_ROUTINE)(IN DWORD dwError, IN DWORD cbTransferred, IN LPWSAOVERLAPPED lpOverlapped, IN DWORD dwFlags)
Definition: winsock2.h:722
#define WSAAPI
Definition: winsock2.h:605
UINT_PTR SOCKET
Definition: winsock.h:47
#define SOCKET_ERROR
Definition: winsock.h:333
VOID WSAAPI WsSockDereference(IN PWSSOCKET Socket)
Definition: dsocket.c:205
FORCEINLINE DWORD WsQuickPrologTid(LPWSATHREADID *Tid)
Definition: ws2_32p.h:900
PWSSOCKET WSAAPI WsSockGetSocket(IN SOCKET Handle)
Definition: dsocket.c:140