ReactOS  0.4.13-dev-1148-g9b75b67
select.c File Reference
#include "afd.h"
Include dependency graph for select.c:

Go to the source code of this file.

Functions

static VOID PrintEvents (ULONG Events)
 
static VOID CopyBackStatus (PAFD_HANDLE HandleArray, UINT HandleCount)
 
VOID ZeroEvents (PAFD_HANDLE HandleArray, UINT HandleCount)
 
VOID SignalSocket (PAFD_ACTIVE_POLL Poll OPTIONAL, PIRP _Irp OPTIONAL, PAFD_POLL_INFO PollReq, NTSTATUS Status)
 
static VOID NTAPI SelectTimeout (PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
 
VOID KillSelectsForFCB (PAFD_DEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, BOOLEAN OnlyExclusive)
 
NTSTATUS NTAPI AfdSelect (PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
 
NTSTATUS NTAPI AfdEventSelect (PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
 
NTSTATUS NTAPI AfdEnumEvents (PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
 
static BOOLEAN UpdatePollWithFCB (PAFD_ACTIVE_POLL Poll, PFILE_OBJECT FileObject)
 
VOID PollReeval (PAFD_DEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject)
 

Variables

static KDEFERRED_ROUTINE SelectTimeout
 

Function Documentation

◆ AfdEnumEvents()

NTSTATUS NTAPI AfdEnumEvents ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp,
PIO_STACK_LOCATION  IrpSp 
)

Definition at line 328 of file select.c.

329  {
333  PAFD_FCB FCB = FileObject->FsContext;
334  PKEVENT UserEvent;
336 
338 
339  AFD_DbgPrint(MID_TRACE,("Called (FCB %p)\n", FCB));
340 
341  if( !SocketAcquireStateLock( FCB ) ) {
342  return LostSocket( Irp );
343  }
344 
345  if ( !EnumReq ) {
347  }
348 
349  /* An event may optionally be provided for us to clear */
350  if (EnumReq->Event != NULL)
351  {
355  UserMode,
356  (PVOID *)&UserEvent,
357  NULL);
358  if (!NT_SUCCESS(Status))
359  {
360  AFD_DbgPrint(MIN_TRACE,("Unable to reference event %x\n", Status));
361  return UnlockAndMaybeComplete(FCB, Status, Irp, 0);
362  }
363 
364  /* Clear the event */
365  KeClearEvent(UserEvent);
366  ObDereferenceObject(UserEvent);
367  }
368 
369  /* Copy the poll state, masking out disabled events */
370  EnumReq->PollEvents = (FCB->PollState & ~FCB->EventSelectDisabled);
371  RtlCopyMemory( EnumReq->EventStatus,
372  FCB->PollStatus,
373  sizeof(EnumReq->EventStatus) );
374 
375  /* Disable the events that triggered the select until the reenabling function is called */
376  FCB->EventSelectDisabled |= (FCB->PollState & FCB->EventSelectTriggers);
377 
379 }
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define MID_TRACE
Definition: debug.h:15
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
Definition: cdstruc.h:908
PVOID LockRequest(PIRP Irp, PIO_STACK_LOCATION IrpSp, BOOLEAN Output, KPROCESSOR_MODE *LockMode)
Definition: lock.c:24
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN SocketAcquireStateLock(PAFD_FCB FCB)
Definition: lock.c:360
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
NTSTATUS NTAPI UnlockAndMaybeComplete(PAFD_FCB FCB, NTSTATUS Status, PIRP Irp, UINT Information)
Definition: lock.c:375
POBJECT_TYPE ExEventObjectType
Definition: event.c:22
struct _AFD_ENUM_NETWORK_EVENTS_INFO * PAFD_ENUM_NETWORK_EVENTS_INFO
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
Definition: afd.h:161
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
* PFILE_OBJECT
Definition: iotypes.h:1955
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
NTSTATUS LostSocket(PIRP Irp)
Definition: lock.c:387
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define MIN_TRACE
Definition: debug.h:14
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
return STATUS_SUCCESS
Definition: btrfs.c:2966
NTSTATUS EventStatus[AFD_MAX_EVENTS]
Definition: shared.h:132

Referenced by AfdDispatch().

◆ AfdEventSelect()

NTSTATUS NTAPI AfdEventSelect ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp,
PIO_STACK_LOCATION  IrpSp 
)

Definition at line 265 of file select.c.

266  {
269  PAFD_EVENT_SELECT_INFO EventSelectInfo =
271  PAFD_FCB FCB = FileObject->FsContext;
272 
274 
275  if( !SocketAcquireStateLock( FCB ) ) {
276  return LostSocket( Irp );
277  }
278 
279  if ( !EventSelectInfo ) {
281  0 );
282  }
283  AFD_DbgPrint(MID_TRACE,("Called (Event %p Triggers %u)\n",
284  EventSelectInfo->EventObject,
285  EventSelectInfo->Events));
286 
287  if( FCB->EventSelect ) ObDereferenceObject( FCB->EventSelect );
288  FCB->EventSelect = NULL;
289 
290  if( EventSelectInfo->EventObject && EventSelectInfo->Events ) {
291  Status = ObReferenceObjectByHandle( (PVOID)EventSelectInfo->
292  EventObject,
295  UserMode,
296  (PVOID *)&FCB->EventSelect,
297  NULL );
298 
299  if( !NT_SUCCESS(Status) )
300  {
301  AFD_DbgPrint(MIN_TRACE,("Failed reference event (0x%x)\n", Status));
302  FCB->EventSelect = NULL;
303  }
304  else
305  FCB->EventSelectTriggers = EventSelectInfo->Events;
306  } else {
307  FCB->EventSelect = NULL;
308  FCB->EventSelectTriggers = 0;
310  }
311 
312  if((FCB->EventSelect) &&
313  (FCB->PollState & (FCB->EventSelectTriggers & ~FCB->EventSelectDisabled)))
314  {
315  AFD_DbgPrint(MID_TRACE,("Setting event %p\n", FCB->EventSelect));
316 
317  /* Set the application's event */
318  KeSetEvent( FCB->EventSelect, IO_NETWORK_INCREMENT, FALSE );
319  }
320 
321  AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
322 
324  0 );
325 }
#define MID_TRACE
Definition: debug.h:15
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
Definition: cdstruc.h:908
PVOID LockRequest(PIRP Irp, PIO_STACK_LOCATION IrpSp, BOOLEAN Output, KPROCESSOR_MODE *LockMode)
Definition: lock.c:24
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN SocketAcquireStateLock(PAFD_FCB FCB)
Definition: lock.c:360
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
NTSTATUS NTAPI UnlockAndMaybeComplete(PAFD_FCB FCB, NTSTATUS Status, PIRP Irp, UINT Information)
Definition: lock.c:375
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
POBJECT_TYPE ExEventObjectType
Definition: event.c:22
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define IO_NETWORK_INCREMENT
Definition: tcpip.h:43
Definition: afd.h:161
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
* PFILE_OBJECT
Definition: iotypes.h:1955
struct _AFD_EVENT_SELECT_INFO * PAFD_EVENT_SELECT_INFO
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
NTSTATUS LostSocket(PIRP Irp)
Definition: lock.c:387
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define MIN_TRACE
Definition: debug.h:14
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by AfdDispatch().

