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/


What is the meaning of VPB->RealDevice and VPB->DeviceObject of the \\SystemRoot?

Brad_JohnsonBrad_Johnson Member Posts: 2

Hello everyone, i am not really familiar with this VPB structure in the FILE_OBJECT structure, i was reading some sample codes and saw a code use the RealDevice and DeviceObject of the Vpb structure of the \systemroot's FILE_OBJECT, these are my questions :

  1. What is the difference between the DeviceObject of the systemroot's file_object vs file_object->vpb->DeviceObject?
  2. What is the RealDevice, and why the named it "Real Device" ? as if the other device objects are fake or something?
  3. What are the use cases of using vpb->RealDevice and vpb->DeviceObject?

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,158
    edited November 1

    Read the docs.

    The VPB links a file system device instance to a volume device instance, because the basic PnP parent- child relationship doesn’t adequately handle this. The DeviceObject field of the VPB points to the Device Object for the file system. The RealDevice field points to the Device Object for Volume (disk). It how you can know “which file system is mounted on this device” and “which device is associated with this file system”... easy, right?

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • Brad_JohnsonBrad_Johnson Member Posts: 2

    @Peter_Viscarola_(OSR) said:
    Read the docs.

    The VPB links a file system device instance to a volume device instance, excuse the basic PnP parent- child relationship doesn’t adequately handle this. The DeviceObject field of the VPB points to the Device Object for the file system. The RealDevice field points to the Device Object for Volume (disk).

    Peter

    Thank you for taking the time to respond, one more question i forgot to ask :

    What is the difference between file_object->device_object->vpb vs file_object->vpb
    and between file_object->device_object->vpb->RealDevice vs file_object->vpb->RealDevice
    (both regarding the systemroot file_objects)

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,158

    What you’re asking, in essence, is “Which Device Object does the File Object point to?”

    The answer is: The Device Object to which the Create that instantiated the File Object was directed.

    And... keep in mind that for each I/O operation, the I/O Manager will start the Request with the Device Object at the top of the device stack (devnode) of the Device Object to which the File Object points.

    Spend some time in the debugger... you can see all this quite clearly.

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

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