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

Home NTDEV
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/


Help with KMDF Disk Filter Driver - BSOD after install

andrewDrvandrewDrv Member Posts: 6

Hello everyone,
I'm trying to realize a simple KMDF Disk Filter Driver that "logs" all the write operations in a sector bitmap, but I'm having troubles in installing and testing it.
I started from the KMDF sample in this article:
http://www.osronline.com/article.cfm?article=446

My code is the same as the article above, I've just excluded the user mode code (buffers to comunicate to user mode apps, etc.) and kept just WdfFltrRead function in the queue (no write, no devicecontrol events) to test if driver works and then proceed with my develop.
Then, I copied the .inf file from the DiskPerf example and adapted to my situation and installed the driver inside my test Hyper-V vm. The result was just a blue screen with the error INACCESSIBLE_BOOT_DEVICE.

Can someone help me to understand how to install correctly the driver and also if there are some parts in the code that I have to change in order to adapt the code to my situation?

Thank you to all in advance that will help me.
Best regards.

Andrew

Comments

  • andrewDrvandrewDrv Member Posts: 6

    Please can someone help me? I keep getting INACCESSIBLE_BOOT_DEVICE after every attempt of installing a disk driver.

  • Scott_Noone_(OSR)Scott_Noone_(OSR) Administrator Posts: 3,336

    (I deleted your other post because it's not helpful to post the same question multiple times)

    Which version of Windows? Is your driver properly signed?

    -scott
    OSR

  • Michael_GrabelkovskyMichael_Grabelkovsky Member Posts: 29
    1. In all cases, this question is better place inside NTFSD group.
    2. The article that you took from 2006. Probably better to start from same DDK example?
  • andrewDrvandrewDrv Member Posts: 6
    edited March 2019

    @Michael_Grabelkovsky said:
    1. In all cases, this question is better place inside NTFSD group.
    2. The article that you took from 2006. Probably better to start from same DDK example?

    Hello Michael, I posted inside the NTDEV section as I'm not developing a file system driver, but a disk filter driver.
    I already managed to realize a fs minifilter, but I need a driver that stay at the level of the disks and register all I/O operations at the level of blocks (or sectors).
    I know, the article is quite old but was then updated, and I'm following many examples, tutorial, but all of them at the end have problems when attaching to the boot disk (including DiskPerf example provided by Microsoft).

    @andrewDrv said:
    Please can someone help me? I keep getting INACCESSIBLE_BOOT_DEVICE after every attempt of installing a disk driver.

    Hi Scott, the other post was a similar question, but not the same.. anyway, the problem is connected.
    The disk driver is properly signed but I'm running Windows 10 in test mode, so no signature problems.

    The problem is that, as I told in the other post, the driver makes the boot disk inaccessible on Windows boot and infact there are no problems if I install (attach) the driver to a data disk (I mean, not the boot disk).
    I've read that the INACCESSIBLE_BOOT_DEVICE error code can be given when the driver creates a "delay" in the boot of Windows.. so if this is the problem.. how can I avoid it?

    Thanks in advance to all of you for your help.

  • Mark_RoddyMark_Roddy Member - All Emails Posts: 4,364
    via Email
    Your filter is not available at boot. Thus the dreaded 7B.

    Mark Roddy
  • andrewDrvandrewDrv Member Posts: 6

    @Mark_Roddy said:
    Your filter is not available at boot. Thus the dreaded 7B.

    Mark Roddy

    What does it mean? How can I make it available at boot? Can it be something wrong during the installation or something inside the driver code?

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,578
    via Email
    andrewDrv wrote:
    > @Mark_Roddy said:
    >> Your filter is not available at boot. Thus the dreaded 7B.
    > What does it mean? How can I make it available at boot? Can it be something wrong during the installation or something inside the driver code?

    How did you install your driver, exactly?  Remember, it's not enough
    just to specify a file system path.  At the time your driver needs to
    load, there ARE no disks.  There are no file systems.  "C:" means nothing.

    Is KMDF even possible in a boot-disk filter driver?

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Mark_RoddyMark_Roddy Member - All Emails Posts: 4,364
    via Email
    It is as long as all the components are present.

    Mark Roddy
  • Scott_Noone_(OSR)Scott_Noone_(OSR) Administrator Posts: 3,336

    Enable boot debugging and see if your DriverEntry is being called::

    bcdedit /bootdebug on
    

    -scott
    OSR

  • andrewDrvandrewDrv Member Posts: 6
    edited March 2019

    @Tim_Roberts said:
    How did you install your driver, exactly?  Remember, it's not enough
    just to specify a file system path.  At the time your driver needs to
    load, there ARE no disks.  There are no file systems.  "C:" means nothing.
    Is KMDF even possible in a boot-disk filter driver?

    I used the "default" installation by installing the driver as a kernel service (sc command) and then used the "AddFilter" exe (taken from the AddFilter project) to install driver as a filter on disk devices.
    About the KMDF being possible on the boot disk, I know that it should be (if not, Microsoft probably would have warned about that on some documentation). Furthermore, I get the same error (INACCESSIBLE_BOOT_DEVICE) also on DiskPerf example that is a WDM driver.. so I don't thinks that KMDF is the problem.

    @Mark_Roddy said:
    It is as long as all the components are present.

    So you think that probably there are some components missing? How can I know it? I will try to debug boot (as suggested by Scott below) to see if the driver at least passes through its entry function or blocks before being called.

    @Scott_Noone_(OSR) said:
    Enable boot debugging and see if your DriverEntry is being called::
    bcdedit /bootdebug on

    Thanks for the suggestion Scott, I enabled boot mode but I didn't think about debug boot.. I will try and let you know.

  • andrewDrvandrewDrv Member Posts: 6

    Hello, finally to install my KMDF correctly without getting any boot error. Just installed the driver as kernel driver with "sc create" and specified boot start, then used "AddFilter" to add it as upper filter (as I have to handle I/O operations, if you need to handle SCSI operations, install it as lower filter).

  • Ramakrishna_SaripalliRamakrishna_Saripalli Member Posts: 60

    Hi, I have a WDM lower filter disk driver that I am trying to convert to KMDF. I am having heck of a time creating the INF file that works. The WDM driver works great.

    I see great parallels between what you are doing with the upper filter and mine with the lower filter.
    Can you echo your commands on how you used sc create and the AddFilter?. I see the AddFilter code does have support to add as lower filter but I am not sure how to use it to add a lower filter disk driver.

    Thanks,
    RK

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!
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 15 Jun 2020 LIVE ONLINE
Writing WDF Drivers 22 June 2020 LIVE ONLINE
Internals & Software Drivers 28 Sept 2020 Dulles, VA