VOID NotificationThread(__in PDokanDCB Dcb) { PKEVENT events[5]; PKWAIT_BLOCK waitBlock; NTSTATUS status; DDbgPrint("==> NotificationThread\n"); waitBlock = ExAllocatePool(sizeof(KWAIT_BLOCK) * 5); if (waitBlock == NULL) { DDbgPrint(" Can't allocate WAIT_BLOCK\n"); return; } events[0] = &Dcb->ReleaseEvent; events[1] = &Dcb->NotifyEvent.NotEmpty; events[2] = &Dcb->PendingEvent.NotEmpty; events[3] = &Dcb->Global->PendingService.NotEmpty; events[4] = &Dcb->Global->NotifyService.NotEmpty; do { status = KeWaitForMultipleObjects(5, events, WaitAny, Executive, KernelMode, FALSE, NULL, waitBlock); if (status != STATUS_WAIT_0) { if (status == STATUS_WAIT_1 || status == STATUS_WAIT_2) { NotificationLoop(&Dcb->PendingEvent, &Dcb->NotifyEvent); } else { NotificationLoop(&Dcb->Global->PendingService, &Dcb->Global->NotifyService); } } } while (status != STATUS_WAIT_0); ExFreePool(waitBlock); DDbgPrint("<== NotificationThread\n"); }
VOID NotificationThread( __in PDEVICE_EXTENSION DeviceExtension ) { PKEVENT events[5]; NTSTATUS status; DDbgPrint("==> NotificationThread\n"); events[0] = &DeviceExtension->ReleaseEvent; events[1] = &DeviceExtension->NotifyEvent.NotEmpty; events[2] = &DeviceExtension->PendingEvent.NotEmpty; events[3] = &DeviceExtension->Global->PendingService.NotEmpty; events[4] = &DeviceExtension->Global->NotifyService.NotEmpty; while (1) { status = KeWaitForMultipleObjects( 3, events, WaitAny, Executive, KernelMode, FALSE, NULL, NULL); if (status == STATUS_WAIT_0) { ; break; } else if (status == STATUS_WAIT_1 || status == STATUS_WAIT_2) { NotificationLoop( &DeviceExtension->PendingEvent, &DeviceExtension->NotifyEvent); } else { NotificationLoop( &DeviceExtension->Global->PendingService, &DeviceExtension->Global->NotifyService); } } DDbgPrint("<== NotificationThread\n"); }