◆ AfdSelect()

NTSTATUS NTAPI AfdSelect ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp,
PIO_STACK_LOCATION  IrpSp 
)

Definition at line 165 of file select.c.

166  {
168  PAFD_FCB FCB;
170  PAFD_POLL_INFO PollReq = Irp->AssociatedIrp.SystemBuffer;
172  KIRQL OldIrql;
173  UINT i, Signalled = 0;
174  ULONG Exclusive = PollReq->Exclusive;
175 
177 
178  AFD_DbgPrint(MID_TRACE,("Called (HandleCount %u Timeout %d)\n",
179  PollReq->HandleCount,
180  (INT)(PollReq->Timeout.QuadPart)));
181 
182  SET_AFD_HANDLES(PollReq,
183  LockHandles( PollReq->Handles, PollReq->HandleCount ));
184 
185  if( !AFD_HANDLES(PollReq) ) {
186  Irp->IoStatus.Status = STATUS_NO_MEMORY;
187  Irp->IoStatus.Information = 0;
189  return STATUS_NO_MEMORY;
190  }
191 
192  if( Exclusive ) {
193  for( i = 0; i < PollReq->HandleCount; i++ ) {
194  if( !AFD_HANDLES(PollReq)[i].Handle ) continue;
195 
196  KillSelectsForFCB( DeviceExt,
197  (PFILE_OBJECT)AFD_HANDLES(PollReq)[i].Handle,
198  TRUE );
199  }
200  }
201 
202  KeAcquireSpinLock( &DeviceExt->Lock, &OldIrql );
203 
204  for( i = 0; i < PollReq->HandleCount; i++ ) {
205  if( !AFD_HANDLES(PollReq)[i].Handle ) continue;
206 
207  FileObject = (PFILE_OBJECT)AFD_HANDLES(PollReq)[i].Handle;
208  FCB = FileObject->FsContext;
209 
210  AFD_DbgPrint(MID_TRACE, ("AFD: Select Events: "));
211  PrintEvents( PollReq->Handles[i].Events );
212  AFD_DbgPrint(MID_TRACE,("\n"));
213 
214  PollReq->Handles[i].Status =
215  PollReq->Handles[i].Events & FCB->PollState;
216  if( PollReq->Handles[i].Status ) {
217  AFD_DbgPrint(MID_TRACE,("Signalling %p with %x\n",
218  FCB, FCB->PollState));
219  Signalled++;
220  }
221  }
222 
223  if( Signalled ) {
225  Irp->IoStatus.Status = Status;
226  SignalSocket( NULL, Irp, PollReq, Status );
227  } else {
228 
229  PAFD_ACTIVE_POLL Poll = NULL;
230 
232  sizeof(AFD_ACTIVE_POLL),
234 
235  if (Poll){
236  Poll->Irp = Irp;
237  Poll->DeviceExt = DeviceExt;
238  Poll->Exclusive = Exclusive;
239 
241 
243 
244  InsertTailList( &DeviceExt->Polls, &Poll->ListEntry );
245 
246  KeSetTimer( &Poll->Timer, PollReq->Timeout, &Poll->TimeoutDpc );
247 
251  } else {
252  AFD_DbgPrint(MAX_TRACE, ("FIXME: do something with the IRP!\n"));
254  }
255  }
256 
257  KeReleaseSpinLock( &DeviceExt->Lock, OldIrql );
258 
259  AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
260 
261  return Status;
262 }
NTSTATUS Status
Definition: shared.h:52
#define TRUE
Definition: types.h:120
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
Definition: timerobj.c:281
#define MID_TRACE
Definition: debug.h:15
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
Definition: cdstruc.h:908
LONG NTSTATUS
Definition: precomp.h:26
LARGE_INTEGER Timeout
Definition: shared.h:56
#define InsertTailList(ListHead, Entry)
IoSetCancelRoutine(Irp, CancelRoutine)
VOID KillSelectsForFCB(PAFD_DEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, BOOLEAN OnlyExclusive)
Definition: select.c:125
int32_t INT
Definition: typedefs.h:56
KSPIN_LOCK Lock
Definition: afd.h:113
UCHAR KIRQL
Definition: env_spec_w32.h:591
VOID SignalSocket(PAFD_ACTIVE_POLL Poll OPTIONAL, PIRP _Irp OPTIONAL, PAFD_POLL_INFO PollReq, NTSTATUS Status)
Definition: select.c:56
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SET_AFD_HANDLES(x, y)
Definition: afd.h:103
ULONG Events
Definition: shared.h:51
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
PVOID DeviceExtension
Definition: env_spec_w32.h:418
struct _FCB FCB
smooth NULL
Definition: ftsmooth.c:416
#define TAG_AFD_ACTIVE_POLL
Definition: afd.h:49
#define IoCompleteRequest
Definition: irp.c:1240
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define IO_NETWORK_INCREMENT
Definition: tcpip.h:43
Definition: afd.h:161
LIST_ENTRY Polls
Definition: afd.h:112
_In_ HANDLE Handle
Definition: extypes.h:390
#define AFD_HANDLES(x)
Definition: afd.h:102
#define STATUS_PENDING
Definition: ntstatus.h:82
KDPC TimeoutDpc
Definition: afd.h:120
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
* PFILE_OBJECT
Definition: iotypes.h:1955
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
Definition: ketypes.h:687
ULONG_PTR Exclusive
Definition: shared.h:58
KTIMER Timer
Definition: afd.h:121
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define MAX_TRACE
Definition: debug.h:16
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
ULONG HandleCount
Definition: shared.h:57
AFD_HANDLE Handles[1]
Definition: shared.h:59
unsigned int UINT
Definition: ndis.h:50
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
PAFD_DEVICE_EXTENSION DeviceExt
Definition: afd.h:119
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN Exclusive
Definition: afd.h:123
static VOID PrintEvents(ULONG Events)
Definition: select.c:13
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:711
return STATUS_SUCCESS
Definition: btrfs.c:2966
IoMarkIrpPending(Irp)
static KDEFERRED_ROUTINE SelectTimeout
Definition: select.c:95
VOID NTAPI KeInitializeTimerEx(OUT PKTIMER Timer, IN TIMER_TYPE Type)
Definition: timerobj.c:244
PIRP Irp
Definition: afd.h:118
LONGLONG QuadPart
Definition: typedefs.h:112
DRIVER_CANCEL AfdCancelHandler
Definition: afd.h:304
LIST_ENTRY ListEntry
Definition: afd.h:117
PAFD_HANDLE LockHandles(PAFD_HANDLE HandleArray, UINT HandleCount)
Definition: lock.c:310

