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

[MOUNTMGR] QueryDeviceInformation() - may return incorrect Status

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Fix Version/s: 0.4.12
    • Component/s: Drivers: Other
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: