ReactOS 0.4.15-dev-5664-g3bf4ef6
bhook.c File Reference
#include <ws2_32.h>
#include <debug.h>
Include dependency graph for bhook.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

INT WSAAPI WSACancelBlockingCall (VOID)
 
BOOL WSAAPI WSAIsBlocking (VOID)
 
FARPROC WSAAPI WSASetBlockingHook (IN FARPROC lpBlockFunc)
 
INT WSAAPI WSAUnhookBlockingHook (VOID)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file bhook.c.

Function Documentation

◆ WSACancelBlockingCall()

INT WSAAPI WSACancelBlockingCall ( VOID  )

Definition at line 23 of file bhook.c.

24{
28 DPRINT("WSACancelBlockingCall\n");
29
30 /* Call the prolog */
33 {
34 /* Fail */
36 return SOCKET_ERROR;
37 }
38
39 /* Make sure this isn't a 2.2 client */
40 if (LOBYTE(Process->Version) >= 2)
41 {
42 /* Only valid for 1.x */
44 return SOCKET_ERROR;
45 }
46
47 /* Cancel the call */
50 {
51 /* Fail */
53 return SOCKET_ERROR;
54 }
55
56 /* Return success */
57 return ERROR_SUCCESS;
58}
#define ERROR_SUCCESS
Definition: deptool.c:10
#define SetLastError(x)
Definition: compat.h:752
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
#define LOBYTE(W)
Definition: jmemdos.c:487
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define DPRINT
Definition: sndvol32.h:71
int32_t INT
Definition: typedefs.h:58
#define WSAEOPNOTSUPP
Definition: winerror.h:1958
#define SOCKET_ERROR
Definition: winsock.h:333
INT WSAAPI WsApiProlog(OUT PWSPROCESS *Process, OUT PWSTHREAD *Thread)
Definition: wsautil.c:91
DWORD WSAAPI WsThreadCancelBlockingCall(IN PWSTHREAD Thread)
Definition: dthread.c:96

Referenced by AreLegacyFunctionsSupported(), and WsAsyncThreadBlockingHook().

◆ WSAIsBlocking()

BOOL WSAAPI WSAIsBlocking ( VOID  )

Definition at line 65 of file bhook.c.

66{
70 DPRINT("WSAIsBlocking\n");
71
72 /* Call the prolog */
75 {
76 /* Fail unless its because we're busy */
77 if (ErrorCode != WSAEINPROGRESS) return FALSE;
78 }
79
80 /* Return the value from the thread */
81 return Thread->Blocking;
82}
#define FALSE
Definition: types.h:117
#define WSAEINPROGRESS
Definition: winerror.h:1949

◆ WSASetBlockingHook()

FARPROC WSAAPI WSASetBlockingHook ( IN FARPROC  lpBlockFunc)

Definition at line 89 of file bhook.c.

90{
94 DPRINT("WSASetBlockingHook: %p\n", lpBlockFunc);
95
96 /* Call the prolog */
99 {
100 /* Fail */
102 return NULL;
103 }
104
105 /* Make sure this isn't a 2.2 client */
106 if (LOBYTE(Process->Version) >= 2)
107 {
108 /* Only valid for 1.x */
110 return NULL;
111 }
112
113 /* Make sure the pointer is safe */
114 if (IsBadCodePtr(lpBlockFunc))
115 {
116 /* Invalid pointer */
118 return NULL;
119 }
120
121 /* Set the blocking hook and return the previous one */
122 return WsThreadSetBlockingHook(Thread, lpBlockFunc);
123}
#define NULL
Definition: types.h:112
BOOL NTAPI IsBadCodePtr(FARPROC lpfn)
Definition: except.c:870
#define WSAEFAULT
Definition: winerror.h:1945
FARPROC WSAAPI WsThreadSetBlockingHook(IN PWSTHREAD Thread, IN FARPROC BlockingHook)
Definition: dthread.c:60

Referenced by WsAsyncThread().

◆ WSAUnhookBlockingHook()

INT WSAAPI WSAUnhookBlockingHook ( VOID  )

Definition at line 130 of file bhook.c.

131{
135 DPRINT("WSAUnhookBlockingHook\n");
136
137 /* Call the prolog */
140 {
141 /* Fail */
143 return SOCKET_ERROR;
144 }
145
146 /* Make sure this isn't a 2.2 client */
147 if (LOBYTE(Process->Version) >= 2)
148 {
149 /* Only valid for 1.x */
151 return SOCKET_ERROR;
152 }
153
154 /* Set the blocking hook and return the previous one */
156}
DWORD WSAAPI WsThreadUnhookBlockingHook(IN PWSTHREAD Thread)
Definition: dthread.c:84