Referenced by AfdDispatch().

◆ CopyBackStatus()

static VOID CopyBackStatus ( PAFD_HANDLE  HandleArray,
UINT  HandleCount 
)
static

Definition at line 34 of file select.c.

35  {
36  UINT i;
37 
38  for( i = 0; i < HandleCount; i++ ) {
39  HandleArray[i].Events = HandleArray[i].Status;
40  HandleArray[i].Status = 0;
41  }
42 }
NTSTATUS Status
Definition: shared.h:52
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG Events
Definition: shared.h:51
unsigned int UINT
Definition: ndis.h:50

Referenced by SignalSocket().

◆ KillSelectsForFCB()

VOID KillSelectsForFCB ( PAFD_DEVICE_EXTENSION  DeviceExt,
PFILE_OBJECT  FileObject,
BOOLEAN  OnlyExclusive 
)

Definition at line 125 of file select.c.

127  {
128  KIRQL OldIrql;
129  PLIST_ENTRY ListEntry;
130  PAFD_ACTIVE_POLL Poll;
131  PIRP Irp;
132  PAFD_POLL_INFO PollReq;
133  PAFD_HANDLE HandleArray;
134  UINT i;
135 
136  AFD_DbgPrint(MID_TRACE,("Killing selects that refer to %p\n", FileObject));
137 
138  KeAcquireSpinLock( &DeviceExt->Lock, &OldIrql );
139 
140  ListEntry = DeviceExt->Polls.Flink;
141  while ( ListEntry != &DeviceExt->Polls ) {
142  Poll = CONTAINING_RECORD(ListEntry, AFD_ACTIVE_POLL, ListEntry);
143  ListEntry = ListEntry->Flink;
144  Irp = Poll->Irp;
145  PollReq = Irp->AssociatedIrp.SystemBuffer;
146  HandleArray = AFD_HANDLES(PollReq);
147 
148  for( i = 0; i < PollReq->HandleCount; i++ ) {
149  AFD_DbgPrint(MAX_TRACE,("Req: %u, This %p\n",
150  HandleArray[i].Handle, FileObject));
151  if( (PVOID)HandleArray[i].Handle == FileObject &&
152  (!OnlyExclusive || (OnlyExclusive && Poll->Exclusive)) ) {
153  ZeroEvents( PollReq->Handles, PollReq->HandleCount );
154  SignalSocket( Poll, NULL, PollReq, STATUS_CANCELLED );
155  }
156  }
157  }
158 
159  KeReleaseSpinLock( &DeviceExt->Lock, OldIrql );
160 
161  AFD_DbgPrint(MID_TRACE,("Done\n"));
162 }
#define MID_TRACE
Definition: debug.h:15
_In_ PIRP Irp
Definition: csq.h:116
VOID ZeroEvents(PAFD_HANDLE HandleArray, UINT HandleCount)
Definition: select.c:44
KSPIN_LOCK Lock
Definition: afd.h:113
UCHAR KIRQL
Definition: env_spec_w32.h:591
VOID SignalSocket(PAFD_ACTIVE_POLL Poll OPTIONAL, PIRP _Irp OPTIONAL, PAFD_POLL_INFO PollReq, NTSTATUS Status)
Definition: select.c:56
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
LIST_ENTRY Polls
Definition: afd.h:112
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
_In_ HANDLE Handle
Definition: extypes.h:390
#define AFD_HANDLES(x)
Definition: afd.h:102
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
Definition: typedefs.h:117
#define MAX_TRACE
Definition: debug.h:16
ULONG HandleCount
Definition: shared.h:57
AFD_HANDLE Handles[1]
Definition: shared.h:59
unsigned int UINT
Definition: ndis.h:50
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
BOOLEAN Exclusive
Definition: afd.h:123
PIRP Irp
Definition: afd.h:118

Referenced by AfdCleanupSocket(), AfdCloseSocket(), and AfdSelect().

◆ PollReeval()

VOID PollReeval ( PAFD_DEVICE_EXTENSION  DeviceExt,
PFILE_OBJECT  FileObject 
)

Definition at line 407 of file select.c.

407  {
408  PAFD_ACTIVE_POLL Poll = NULL;
409  PLIST_ENTRY ThePollEnt = NULL;
410  PAFD_FCB FCB;
411  KIRQL OldIrql;
412  PAFD_POLL_INFO PollReq;
413 
414  AFD_DbgPrint(MID_TRACE,("Called: DeviceExt %p FileObject %p\n",
415  DeviceExt, FileObject));
416 
417  KeAcquireSpinLock( &DeviceExt->Lock, &OldIrql );
418 
419  /* Take care of any event select signalling */
420  FCB = (PAFD_FCB)FileObject->FsContext;
421 
422  if( !FCB ) {
423  KeReleaseSpinLock( &DeviceExt->Lock, OldIrql );
424  return;
425  }
426 
427  /* Now signal normal select irps */
428  ThePollEnt = DeviceExt->Polls.Flink;
429 
430  while( ThePollEnt != &DeviceExt->Polls ) {
431  Poll = CONTAINING_RECORD( ThePollEnt, AFD_ACTIVE_POLL, ListEntry );
432  PollReq = Poll->Irp->AssociatedIrp.SystemBuffer;
433  AFD_DbgPrint(MID_TRACE,("Checking poll %p\n", Poll));
434 
435  if( UpdatePollWithFCB( Poll, FileObject ) ) {
436  ThePollEnt = ThePollEnt->Flink;
437  AFD_DbgPrint(MID_TRACE,("Signalling socket\n"));
438  SignalSocket( Poll, NULL, PollReq, STATUS_SUCCESS );
439  } else
440  ThePollEnt = ThePollEnt->Flink;
441  }
442 
443  KeReleaseSpinLock( &DeviceExt->Lock, OldIrql );
444 
445  if((FCB->EventSelect) &&
446  (FCB->PollState & (FCB->EventSelectTriggers & ~FCB->EventSelectDisabled)))
447  {
448  AFD_DbgPrint(MID_TRACE,("Setting event %p\n", FCB->EventSelect));
449 
450  /* Set the application's event */
451  KeSetEvent( FCB->EventSelect, IO_NETWORK_INCREMENT, FALSE );
452  }
453 
454  AFD_DbgPrint(MID_TRACE,("Leaving\n"));
455 }
#define MID_TRACE
Definition: debug.h:15
Definition: cdstruc.h:908
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
KSPIN_LOCK Lock
Definition: afd.h:113
UCHAR KIRQL
Definition: env_spec_w32.h:591
VOID SignalSocket(PAFD_ACTIVE_POLL Poll OPTIONAL, PIRP _Irp OPTIONAL, PAFD_POLL_INFO PollReq, NTSTATUS Status)
Definition: select.c:56
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
struct _FCB FCB
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define IO_NETWORK_INCREMENT
Definition: tcpip.h:43
Definition: afd.h:161
LIST_ENTRY Polls
Definition: afd.h:112
struct _AFD_FCB * PAFD_FCB
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
Definition: typedefs.h:117
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
return STATUS_SUCCESS
Definition: btrfs.c:2966
static BOOLEAN UpdatePollWithFCB(PAFD_ACTIVE_POLL Poll, PFILE_OBJECT FileObject)
Definition: select.c:382
PIRP Irp
Definition: afd.h:118

Referenced by AfdAccept(), AfdConnectedSocketReadData(), AfdConnectedSocketWriteData(), AfdCreateSocket(), AfdPacketSocketReadData(), AfdWaitForListen(), DisconnectComplete(), ListenComplete(), MakeSocketIntoConnection(), PacketSocketRecvComplete(), PacketSocketSendComplete(), ReceiveActivity(), SendComplete(), and StreamSocketConnectComplete().

◆ PrintEvents()

static VOID PrintEvents ( ULONG  Events)
static

Definition at line 13 of file select.c.

13  {
14 #if DBG
15  char *events_list[] = { "AFD_EVENT_RECEIVE",
16  "AFD_EVENT_OOB_RECEIVE",
17  "AFD_EVENT_SEND",
18  "AFD_EVENT_DISCONNECT",
19  "AFD_EVENT_ABORT",
20  "AFD_EVENT_CLOSE",
21  "AFD_EVENT_CONNECT",
22  "AFD_EVENT_ACCEPT",
23  "AFD_EVENT_CONNECT_FAIL",
24  "AFD_EVENT_QOS",
25  "AFD_EVENT_GROUP_QOS",
26  NULL };
27  int i;
28 
29  for( i = 0; events_list[i]; i++ )
30  if( Events & (1 << i) ) AFD_DbgPrint(MID_TRACE,("%s ", events_list[i] ));
31 #endif
32 }
#define MID_TRACE
Definition: debug.h:15
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
smooth NULL
Definition: ftsmooth.c:416
HANDLE Events[2]
Definition: schedsvc.c:40

