Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-15550

[MOUNTMGR] QueryDeviceInformation() - may return incorrect Status

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 0.4.12
    • Drivers: Other
    • None

    Description

      If HasGuid are specified and IoCallDriver(IOCTL_MOUNTDEV_QUERY_STABLE_GUID) returns an error, it will be returned to the caller by QueryDeviceInformation().

      ...
      ...
          /* If user wants to know about GUID */
          if (HasGuid)
          {
              /* Query device stable GUID */
              KeInitializeEvent(&Event, NotificationEvent, FALSE);
              Irp = IoBuildDeviceIoControlRequest(IOCTL_MOUNTDEV_QUERY_STABLE_GUID,
                                                  DeviceObject,
                                                  NULL,
                                                  0,
                                                  StableGuid,
                                                  sizeof(GUID),
                                                  FALSE,
                                                  &Event,
                                                  &IoStatusBlock);
              if (!Irp)
              {
                  ObDereferenceObject(DeviceObject);
                  ObDereferenceObject(FileObject);
                  return STATUS_INSUFFICIENT_RESOURCES;
              }
       
              Stack = IoGetNextIrpStackLocation(Irp);
              Stack->FileObject = FileObject;
       
              Status = IoCallDriver(DeviceObject, Irp);
              if (Status == STATUS_PENDING)
              {
                  KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
                  Status = IoStatusBlock.Status;
              }
       
              *HasGuid = NT_SUCCESS(Status);
          }
       
          ObDereferenceObject(DeviceObject);
          ObDereferenceObject(FileObject);
          return Status;
      }
      

      .
      Returned Status should not depend on this request.

      ...
      ...
          /* If user wants to know about GUID */
          if (HasGuid)
          {
              NTSTATUS status;
       
              /* Query device stable GUID */
              KeInitializeEvent(&Event, NotificationEvent, FALSE);
              Irp = IoBuildDeviceIoControlRequest(IOCTL_MOUNTDEV_QUERY_STABLE_GUID,
                                                  DeviceObject,
                                                  NULL,
                                                  0,
                                                  StableGuid,
                                                  sizeof(GUID),
                                                  FALSE,
                                                  &Event,
                                                  &IoStatusBlock);
              if (!Irp)
              {
                  ObDereferenceObject(DeviceObject);
                  ObDereferenceObject(FileObject);
                  return STATUS_INSUFFICIENT_RESOURCES;
              }
       
              Stack = IoGetNextIrpStackLocation(Irp);
              Stack->FileObject = FileObject;
       
              status = IoCallDriver(DeviceObject, Irp);
              if (status == STATUS_PENDING)
              {
                  KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
                  status = IoStatusBlock.Status;
              }
       
              *HasGuid = NT_SUCCESS(status);
          }
       
          ObDereferenceObject(DeviceObject);
          ObDereferenceObject(FileObject);
          return Status;
      }
      

      Attachments

        Activity

          People

            Heis Spiter Pierre Schweitzer
            vgal vgal
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: