mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
{MOUNTMGR]
- Use portable KeXxxSpinLock, instead of fastcall variants - Fix usage of uninitialized variable - Fix typos in assignments - Fix several integer size bugs - Fix uninitialied variables (and those gcc couldn't identify as initialized) - Fix MSVC warnings svn path=/trunk/; revision=55651
This commit is contained in:
parent
9f969348ab
commit
ced3afac1d
5 changed files with 48 additions and 44 deletions
|
@ -175,7 +175,9 @@ GetRemoteDatabaseEntry(IN HANDLE Database,
|
||||||
&ByteOffset,
|
&ByteOffset,
|
||||||
NULL);
|
NULL);
|
||||||
/* If it fails or returns inconsistent data, drop it (= truncate) */
|
/* If it fails or returns inconsistent data, drop it (= truncate) */
|
||||||
if (!NT_SUCCESS(Status) || IoStatusBlock.Information != EntrySize || EntrySize < sizeof(DATABASE_ENTRY))
|
if (!NT_SUCCESS(Status) ||
|
||||||
|
(IoStatusBlock.Information != EntrySize) ||
|
||||||
|
(EntrySize < sizeof(DATABASE_ENTRY)) )
|
||||||
{
|
{
|
||||||
TruncateRemoteDatabase(Database, StartingOffset);
|
TruncateRemoteDatabase(Database, StartingOffset);
|
||||||
FreePool(Entry);
|
FreePool(Entry);
|
||||||
|
@ -184,7 +186,7 @@ GetRemoteDatabaseEntry(IN HANDLE Database,
|
||||||
|
|
||||||
/* Validate entry */
|
/* Validate entry */
|
||||||
if (MAX(Entry->SymbolicNameOffset + Entry->SymbolicNameLength,
|
if (MAX(Entry->SymbolicNameOffset + Entry->SymbolicNameLength,
|
||||||
Entry->UniqueIdOffset + Entry->UniqueIdLength) > EntrySize)
|
Entry->UniqueIdOffset + Entry->UniqueIdLength) > (LONG)EntrySize)
|
||||||
{
|
{
|
||||||
TruncateRemoteDatabase(Database, StartingOffset);
|
TruncateRemoteDatabase(Database, StartingOffset);
|
||||||
FreePool(Entry);
|
FreePool(Entry);
|
||||||
|
@ -201,10 +203,10 @@ NTSTATUS
|
||||||
DeleteRemoteDatabaseEntry(IN HANDLE Database,
|
DeleteRemoteDatabaseEntry(IN HANDLE Database,
|
||||||
IN LONG StartingOffset)
|
IN LONG StartingOffset)
|
||||||
{
|
{
|
||||||
LONG EndSize;
|
ULONG EndSize;
|
||||||
PVOID TmpBuffer;
|
PVOID TmpBuffer;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
LONG DatabaseSize;
|
ULONG DatabaseSize;
|
||||||
PDATABASE_ENTRY Entry;
|
PDATABASE_ENTRY Entry;
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
LARGE_INTEGER EndEntriesOffset;
|
LARGE_INTEGER EndEntriesOffset;
|
||||||
|
@ -423,7 +425,8 @@ WorkerThread(IN PDEVICE_OBJECT DeviceObject,
|
||||||
/* Acquire workers lock */
|
/* Acquire workers lock */
|
||||||
KeWaitForSingleObject(&(DeviceExtension->WorkerSemaphore), Executive, KernelMode, FALSE, NULL);
|
KeWaitForSingleObject(&(DeviceExtension->WorkerSemaphore), Executive, KernelMode, FALSE, NULL);
|
||||||
|
|
||||||
OldIrql = KfAcquireSpinLock(&(DeviceExtension->WorkerLock));
|
KeAcquireSpinLock(&(DeviceExtension->WorkerLock), &OldIrql);
|
||||||
|
|
||||||
/* Ensure there are workers */
|
/* Ensure there are workers */
|
||||||
while (!IsListEmpty(&(DeviceExtension->WorkerQueueListHead)))
|
while (!IsListEmpty(&(DeviceExtension->WorkerQueueListHead)))
|
||||||
{
|
{
|
||||||
|
@ -433,7 +436,7 @@ WorkerThread(IN PDEVICE_OBJECT DeviceObject,
|
||||||
RECONCILE_WORK_ITEM,
|
RECONCILE_WORK_ITEM,
|
||||||
WorkerQueueListEntry);
|
WorkerQueueListEntry);
|
||||||
|
|
||||||
KfReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
KeReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
||||||
|
|
||||||
/* Call it */
|
/* Call it */
|
||||||
WorkItem->WorkerRoutine(WorkItem->Context);
|
WorkItem->WorkerRoutine(WorkItem->Context);
|
||||||
|
@ -447,9 +450,9 @@ WorkerThread(IN PDEVICE_OBJECT DeviceObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
KeWaitForSingleObject(&(DeviceExtension->WorkerSemaphore), Executive, KernelMode, FALSE, NULL);
|
KeWaitForSingleObject(&(DeviceExtension->WorkerSemaphore), Executive, KernelMode, FALSE, NULL);
|
||||||
OldIrql = KfAcquireSpinLock(&(DeviceExtension->WorkerLock));
|
KeAcquireSpinLock(&(DeviceExtension->WorkerLock), &OldIrql);
|
||||||
}
|
}
|
||||||
KfReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
KeReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
||||||
|
|
||||||
InterlockedDecrement(&(DeviceExtension->WorkerReferences));
|
InterlockedDecrement(&(DeviceExtension->WorkerReferences));
|
||||||
|
|
||||||
|
@ -478,10 +481,10 @@ QueueWorkItem(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise queue worker for delayed execution */
|
/* Otherwise queue worker for delayed execution */
|
||||||
OldIrql = KfAcquireSpinLock(&(DeviceExtension->WorkerLock));
|
KeAcquireSpinLock(&(DeviceExtension->WorkerLock), &OldIrql);
|
||||||
InsertTailList(&(DeviceExtension->WorkerQueueListHead),
|
InsertTailList(&(DeviceExtension->WorkerQueueListHead),
|
||||||
&(WorkItem->WorkerQueueListEntry));
|
&(WorkItem->WorkerQueueListEntry));
|
||||||
KfReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
KeReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
||||||
|
|
||||||
KeReleaseSemaphore(&(DeviceExtension->WorkerSemaphore), IO_NO_INCREMENT, 1, FALSE);
|
KeReleaseSemaphore(&(DeviceExtension->WorkerSemaphore), IO_NO_INCREMENT, 1, FALSE);
|
||||||
|
|
||||||
|
@ -638,8 +641,8 @@ QueryVolumeName(IN HANDLE RootDirectory,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the volume name */
|
/* Return the volume name */
|
||||||
VolumeName->Length = FileNameInfo->FileNameLength;
|
VolumeName->Length = (USHORT)FileNameInfo->FileNameLength;
|
||||||
VolumeName->MaximumLength = FileNameInfo->FileNameLength + sizeof(WCHAR);
|
VolumeName->MaximumLength = (USHORT)FileNameInfo->FileNameLength + sizeof(WCHAR);
|
||||||
VolumeName->Buffer = AllocatePool(VolumeName->MaximumLength);
|
VolumeName->Buffer = AllocatePool(VolumeName->MaximumLength);
|
||||||
if (!VolumeName->Buffer)
|
if (!VolumeName->Buffer)
|
||||||
{
|
{
|
||||||
|
@ -993,7 +996,7 @@ MigrateRemoteDatabaseWorker(IN PDEVICE_OBJECT DeviceObject,
|
||||||
}
|
}
|
||||||
if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
|
if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
|
||||||
{
|
{
|
||||||
Status == STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
Complete = TRUE;
|
Complete = TRUE;
|
||||||
}
|
}
|
||||||
if (!NT_SUCCESS(Status) || Complete)
|
if (!NT_SUCCESS(Status) || Complete)
|
||||||
|
@ -1022,7 +1025,7 @@ MigrateRemoteDatabaseWorker(IN PDEVICE_OBJECT DeviceObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* And write them into new database */
|
/* And write them into new database */
|
||||||
Length = IoStatusBlock.Information;
|
Length = (ULONG)IoStatusBlock.Information;
|
||||||
Status = ZwWriteFile(Database,
|
Status = ZwWriteFile(Database,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1228,7 +1231,7 @@ QueryUniqueIdQueryRoutine(IN PWSTR ValueName,
|
||||||
if (IntUniqueId)
|
if (IntUniqueId)
|
||||||
{
|
{
|
||||||
/* Copy data & return */
|
/* Copy data & return */
|
||||||
IntUniqueId->UniqueIdLength = ValueLength;
|
IntUniqueId->UniqueIdLength = (USHORT)ValueLength;
|
||||||
RtlCopyMemory(&(IntUniqueId->UniqueId), ValueData, ValueLength);
|
RtlCopyMemory(&(IntUniqueId->UniqueId), ValueData, ValueLength);
|
||||||
|
|
||||||
UniqueId = Context;
|
UniqueId = Context;
|
||||||
|
|
|
@ -94,7 +94,7 @@ MountmgrWriteNoAutoMount(IN PDEVICE_EXTENSION DeviceExtension)
|
||||||
REG_DWORD,
|
REG_DWORD,
|
||||||
&Value,
|
&Value,
|
||||||
sizeof(Value));
|
sizeof(Value));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -221,10 +221,10 @@ NTSTATUS
|
||||||
MountMgrScrubRegistry(IN PDEVICE_EXTENSION DeviceExtension)
|
MountMgrScrubRegistry(IN PDEVICE_EXTENSION DeviceExtension)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
BOOLEAN Continue = TRUE;
|
BOOLEAN Continue;
|
||||||
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
|
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
|
||||||
|
|
||||||
while (Continue)
|
do
|
||||||
{
|
{
|
||||||
RtlZeroMemory(QueryTable, sizeof(QueryTable));
|
RtlZeroMemory(QueryTable, sizeof(QueryTable));
|
||||||
QueryTable[0].QueryRoutine = ScrubRegistryRoutine;
|
QueryTable[0].QueryRoutine = ScrubRegistryRoutine;
|
||||||
|
@ -237,6 +237,7 @@ MountMgrScrubRegistry(IN PDEVICE_EXTENSION DeviceExtension)
|
||||||
DeviceExtension,
|
DeviceExtension,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
while (Continue);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -513,7 +514,7 @@ MountMgrNextDriveLetterWorker(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
if (IsDriveLetter(&(SymlinkInformation->Name)) && SymlinkInformation->Online)
|
if (IsDriveLetter(&(SymlinkInformation->Name)) && SymlinkInformation->Online)
|
||||||
{
|
{
|
||||||
DriveLetterInfo->DriveLetterWasAssigned = FALSE;
|
DriveLetterInfo->DriveLetterWasAssigned = FALSE;
|
||||||
DriveLetterInfo->CurrentDriveLetter = SymlinkInformation->Name.Buffer[LETTER_POSITION];
|
DriveLetterInfo->CurrentDriveLetter = (CHAR)SymlinkInformation->Name.Buffer[LETTER_POSITION];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -972,8 +973,8 @@ MountMgrQueryPoints(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We can't go beyond */
|
/* We can't go beyond */
|
||||||
if (MountPoint->SymbolicLinkNameLength + MountPoint->UniqueIdLength +
|
if (((ULONG)MountPoint->SymbolicLinkNameLength + MountPoint->UniqueIdLength +
|
||||||
MountPoint->DeviceNameLength < Stack->Parameters.DeviceIoControl.InputBufferLength)
|
MountPoint->DeviceNameLength) < Stack->Parameters.DeviceIoControl.InputBufferLength)
|
||||||
{
|
{
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
@ -1234,7 +1235,7 @@ MountMgrDeletePointsDbOnly(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
MountMgrVolumeMountPointChanged(IN PDEVICE_EXTENSION DeviceExtension,
|
MountMgrVolumeMountPointChanged(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
IN PIRP Irp,
|
IN PIRP Irp,
|
||||||
IN NTSTATUS LockStatus,
|
IN NTSTATUS LockStatus,
|
||||||
OUT PUNICODE_STRING SourceDeviceName,
|
OUT PUNICODE_STRING SourceDeviceName,
|
||||||
OUT PUNICODE_STRING SourceSymbolicName,
|
OUT PUNICODE_STRING SourceSymbolicName,
|
||||||
OUT PUNICODE_STRING TargetVolumeName)
|
OUT PUNICODE_STRING TargetVolumeName)
|
||||||
|
@ -1265,7 +1266,7 @@ MountMgrVolumeMountPointChanged(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
|
|
||||||
VolumeMountPoint = (PMOUNTMGR_VOLUME_MOUNT_POINT)Irp->AssociatedIrp.SystemBuffer;
|
VolumeMountPoint = (PMOUNTMGR_VOLUME_MOUNT_POINT)Irp->AssociatedIrp.SystemBuffer;
|
||||||
|
|
||||||
if (VolumeMountPoint->SourceVolumeNameLength + VolumeMountPoint->TargetVolumeNameLength <
|
if (((ULONG)VolumeMountPoint->SourceVolumeNameLength + VolumeMountPoint->TargetVolumeNameLength) <
|
||||||
Stack->Parameters.DeviceIoControl.InputBufferLength)
|
Stack->Parameters.DeviceIoControl.InputBufferLength)
|
||||||
{
|
{
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
@ -1406,7 +1407,7 @@ MountMgrVolumeMountPointChanged(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
|
|
||||||
/* Return symbolic name */
|
/* Return symbolic name */
|
||||||
SourceSymbolicName->Length =
|
SourceSymbolicName->Length =
|
||||||
SourceSymbolicName->MaximumLength = FileNameInfo->FileNameLength;
|
SourceSymbolicName->MaximumLength = (USHORT)FileNameInfo->FileNameLength;
|
||||||
SourceSymbolicName->Buffer = (PWSTR)FileNameInfo;
|
SourceSymbolicName->Buffer = (PWSTR)FileNameInfo;
|
||||||
/* memmove allows memory overlap */
|
/* memmove allows memory overlap */
|
||||||
RtlMoveMemory(SourceSymbolicName->Buffer, FileNameInfo->FileName, SourceSymbolicName->Length);
|
RtlMoveMemory(SourceSymbolicName->Buffer, FileNameInfo->FileName, SourceSymbolicName->Length);
|
||||||
|
|
|
@ -131,7 +131,7 @@ CreateNewDriveLetterName(OUT PUNICODE_STRING DriveLetter,
|
||||||
IN UCHAR Letter,
|
IN UCHAR Letter,
|
||||||
IN PMOUNTDEV_UNIQUE_ID UniqueId OPTIONAL)
|
IN PMOUNTDEV_UNIQUE_ID UniqueId OPTIONAL)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status = STATUS_UNSUCCESSFUL;
|
||||||
|
|
||||||
/* Allocate a big enough buffer to contain the symbolic link */
|
/* Allocate a big enough buffer to contain the symbolic link */
|
||||||
DriveLetter->MaximumLength = sizeof(DosDevices.Buffer) + 3 * sizeof(WCHAR);
|
DriveLetter->MaximumLength = sizeof(DosDevices.Buffer) + 3 * sizeof(WCHAR);
|
||||||
|
@ -907,7 +907,7 @@ MountMgrUnload(IN struct _DRIVER_OBJECT *DriverObject)
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
ULONG
|
BOOLEAN
|
||||||
MountmgrReadNoAutoMount(IN PUNICODE_STRING RegistryPath)
|
MountmgrReadNoAutoMount(IN PUNICODE_STRING RegistryPath)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -931,10 +931,10 @@ MountmgrReadNoAutoMount(IN PUNICODE_STRING RegistryPath)
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Default;
|
return (Default != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result;
|
return (Result != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1009,7 +1009,7 @@ MountMgrMountedDeviceArrival(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
|
|
||||||
if (RtlEqualUnicodeString(&(DeviceInformation->SymbolicName), &(CurrentDevice->SymbolicName), TRUE))
|
if (RtlEqualUnicodeString(&(DeviceInformation->SymbolicName), &(CurrentDevice->SymbolicName), TRUE))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1054,7 +1054,7 @@ MountMgrMountedDeviceArrival(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
/* If it's OK, set it and save its letter (if any) */
|
/* If it's OK, set it and save its letter (if any) */
|
||||||
if (SuggestedLinkName.Buffer && IsDriveLetter(&SuggestedLinkName))
|
if (SuggestedLinkName.Buffer && IsDriveLetter(&SuggestedLinkName))
|
||||||
{
|
{
|
||||||
DeviceInformation->SuggestedDriveLetter = SuggestedLinkName.Buffer[LETTER_POSITION];
|
DeviceInformation->SuggestedDriveLetter = (UCHAR)SuggestedLinkName.Buffer[LETTER_POSITION];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Acquire driver exclusively */
|
/* Acquire driver exclusively */
|
||||||
|
@ -1069,7 +1069,7 @@ MountMgrMountedDeviceArrival(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
|
|
||||||
if (RtlEqualUnicodeString(&(DeviceInformation->DeviceName), &TargetDeviceName, TRUE))
|
if (RtlEqualUnicodeString(&(DeviceInformation->DeviceName), &TargetDeviceName, TRUE))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ SendOnlineNotificationWorker(IN PVOID Parameter)
|
||||||
/* First, send the notification */
|
/* First, send the notification */
|
||||||
SendOnlineNotification(&(WorkItem->SymbolicName));
|
SendOnlineNotification(&(WorkItem->SymbolicName));
|
||||||
|
|
||||||
OldIrql = KfAcquireSpinLock(&(DeviceExtension->WorkerLock));
|
KeAcquireSpinLock(&(DeviceExtension->WorkerLock), &OldIrql);
|
||||||
/* If there are no notifications running any longer, reset event */
|
/* If there are no notifications running any longer, reset event */
|
||||||
if (--DeviceExtension->OnlineNotificationCount == 0)
|
if (--DeviceExtension->OnlineNotificationCount == 0)
|
||||||
{
|
{
|
||||||
|
@ -120,7 +120,7 @@ SendOnlineNotificationWorker(IN PVOID Parameter)
|
||||||
/* Queue a new one for execution */
|
/* Queue a new one for execution */
|
||||||
Head = RemoveHeadList(&(DeviceExtension->OnlineNotificationListHead));
|
Head = RemoveHeadList(&(DeviceExtension->OnlineNotificationListHead));
|
||||||
NewWorkItem = CONTAINING_RECORD(Head, ONLINE_NOTIFICATION_WORK_ITEM, List);
|
NewWorkItem = CONTAINING_RECORD(Head, ONLINE_NOTIFICATION_WORK_ITEM, List);
|
||||||
KfReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
KeReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
||||||
NewWorkItem->List.Blink = NULL;
|
NewWorkItem->List.Blink = NULL;
|
||||||
NewWorkItem->List.Flink = NULL;
|
NewWorkItem->List.Flink = NULL;
|
||||||
ExQueueWorkItem((PWORK_QUEUE_ITEM)NewWorkItem, DelayedWorkQueue);
|
ExQueueWorkItem((PWORK_QUEUE_ITEM)NewWorkItem, DelayedWorkQueue);
|
||||||
|
@ -129,7 +129,7 @@ SendOnlineNotificationWorker(IN PVOID Parameter)
|
||||||
{
|
{
|
||||||
/* Mark it's over */
|
/* Mark it's over */
|
||||||
DeviceExtension->OnlineNotificationWorkerActive = 0;
|
DeviceExtension->OnlineNotificationWorkerActive = 0;
|
||||||
KfReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
KeReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool(WorkItem->SymbolicName.Buffer);
|
FreePool(WorkItem->SymbolicName.Buffer);
|
||||||
|
@ -171,14 +171,14 @@ PostOnlineNotification(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
RtlCopyMemory(WorkItem->SymbolicName.Buffer, SymbolicName->Buffer, SymbolicName->Length);
|
RtlCopyMemory(WorkItem->SymbolicName.Buffer, SymbolicName->Buffer, SymbolicName->Length);
|
||||||
WorkItem->SymbolicName.Buffer[SymbolicName->Length / sizeof(WCHAR)] = UNICODE_NULL;
|
WorkItem->SymbolicName.Buffer[SymbolicName->Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||||
|
|
||||||
OldIrql = KfAcquireSpinLock(&(DeviceExtension->WorkerLock));
|
KeAcquireSpinLock(&(DeviceExtension->WorkerLock), &OldIrql);
|
||||||
DeviceExtension->OnlineNotificationCount++;
|
DeviceExtension->OnlineNotificationCount++;
|
||||||
|
|
||||||
/* If no worker are active */
|
/* If no worker are active */
|
||||||
if (DeviceExtension->OnlineNotificationWorkerActive == 0)
|
if (DeviceExtension->OnlineNotificationWorkerActive == 0)
|
||||||
{
|
{
|
||||||
/* Queue that one for execution */
|
/* Queue that one for execution */
|
||||||
DeviceExtension->OnlineNotificationWorkerActive == 1;
|
DeviceExtension->OnlineNotificationWorkerActive = 1;
|
||||||
ExQueueWorkItem((PWORK_QUEUE_ITEM)WorkItem, DelayedWorkQueue);
|
ExQueueWorkItem((PWORK_QUEUE_ITEM)WorkItem, DelayedWorkQueue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -187,7 +187,7 @@ PostOnlineNotification(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
InsertTailList(&(DeviceExtension->OnlineNotificationListHead), &(WorkItem->List));
|
InsertTailList(&(DeviceExtension->OnlineNotificationListHead), &(WorkItem->List));
|
||||||
}
|
}
|
||||||
|
|
||||||
KfReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
KeReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -202,13 +202,13 @@ WaitForOnlinesToComplete(IN PDEVICE_EXTENSION DeviceExtension)
|
||||||
|
|
||||||
KeInitializeEvent(&(DeviceExtension->OnlineNotificationEvent), NotificationEvent, FALSE);
|
KeInitializeEvent(&(DeviceExtension->OnlineNotificationEvent), NotificationEvent, FALSE);
|
||||||
|
|
||||||
OldIrql = KfAcquireSpinLock(&(DeviceExtension->WorkerLock));
|
KeAcquireSpinLock(&(DeviceExtension->WorkerLock), &OldIrql);
|
||||||
|
|
||||||
/* Just wait all the worker are done */
|
/* Just wait all the worker are done */
|
||||||
if (DeviceExtension->OnlineNotificationCount != 1)
|
if (DeviceExtension->OnlineNotificationCount != 1)
|
||||||
{
|
{
|
||||||
DeviceExtension->OnlineNotificationCount--;
|
DeviceExtension->OnlineNotificationCount--;
|
||||||
KfReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
KeReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
||||||
|
|
||||||
KeWaitForSingleObject(&(DeviceExtension->OnlineNotificationEvent),
|
KeWaitForSingleObject(&(DeviceExtension->OnlineNotificationEvent),
|
||||||
Executive,
|
Executive,
|
||||||
|
@ -216,11 +216,11 @@ WaitForOnlinesToComplete(IN PDEVICE_EXTENSION DeviceExtension)
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
OldIrql = KfAcquireSpinLock(&(DeviceExtension->WorkerLock));
|
KeAcquireSpinLock(&(DeviceExtension->WorkerLock), &OldIrql);
|
||||||
DeviceExtension->OnlineNotificationCount++;
|
DeviceExtension->OnlineNotificationCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
KfReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
KeReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -477,7 +477,7 @@ MountMgrNotifyNameChange(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
VOID
|
VOID
|
||||||
RemoveWorkItem(IN PUNIQUE_ID_WORK_ITEM WorkItem)
|
RemoveWorkItem(IN PUNIQUE_ID_WORK_ITEM WorkItem)
|
||||||
{
|
{
|
||||||
PDEVICE_EXTENSION DeviceExtension;
|
PDEVICE_EXTENSION DeviceExtension = WorkItem->DeviceExtension;
|
||||||
|
|
||||||
KeWaitForSingleObject(&(DeviceExtension->DeviceLock), Executive, KernelMode, FALSE, NULL);
|
KeWaitForSingleObject(&(DeviceExtension->DeviceLock), Executive, KernelMode, FALSE, NULL);
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ IssueUniqueIdChangeNotifyWorker(IN PUNIQUE_ID_WORK_ITEM WorkItem,
|
||||||
|
|
||||||
/* Initialize the IRP */
|
/* Initialize the IRP */
|
||||||
Irp = WorkItem->Irp;
|
Irp = WorkItem->Irp;
|
||||||
IoInitializeIrp(Irp, IoSizeOfIrp(WorkItem->StackSize), WorkItem->StackSize);
|
IoInitializeIrp(Irp, IoSizeOfIrp(WorkItem->StackSize), (CCHAR)WorkItem->StackSize);
|
||||||
|
|
||||||
if (InterlockedExchange((PLONG)&(WorkItem->Event), 0) != 0)
|
if (InterlockedExchange((PLONG)&(WorkItem->Event), 0) != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -852,7 +852,7 @@ RedirectSavedLink(IN PSAVED_LINK_INFORMATION SavedLinkInformation,
|
||||||
RemoveEntryList(&(SymlinkInformation->SymbolicLinksListEntry));
|
RemoveEntryList(&(SymlinkInformation->SymbolicLinksListEntry));
|
||||||
FreePool(SymlinkInformation->Name.Buffer);
|
FreePool(SymlinkInformation->Name.Buffer);
|
||||||
FreePool(SymlinkInformation);
|
FreePool(SymlinkInformation);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue