ReactOS  0.4.13-dev-73-gcfe54aa
event.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_new/src/event.c
5  * PURPOSE: Socket Events
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  */
21 BOOL
22 WSAAPI
24 {
25  BOOL Success;
26 
27  /* Let the OS handle it */
29 
30  /* We need a special WSA return error */
32 
33  /* Return the Win32 Error */
34  return Success;
35 }
36 
37 /*
38  * @implemented
39  */
41 WSAAPI
43 {
44  /* CreateEventW can only return the Event or 0 (WSA_INVALID_EVENT) */
45  return CreateEventW(NULL, TRUE, FALSE, NULL);
46 }
47 
48 /*
49  * @implemented
50  */
51 BOOL
52 WSAAPI
54 {
55  /* Call Win32 */
56  return ResetEvent(hEvent);
57 }
58 
59 /*
60  * @implemented
61  */
62 BOOL
63 WSAAPI
65 {
66  /* Call Win32 */
67  return SetEvent(hEvent);
68 }
69 
70 /*
71  * @implemented
72  */
73 DWORD
74 WSAAPI
76  IN CONST WSAEVENT FAR* lphEvents,
77  IN BOOL fWaitAll,
79  IN BOOL fAlertable)
80 {
81  /* Call Win32 */
82  return WaitForMultipleObjectsEx(cEvents,
83  lphEvents,
84  fWaitAll,
85  dwTimeout,
86  fAlertable);
87 }
88 
89 /*
90  * @implemented
91  */
92 INT
93 WSAAPI
95  IN WSAEVENT hEventObject,
96  OUT LPWSANETWORKEVENTS lpNetworkEvents)
97 {
98  PWSSOCKET Socket;
99  INT Status;
100  INT ErrorCode;
101  DPRINT("WSAEnumNetworkEvents: %lx\n", s);
102 
103  /* Check for WSAStartup */
105  {
106  /* Get the Socket Context */
107  if ((Socket = WsSockGetSocket(s)))
108  {
109  /* Make the call */
111  hEventObject,
112  lpNetworkEvents,
113  &ErrorCode);
114  /* Deference the Socket Context */
115  WsSockDereference(Socket);
116 
117  /* Return Provider Value */
118  if (Status == ERROR_SUCCESS) return Status;
119  }
120  else
121  {
122  /* No Socket Context Found */
124  }
125  }
126 
127  /* Return with an Error */
129  return SOCKET_ERROR;
130 }
131 
#define WSAENOTSOCK
Definition: winerror.h:1951
#define SOCKET_ERROR
Definition: winsock.h:333
#define IN
Definition: typedefs.h:38
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4418
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WSAEVENT
Definition: winsock2.h:585
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
PWSSOCKET WSAAPI WsSockGetSocket(IN SOCKET Handle)
Definition: dsocket.c:140
DWORD WSAAPI WSAWaitForMultipleEvents(IN DWORD cEvents, IN CONST WSAEVENT FAR *lphEvents, IN BOOL fWaitAll, IN DWORD dwTimeout, IN BOOL fAlertable)
Definition: event.c:75
int32_t INT
Definition: typedefs.h:56
WSPPROC_TABLE Service
Definition: ws2_32p.h:80
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
static HANDLE hEvent
Definition: comm.c:54
VOID WSAAPI WsSockDereference(IN PWSSOCKET Socket)
Definition: dsocket.c:205
BOOL WSAAPI WSAResetEvent(IN WSAEVENT hEvent)
Definition: event.c:53
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FAR
Definition: guiddef.h:36
BOOL WSAAPI WSACloseEvent(IN WSAEVENT hEvent)
Definition: event.c:23
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
VOID WSAAPI WSASetLastError(IN INT iError)
Definition: dllmain.c:123
DWORD WINAPI WaitForMultipleObjectsEx(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:169
PTPROVIDER Provider
Definition: ws2_32p.h:199
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
BOOL WSAAPI WSASetEvent(IN WSAEVENT hEvent)
Definition: event.c:64
INT WSAAPI WSAEnumNetworkEvents(IN SOCKET s, IN WSAEVENT hEventObject, OUT LPWSANETWORKEVENTS lpNetworkEvents)
Definition: event.c:94
GLdouble s
Definition: gl.h:2039
Status
Definition: gdiplustypes.h:24
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6081
WSAEVENT WSAAPI WSACreateEvent(VOID)
Definition: event.c:42
#define WSA_INVALID_HANDLE
Definition: winsock2.h:591
#define WSAAPI
Definition: winsock2.h:584
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:660
#define OUT
Definition: typedefs.h:39
LPWSPENUMNETWORKEVENTS lpWSPEnumNetworkEvents
Definition: ws2spi.h:470
UINT_PTR SOCKET
Definition: winsock.h:47
FORCEINLINE DWORD WsQuickProlog(VOID)
Definition: ws2_32p.h:892
#define CONST
Definition: pedump.c:81