82 DeviceExtension =
WorkItem->DeviceExtension;
89 if (--DeviceExtension->OnlineNotificationCount == 0)
95 if (!
IsListEmpty(&(DeviceExtension->OnlineNotificationListHead)))
98 Head =
RemoveHeadList(&(DeviceExtension->OnlineNotificationListHead));
108 DeviceExtension->OnlineNotificationWorkerActive = 0;
136 WorkItem->DeviceExtension = DeviceExtension;
150 DeviceExtension->OnlineNotificationCount++;
153 if (DeviceExtension->OnlineNotificationWorkerActive == 0)
156 DeviceExtension->OnlineNotificationWorkerActive = 1;
183 if (DeviceExtension->OnlineNotificationCount != 1)
185 DeviceExtension->OnlineNotificationCount--;
195 DeviceExtension->OnlineNotificationCount++;
270 DeviceExtension->DriverObject,
273 &(DeviceInformation->TargetDeviceNotificationEntry));
276 DeviceInformation->TargetDeviceNotificationEntry =
NULL;
296 DeviceExtension->EpicNumber++;
302 while (!
IsListEmpty(&(DeviceExtension->IrpListHead)))
317 *((
PULONG)
Irp->AssociatedIrp.SystemBuffer) = DeviceExtension->EpicNumber;
318 Irp->IoStatus.Information =
sizeof(DeviceExtension->EpicNumber);
348 for (NextEntry = DeviceExtension->DeviceListHead.
Flink;
349 NextEntry != &DeviceExtension->DeviceListHead;
350 NextEntry = NextEntry->
Flink)
360 if (NextEntry == &(DeviceExtension->DeviceListHead) ||
401 Irp->IoStatus.Information = 0;
427 if (DeviceRelations->
Count < 1)
437 DeviceNotification.
Version = 1;
439 DeviceNotification.
Event = GUID_IO_VOLUME_NAME_CHANGE;
502 UniqueIdChange =
WorkItem->Irp->AssociatedIrp.SystemBuffer;
602 Irp->AssociatedIrp.SystemBuffer =
WorkItem->IrpBuffer;
608 Stack->Parameters.DeviceIoControl.InputBufferLength = UniqueId->UniqueIdLength +
sizeof(
USHORT);
609 Stack->Parameters.DeviceIoControl.OutputBufferLength =
WorkItem->IrpBufferLength;
610 Stack->Parameters.DeviceIoControl.Type3InputBuffer = 0;
678 WorkItem->DeviceExtension = DeviceExtension;
#define InterlockedExchange
#define InterlockedDecrement
#define STATUS_NOT_SUPPORTED
#define NT_SUCCESS(StatCode)
static const WCHAR Cleanup[]
VOID ReconcileThisDatabaseWithMaster(IN PDEVICE_EXTENSION DeviceExtension, IN PDEVICE_INFORMATION DeviceInformation)
VOID SendOnlineNotification(IN PUNICODE_STRING SymbolicName)
VOID NTAPI SendOnlineNotificationWorker(IN PVOID Parameter)
NTSTATUS NTAPI MountMgrTargetDeviceNotification(IN PVOID NotificationStructure, IN PVOID Context)
VOID RemoveWorkItem(IN PUNIQUE_ID_WORK_ITEM WorkItem)
VOID MountMgrNotifyNameChange(IN PDEVICE_EXTENSION DeviceExtension, IN PUNICODE_STRING DeviceName, IN BOOLEAN ValidateVolume)
VOID PostOnlineNotification(IN PDEVICE_EXTENSION DeviceExtension, IN PUNICODE_STRING SymbolicName)
VOID NTAPI UniqueIdChangeNotifyWorker(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
VOID RegisterForTargetDeviceNotification(IN PDEVICE_EXTENSION DeviceExtension, IN PDEVICE_INFORMATION DeviceInformation)
VOID IssueUniqueIdChangeNotify(IN PDEVICE_EXTENSION DeviceExtension, IN PUNICODE_STRING DeviceName, IN PMOUNTDEV_UNIQUE_ID UniqueId)
VOID MountMgrNotify(IN PDEVICE_EXTENSION DeviceExtension)
VOID IssueUniqueIdChangeNotifyWorker(IN PUNIQUE_ID_WORK_ITEM WorkItem, IN PMOUNTDEV_UNIQUE_ID UniqueId)
VOID WaitForOnlinesToComplete(IN PDEVICE_EXTENSION DeviceExtension)
NTSTATUS NTAPI UniqueIdChangeNotifyCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define PsGetCurrentThread()
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeReleaseSpinLock(sl, irql)
#define KeSetEvent(pEvt, foo, foo2)
#define KeAcquireSpinLock(sl, irql)
#define RemoveHeadList(ListHead)
#define InitializeListHead(ListHead)
#define InterlockedCompareExchange
NTSTATUS NTAPI IoSetCompletionRoutineEx(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PIO_COMPLETION_ROUTINE CompletionRoutine, IN PVOID Context, IN BOOLEAN InvokeOnSuccess, IN BOOLEAN InvokeOnError, IN BOOLEAN InvokeOnCancel)
VOID NTAPI IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem, IN PIO_WORKITEM_ROUTINE WorkerRoutine, IN WORK_QUEUE_TYPE QueueType, IN PVOID Context)
VOID NTAPI IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
IoSetCancelRoutine(Irp, CancelRoutine)
VOID MountMgrUniqueIdChangeRoutine(IN PDEVICE_EXTENSION DeviceExtension, IN PMOUNTDEV_UNIQUE_ID OldUniqueId, IN PMOUNTDEV_UNIQUE_ID NewUniqueId)
#define AllocatePool(Size)
struct _ONLINE_NOTIFICATION_WORK_ITEM * PONLINE_NOTIFICATION_WORK_ITEM
#define IOCTL_MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY
static OUT PIO_STATUS_BLOCK IoStatusBlock
struct _MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY_OUTPUT MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY_OUTPUT
_In_ PNDIS_STRING _In_ PNDIS_STRING SymbolicName
#define FILE_READ_ATTRIBUTES
#define UNREFERENCED_PARAMETER(P)
#define IOCTL_VOLUME_ONLINE
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
PDEVICE_OBJECT NTAPI IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
VOID NTAPI IoInitializeIrp(IN PIRP Irp, IN USHORT PacketSize, IN CCHAR StackSize)
#define IoCompleteRequest
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
VOID NTAPI IoFreeIrp(IN PIRP Irp)
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
VOID NTAPI IoAcquireCancelSpinLock(OUT PKIRQL Irql)
NTSTATUS NTAPI IoRegisterPlugPlayNotification(_In_ IO_NOTIFICATION_EVENT_CATEGORY EventCategory, _In_ ULONG EventCategoryFlags, _In_opt_ PVOID EventCategoryData, _In_ PDRIVER_OBJECT DriverObject, _In_ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine, _Inout_opt_ PVOID Context, _Out_ PVOID *NotificationEntry)
NTSTATUS NTAPI IoReportTargetDeviceChangeAsynchronous(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PVOID NotificationStructure, IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL, IN PVOID Context OPTIONAL)
#define IsEqualGUID(rguid1, rguid2)
#define IRP_MJ_DEVICE_CONTROL
LONG NTAPI KeReleaseSemaphore(IN PKSEMAPHORE Semaphore, IN KPRIORITY Increment, IN LONG Adjustment, IN BOOLEAN Wait)
#define STATUS_MORE_PROCESSING_REQUIRED
PDEVICE_OBJECT Objects[1]
struct _LIST_ENTRY * Blink
struct _LIST_ENTRY * Flink
struct _FILE_OBJECT * FileObject
#define RtlCopyMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
_In_ PWDFDEVICE_INIT _In_ PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
_Must_inspect_result_ _In_ PWDF_WORKITEM_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWORKITEM * WorkItem
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
#define ExInitializeWorkItem(Item, Routine, Context)
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
#define IoSizeOfIrp(_StackSize)
_In_ PVOID NotificationStructure
struct _DEVICE_RELATIONS * PDEVICE_RELATIONS
#define IRP_MN_QUERY_DEVICE_RELATIONS
@ EventCategoryTargetDeviceChange
struct _TARGET_DEVICE_CUSTOM_NOTIFICATION TARGET_DEVICE_CUSTOM_NOTIFICATION
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
#define ObDereferenceObject
_Inout_opt_ PVOID Parameter