Referenced by AfdSelect().

◆ SelectTimeout()

static VOID NTAPI SelectTimeout ( PKDPC  Dpc,
PVOID  DeferredContext,
PVOID  SystemArgument1,
PVOID  SystemArgument2 
)
static

Definition at line 96 of file select.c.

99  {
101  PAFD_POLL_INFO PollReq;
102  PIRP Irp;
103  KIRQL OldIrql;
104  PAFD_DEVICE_EXTENSION DeviceExt;
105 
109 
110  AFD_DbgPrint(MID_TRACE,("Called\n"));
111 
112  Irp = Poll->Irp;
113  DeviceExt = Poll->DeviceExt;
114  PollReq = Irp->AssociatedIrp.SystemBuffer;
115 
116  ZeroEvents( PollReq->Handles, PollReq->HandleCount );
117 
118  KeAcquireSpinLock( &DeviceExt->Lock, &OldIrql );
119  SignalSocket( Poll, NULL, PollReq, STATUS_TIMEOUT );
120  KeReleaseSpinLock( &DeviceExt->Lock, OldIrql );
121 
122  AFD_DbgPrint(MID_TRACE,("Timeout\n"));
123 }
#define MID_TRACE
Definition: debug.h:15
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
VOID ZeroEvents(PAFD_HANDLE HandleArray, UINT HandleCount)
Definition: select.c:44
KSPIN_LOCK Lock
Definition: afd.h:113
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
UCHAR KIRQL
Definition: env_spec_w32.h:591
VOID SignalSocket(PAFD_ACTIVE_POLL Poll OPTIONAL, PIRP _Irp OPTIONAL, PAFD_POLL_INFO PollReq, NTSTATUS Status)
Definition: select.c:56
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:675
_In_ LARGE_INTEGER _In_opt_ PKDPC Dpc
Definition: kefuncs.h:524
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
ULONG HandleCount
Definition: shared.h:57
AFD_HANDLE Handles[1]
Definition: shared.h:59
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
PAFD_DEVICE_EXTENSION DeviceExt
Definition: afd.h:119
PIRP Irp
Definition: afd.h:118
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:675

◆ SignalSocket()

VOID SignalSocket ( PAFD_ACTIVE_POLL Poll  OPTIONAL,
PIRP _Irp  OPTIONAL,
PAFD_POLL_INFO  PollReq,
NTSTATUS  Status 
)

Definition at line 56 of file select.c.

62 {
63  UINT i;
64  PIRP Irp = _Irp ? _Irp : Poll->Irp;
65  AFD_DbgPrint(MID_TRACE,("Called (Status %x)\n", Status));
66 
67  if (Poll)
68  {
69  KeCancelTimer( &Poll->Timer );
70  RemoveEntryList( &Poll->ListEntry );
72  }
73 
74  Irp->IoStatus.Status = Status;
75  Irp->IoStatus.Information =
76  FIELD_OFFSET(AFD_POLL_INFO, Handles) + sizeof(AFD_HANDLE) * PollReq->HandleCount;
77  CopyBackStatus( PollReq->Handles,
78  PollReq->HandleCount );
79  for( i = 0; i < PollReq->HandleCount; i++ ) {
81  (MAX_TRACE,
82  ("Handle(%x): Got %x,%x\n",
83  PollReq->Handles[i].Handle,
84  PollReq->Handles[i].Events,
85  PollReq->Handles[i].Status));
86  }
87  UnlockHandles( AFD_HANDLES(PollReq), PollReq->HandleCount );
88  if( Irp->MdlAddress ) UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
89  AFD_DbgPrint(MID_TRACE,("Completing\n"));
92  AFD_DbgPrint(MID_TRACE,("Done\n"));
93 }
NTSTATUS Status
Definition: shared.h:52
#define MID_TRACE
Definition: debug.h:15
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
struct _AFD_HANDLE_ AFD_HANDLE
_In_ PIRP Irp
Definition: csq.h:116
IoSetCancelRoutine(Irp, CancelRoutine)
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static VOID CopyBackStatus(PAFD_HANDLE HandleArray, UINT HandleCount)
Definition: select.c:34
ULONG Events
Definition: shared.h:51
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
smooth NULL
Definition: ftsmooth.c:416
#define TAG_AFD_ACTIVE_POLL
Definition: afd.h:49
#define IoCompleteRequest
Definition: irp.c:1240
#define IO_NETWORK_INCREMENT
Definition: tcpip.h:43
BOOLEAN NTAPI KeCancelTimer(IN OUT PKTIMER Timer)
Definition: timerobj.c:206
#define AFD_HANDLES(x)
Definition: afd.h:102
VOID UnlockRequest(PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: lock.c:180
Status
Definition: gdiplustypes.h:24
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define MAX_TRACE
Definition: debug.h:16
ULONG HandleCount
Definition: shared.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
AFD_HANDLE Handles[1]
Definition: shared.h:59
unsigned int UINT
Definition: ndis.h:50
SOCKET Handle
Definition: shared.h:50
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
VOID UnlockHandles(PAFD_HANDLE HandleArray, UINT HandleCount)
Definition: lock.c:348

Referenced by AfdSelect(), CleanupPendingIrp(), KillSelectsForFCB(), PollReeval(), and SelectTimeout().

◆ UpdatePollWithFCB()

static BOOLEAN UpdatePollWithFCB ( PAFD_ACTIVE_POLL  Poll,
PFILE_OBJECT  FileObject 
)
static

Definition at line 382 of file select.c.

382  {
383  UINT i;
384  PAFD_FCB FCB;
385  UINT Signalled = 0;
386  PAFD_POLL_INFO PollReq = Poll->Irp->AssociatedIrp.SystemBuffer;
387 
389 
390  for( i = 0; i < PollReq->HandleCount; i++ ) {
391  if( !AFD_HANDLES(PollReq)[i].Handle ) continue;
392 
393  FileObject = (PFILE_OBJECT)AFD_HANDLES(PollReq)[i].Handle;
394  FCB = FileObject->FsContext;
395 
396  PollReq->Handles[i].Status = PollReq->Handles[i].Events & FCB->PollState;
397  if( PollReq->Handles[i].Status ) {
398  AFD_DbgPrint(MID_TRACE,("Signalling %p with %x\n",
399  FCB, FCB->PollState));
400  Signalled++;
401  }
402  }
403 
404  return Signalled ? 1 : 0;
405 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
NTSTATUS Status
Definition: shared.h:52
#define MID_TRACE
Definition: debug.h:15
Definition: cdstruc.h:908
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG Events
Definition: shared.h:51
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
struct _FCB FCB
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
Definition: afd.h:161
_In_ HANDLE Handle
Definition: extypes.h:390
#define AFD_HANDLES(x)
Definition: afd.h:102
* PFILE_OBJECT
Definition: iotypes.h:1955
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
ULONG HandleCount
Definition: shared.h:57
AFD_HANDLE Handles[1]
Definition: shared.h:59
unsigned int UINT
Definition: ndis.h:50
PIRP Irp
Definition: afd.h:118

Referenced by PollReeval().

◆ ZeroEvents()

VOID ZeroEvents ( PAFD_HANDLE  HandleArray,
UINT  HandleCount 
)

Definition at line 44 of file select.c.

45  {
46  UINT i;
47 
48  for( i = 0; i < HandleCount; i++ ) {
49  HandleArray[i].Status = 0;
50  HandleArray[i].Events = 0;
51  }
52 }
NTSTATUS Status
Definition: shared.h:52
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG Events
Definition: shared.h:51
unsigned int UINT
Definition: ndis.h:50

Referenced by CleanupPendingIrp(), KillSelectsForFCB(), and SelectTimeout().

Variable Documentation

◆ SelectTimeout

KDEFERRED_ROUTINE SelectTimeout
static

Definition at line 95 of file select.c.

Referenced by AfdSelect().