{
/* Queue a new one for execution */
Head = RemoveHeadList(&(DeviceExtension->OnlineNotificationListHead));
- NewWorkItem = CONTAINING_RECORD(Head, ONLINE_NOTIFICATION_WORK_ITEM, List);
+ NewWorkItem = CONTAINING_RECORD(Head, ONLINE_NOTIFICATION_WORK_ITEM, WorkItem.List);
KeReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
- NewWorkItem->List.Blink = NULL;
- NewWorkItem->List.Flink = NULL;
- ExQueueWorkItem((PWORK_QUEUE_ITEM)NewWorkItem, DelayedWorkQueue);
+ NewWorkItem->WorkItem.List.Blink = NULL;
+ NewWorkItem->WorkItem.List.Flink = NULL;
+ ExQueueWorkItem(&NewWorkItem->WorkItem, DelayedWorkQueue);
}
else
{
return;
}
- WorkItem->List.Flink = NULL;
+ ExInitializeWorkItem(&WorkItem->WorkItem, SendOnlineNotificationWorker, WorkItem);
WorkItem->DeviceExtension = DeviceExtension;
- WorkItem->WorkerRoutine = SendOnlineNotificationWorker;
- WorkItem->Parameter = WorkItem;
WorkItem->SymbolicName.Length = SymbolicName->Length;
WorkItem->SymbolicName.MaximumLength = SymbolicName->Length + sizeof(WCHAR);
WorkItem->SymbolicName.Buffer = AllocatePool(WorkItem->SymbolicName.MaximumLength);
{
/* Queue that one for execution */
DeviceExtension->OnlineNotificationWorkerActive = 1;
- ExQueueWorkItem((PWORK_QUEUE_ITEM)WorkItem, DelayedWorkQueue);
+ ExQueueWorkItem(&WorkItem->WorkItem, DelayedWorkQueue);
}
else
{
/* Otherwise, just put it in the queue list */
- InsertTailList(&(DeviceExtension->OnlineNotificationListHead), &(WorkItem->List));
+ InsertTailList(&(DeviceExtension->OnlineNotificationListHead), &(WorkItem->WorkItem.List));
}
KeReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
*/
else if (IsEqualGUID(&(Notification->Event), &GUID_IO_VOLUME_MOUNT))
{
+ /* If we were already mounted, then mark us unmounted */
if (InterlockedCompareExchange(&(DeviceInformation->MountState),
FALSE,
- TRUE) == TRUE)
+ FALSE) == TRUE)
{
InterlockedDecrement(&(DeviceInformation->MountState));
}
+ /* Otherwise, start mounting the device and first, reconcile its DB if required */
else
{
if (DeviceInformation->NeedsReconcile)
{
NextEntry = RemoveHeadList(&(DeviceExtension->IrpListHead));
Irp = CONTAINING_RECORD(NextEntry, IRP, Tail.Overlay.ListEntry);
+ IoSetCancelRoutine(Irp, NULL);
InsertTailList(&CopyList, &(Irp->Tail.Overlay.ListEntry));
}
IoReleaseCancelSpinLock(OldIrql);
- /* Then, notifiy them one by one */
+ /* Then, notify them one by one */
while (!IsListEmpty(&CopyList))
{
NextEntry = RemoveHeadList(&CopyList);
}
}
+ /* No need to notify for a PnP device or if we didn't find the device */
if (NextEntry == &(DeviceExtension->DeviceListHead) ||
- !DeviceInformation->Volume)
+ !DeviceInformation->ManuallyRegistered)
{
return;
}