Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTFSD
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


How to figure out boot drive during start-device

OSR_Community_UserOSR_Community_User Member Posts: 110,217
Hello,

I don't think this is an fsd question, but the ifs kit does have some
storage filter driver examples, so I thought I would try here. Please let
me know if this is not appropriate.

We are working on a storage filter driver that is an upper class filter for
the DiskDrive class. Our desire is to filter irps that correspond to the
physical disk that holds boot disk (C: presumably)

We're having difficulty detecting which drive is being initialized from our
Add device routines (this would be the best place since we could just not
attach to the stack if we're not interested in the device object that's
being added). Microsoft was unable to help at all with this issue...

We ended up having to wait until StartDevice and using
IOCTL_STORAGE_GET_DEVICE_NUMBER ioctl to figure out what the device number
and partition numbers are (we used code similar to the
DiskPerfRegisterDevice() code that creates an "NT like" device name). Then
we assumed (incorrectly we now know) that device 0 partition 0 would be the
C: drive.

This works great as long as there isn't a scsi boot device installed in the
system along with an ide disk device. When we boot from a scsi disk device
and have an ide disk device in the system as well, the ide device is
designated as device 0 partition 0 but assigned d: for the drive letter
(scsi is C:).

So our question is: how can we tell, either in AddDevice (preferably) or in
StartDevice, what device object represents the boot drive?

Thanks!!!!

Ron

Comments

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Just following up on the question I posted earlier. Basically we need to figure out how to tell if a Physical device object in the AddDevice or StartDevice handler is for the boot drive. It would also probably work if we could tell what drive letter is (or will be) assigned to the device object.

    Can anyone help???

    Thanks!

    Ron
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    In the deviceObject flags field there is a flag called
    DO_SYSTEM_BOOT_PARTITION. This flag will be set for the "BOOT" volume.
    This flag exists in NT4 and later, I don't know about releases before
    that.

    Note that the "boot" volume is the volume that contains "\winnt". This
    flag is not set for the "system" volume, which is the volume that
    contains "ntldr\boot.ini", unless they happen to be the same volume.

    Neal Christiansen


    -----Original Message-----
    From: [email protected]
    [mailto:[email protected]]
    Sent: Thursday, April 13, 2000 3:14 AM
    To: File Systems Developers
    Subject: [ntfsd] How to figure out boot drive during start-device


    Hello,

    I don't think this is an fsd question, but the ifs kit does have some
    storage filter driver examples, so I thought I would try here. Please
    let
    me know if this is not appropriate.

    We are working on a storage filter driver that is an upper class filter
    for
    the DiskDrive class. Our desire is to filter irps that correspond to
    the
    physical disk that holds boot disk (C: presumably)

    We're having difficulty detecting which drive is being initialized from
    our
    Add device routines (this would be the best place since we could just
    not
    attach to the stack if we're not interested in the device object that's
    being added). Microsoft was unable to help at all with this issue...

    We ended up having to wait until StartDevice and using
    IOCTL_STORAGE_GET_DEVICE_NUMBER ioctl to figure out what the device
    number
    and partition numbers are (we used code similar to the
    DiskPerfRegisterDevice() code that creates an "NT like" device name).
    Then
    we assumed (incorrectly we now know) that device 0 partition 0 would be
    the
    C: drive.

    This works great as long as there isn't a scsi boot device installed in
    the
    system along with an ide disk device. When we boot from a scsi disk
    device
    and have an ide disk device in the system as well, the ide device is
    designated as device 0 partition 0 but assigned d: for the drive letter
    (scsi is C:).

    So our question is: how can we tell, either in AddDevice (preferably) or
    in
    StartDevice, what device object represents the boot drive?

    Thanks!!!!

    Ron

    ---
    You are currently subscribed to ntfsd as: [email protected]
    To unsubscribe send a blank email to $subst('Email.Unsub')
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Internals & Software Drivers 25 Jan 2021 LIVE ONLINE
Developing Minifilters 8 March 2021 LIVE ONLINE