Synchronize with trunk's revision r57652.
[reactos.git] / drivers / filters / mountmgr / device.c
index 6bc7d81..081f514 100644 (file)
@@ -94,7 +94,7 @@ MountmgrWriteNoAutoMount(IN PDEVICE_EXTENSION DeviceExtension)
                                  REG_DWORD,
                                  &Value,
                                  sizeof(Value));
-                                 
+
 }
 
 /*
@@ -221,10 +221,10 @@ NTSTATUS
 MountMgrScrubRegistry(IN PDEVICE_EXTENSION DeviceExtension)
 {
     NTSTATUS Status;
-    BOOLEAN Continue = TRUE;
+    BOOLEAN Continue;
     RTL_QUERY_REGISTRY_TABLE QueryTable[2];
 
-    while (Continue)
+    do
     {
         RtlZeroMemory(QueryTable, sizeof(QueryTable));
         QueryTable[0].QueryRoutine = ScrubRegistryRoutine;
@@ -237,6 +237,7 @@ MountMgrScrubRegistry(IN PDEVICE_EXTENSION DeviceExtension)
                                         DeviceExtension,
                                         NULL);
     }
+    while (Continue);
 
     return Status;
 }
@@ -352,12 +353,12 @@ IsFtVolume(IN PUNICODE_STRING SymbolicName)
     /* FT volume can't be removable */
     if (FileDeviceObject->Characteristics & FILE_REMOVABLE_MEDIA)
     {
-        ObfDereferenceObject(DeviceObject);
-        ObfDereferenceObject(FileObject);
+        ObDereferenceObject(DeviceObject);
+        ObDereferenceObject(FileObject);
         return FALSE;
     }
 
-    ObfDereferenceObject(FileObject);
+    ObDereferenceObject(FileObject);
 
     /* Get partition information */
     KeInitializeEvent(&Event, NotificationEvent, FALSE);
@@ -372,18 +373,18 @@ IsFtVolume(IN PUNICODE_STRING SymbolicName)
                                         &IoStatusBlock);
     if (!Irp)
     {
-        ObfDereferenceObject(DeviceObject);
+        ObDereferenceObject(DeviceObject);
         return FALSE;
     }
 
-    Status = IofCallDriver(DeviceObject, Irp);
+    Status = IoCallDriver(DeviceObject, Irp);
     if (Status == STATUS_PENDING)
     {
         KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
         Status = IoStatusBlock.Status;
     }
 
-    ObfDereferenceObject(DeviceObject);
+    ObDereferenceObject(DeviceObject);
     if (!NT_SUCCESS(Status))
     {
         return FALSE;
@@ -513,7 +514,7 @@ MountMgrNextDriveLetterWorker(IN PDEVICE_EXTENSION DeviceExtension,
         if (IsDriveLetter(&(SymlinkInformation->Name)) && SymlinkInformation->Online)
         {
             DriveLetterInfo->DriveLetterWasAssigned = FALSE;
-            DriveLetterInfo->CurrentDriveLetter = SymlinkInformation->Name.Buffer[LETTER_POSITION];
+            DriveLetterInfo->CurrentDriveLetter = (CHAR)SymlinkInformation->Name.Buffer[LETTER_POSITION];
             break;
         }
 
@@ -972,8 +973,8 @@ MountMgrQueryPoints(IN PDEVICE_EXTENSION DeviceExtension,
     }
 
     /* We can't go beyond */
-    if (MountPoint->SymbolicLinkNameLength + MountPoint->UniqueIdLength +
-        MountPoint->DeviceNameLength < Stack->Parameters.DeviceIoControl.InputBufferLength)
+    if (((ULONG)MountPoint->SymbolicLinkNameLength + MountPoint->UniqueIdLength +
+        MountPoint->DeviceNameLength) < Stack->Parameters.DeviceIoControl.InputBufferLength)
     {
         return STATUS_INVALID_PARAMETER;
     }
@@ -1234,7 +1235,7 @@ MountMgrDeletePointsDbOnly(IN PDEVICE_EXTENSION DeviceExtension,
 NTSTATUS
 MountMgrVolumeMountPointChanged(IN PDEVICE_EXTENSION DeviceExtension,
                                 IN PIRP Irp,
-                                IN NTSTATUS LockStatus, 
+                                IN NTSTATUS LockStatus,
                                 OUT PUNICODE_STRING SourceDeviceName,
                                 OUT PUNICODE_STRING SourceSymbolicName,
                                 OUT PUNICODE_STRING TargetVolumeName)
@@ -1265,7 +1266,7 @@ MountMgrVolumeMountPointChanged(IN PDEVICE_EXTENSION DeviceExtension,
 
     VolumeMountPoint = (PMOUNTMGR_VOLUME_MOUNT_POINT)Irp->AssociatedIrp.SystemBuffer;
 
-    if (VolumeMountPoint->SourceVolumeNameLength + VolumeMountPoint->TargetVolumeNameLength <
+    if (((ULONG)VolumeMountPoint->SourceVolumeNameLength + VolumeMountPoint->TargetVolumeNameLength) <
         Stack->Parameters.DeviceIoControl.InputBufferLength)
     {
         return STATUS_INVALID_PARAMETER;
@@ -1406,7 +1407,7 @@ MountMgrVolumeMountPointChanged(IN PDEVICE_EXTENSION DeviceExtension,
 
     /* Return symbolic name */
     SourceSymbolicName->Length =
-    SourceSymbolicName->MaximumLength = FileNameInfo->FileNameLength;
+    SourceSymbolicName->MaximumLength = (USHORT)FileNameInfo->FileNameLength;
     SourceSymbolicName->Buffer = (PWSTR)FileNameInfo;
     /* memmove allows memory overlap */
     RtlMoveMemory(SourceSymbolicName->Buffer, FileNameInfo->FileName, SourceSymbolicName->Length);
@@ -1448,7 +1449,7 @@ Cleanup:
 
     if (FOReferenced)
     {
-        ObfDereferenceObject(FileObject);
+        ObDereferenceObject(FileObject);
     }
 
     return Status;
@@ -1495,6 +1496,7 @@ MountMgrDeviceControl(IN PDEVICE_OBJECT DeviceObject,
 
         case IOCTL_MOUNTMGR_DELETE_POINTS:
             Status = MountMgrDeletePoints(DeviceExtension, Irp);
+            break;
 
         case IOCTL_MOUNTMGR_QUERY_POINTS:
             Status = MountMgrQueryPoints(DeviceExtension, Irp);
@@ -1595,7 +1597,7 @@ MountMgrDeviceControl(IN PDEVICE_OBJECT DeviceObject,
 
 Complete:
     Irp->IoStatus.Status = Status;
-    IofCompleteRequest(Irp, IO_NO_INCREMENT);
+    IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
     return Status;
 }