removable drive type versus local drive type

Discussion in 'Windows Vista Drivers' started by oregonduckman, Oct 10, 2006.

  1. I am looking for information on how Windows handles removable drives versus
    local drives at the driver level. For example, it seems that a polling
    mechanism exists for removable drives that can effect performance that does
    not exist on local drive types. I am trying to determine the differences
    between the two drive types from the Windows point of view.
     
    oregonduckman, Oct 10, 2006
    #1
    1. Advertisements

  2. oregonduckman

    soviet_bloke Guest

    Hi mate

    First, Windows does not support multiple partitions on removable media.
    Second, Ftdisk.sys enumerates only partitions on basic disks, so that
    Windows does not mount logical volumes on the partitions that reside on
    removable media. This is the short story.

    The long story is that removable USB media can be easily presented as a
    basic disk to the system, so that you can have multiple partitions and
    logical volumes on it. In actuality, Windows does not know the
    difference between fixed and removable media, so that everything
    depends on how the target device handles IOCTL_STORAGE_QUERY_PROPERTY
    request. If it sets 'RemovableMedia' bit in STORAGE_DEVICE_DESCRIPTOR
    structure that it returns in response to this request to FALSE, the
    keychain is treated as a fixed disk. This request is nothing more than
    just a formality - in all respects fixed and removable media behave the
    same way, so that you can easily present removable media as fixed one
    to the system



    Anton Bassov
     
    soviet_bloke, Oct 10, 2006
    #2
    1. Advertisements

  3. oregonduckman

    440gtx Guest

    Another difference is a completely blank removable disk is very easy to
    format--Windows will prompt you to format it when you attempt to access
    it the first time. A non-removable disk cannot be formatted from
    explorer and requires you locate the disk administrator (which is not
    easy and is it even available for limited users?) and go through a
    bunch of steps. The ease of use between the two couldn't be further
    apart and it is not apparent to me why this decision was made.
     
    440gtx, Oct 11, 2006
    #3
  4. TEST UNIT READY polling is used, since the drives have no other means of
    notifying the OS about user pressed Eject on the drive and replaced the media.
    This is very much performance cheap - 5 times per second or so.

    Also, the removable media drives can only have 1 partition. If MBR is
    present - this is the 1st MBR's partition. Otherwise, this is the whole media.

    Removable media drives assign the drive letter and MountMgr's GUID to this
    partition device object, which is always 1 per drive.

    How OS determines whether the media is removable or not? By flags in SCSI
    INQUIRY data.
     
    Maxim S. Shatskih, Oct 11, 2006
    #4
  5. First, Windows does not support multiple partitions on removable media.
    FtDisk is out of picture at all for removable media, so is PartMgr.
    ( DeviceObject->Characteristics & FILE_REMOVABLE_MEDIA ) is also used, and this
    Characteristics bit is set based on INQUIRY data.
    ....except the MBR interpretation on fixed and removable media.
     
    Maxim S. Shatskih, Oct 11, 2006
    #5
  6. it the first time. A non-removable disk cannot be formatted from
    Fill a fixed disk volume with junk, and Explorer will suggest you to format it
    :)
     
    Maxim S. Shatskih, Oct 11, 2006
    #6
  7. oregonduckman

    soviet_bloke Guest

    Maxim,

    ABSOLUTELY(!!!) all features that you have mentioned are secondary, and
    depend solely on how IOCTL_STORAGE_QUERY_PROPERTY was handled. As we
    have already discussed, by modifying the return results of this request
    you can present removable media as a fixed one, so that you will be
    able to have multiple partitions and mount basic volumes on it (i.e.
    bring Ftdisk.sys and MountMgr.sys into play)

    Anton Bassov
     
    soviet_bloke, Oct 12, 2006
    #7
  8. ABSOLUTELY(!!!) all features that you have mentioned are secondary, and
    Oh yes. SCSI INQUIRY is secondary, and IOCTL_STORAGE_QUERY_PROPERTY is primary.
    Nonsense.

    SCSI INQUIRY is a primary (often hardware-level - it goes via USB/1394/SCSI or
    even IDE wire - the IDE wire is for ATAPI devices case, like CD/DVD drives)
    mean of the software to get the device info.

    The response to IOCTL_STORAGE_QUERY_PROPERTY is built based on INQUIRY and some
    MODE SENSE (Vital Product Data etc) responses.
     
    Maxim S. Shatskih, Oct 12, 2006
    #8
  9. oregonduckman

    soviet_bloke Guest

    Maxim,

    Sorry - I just overlooked the fact that you have mentioned SCSI
    INQUIRY(my omission, I admit). Unlike possibility of having multiple
    partitions and basic volumes, as well as flags in device
    characteristics and MBR, this is *DEFINITELY* not among secondary
    things. As you have properly pointed out, SCSI INQUIRY is primary even
    for IOCTL_STORAGE_QUERY_PROPERTY request.


    However, when it comes to really secondary things like multiple
    partitions and basic volumes
    ( ironically, they are of actual importance to the user, unlike
    queries), the system's behaviour depends solely on
    IOCTL_STORAGE_QUERY_PROPERTY request. In other words, no double-checks
    are made - this is why I said that, as far as the system is concerned,
    there is no difference
    between basic and removable USB disk whatsoever, so that you can
    present them to the system the way you wish

    Anton Bassov
     
    soviet_bloke, Oct 12, 2006
    #9
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.