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/


Device object and Driver object

vikrantwaje96vikrantwaje96 Member Posts: 3

I have recently started reading about windows driver development and WDF.
While reading, I came across function WdfDeviceCreate that creates PDO or Function DO in EvtDeviceAdd callback routine.
In most of the sample drivers(for eg. OSR Fx2 USB) that I have read, it looks like only one call to WdfDeviceCreate is done.
I have following question:
1. From my understanding we need both bus and filter device object for proper operation of driver, is that correct?
2. If both DO(bus and Function) are needed, why is only one call to WdfDeviceCreate function is done?
3. If only Function or Bus driver is needed at a time, how do we determine which object needs to be created(I am wondering about any example/use case)
4. By default, when we use WdfDeviceCreate function, will it create Bus DO or function DO?
5. When Framework wants to send requests to driver, will it send request to device object or driver object(from my understanding device object will receive request since they represent the driver object in WDF, is that correct?)
Sorry, if the questions are too basic. Any resource that can help me understand WDF is appreciated(currently using MSDN documentation only).

Comments

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,373
    edited September 17
    1. In the typical scenario, the bus driver already exists (PCI, USB, etc). The bus driver is the one that notices your hardware has arrived and creates a PDO, which causes PnP to go searching for your driver. Your function driver only creates the FDO to put on top of that.
    2. The typical driver is a function driver. In some cases, you may need to have additional driver layers above you. In that case, you create your own PDOs, and that automatically makes you a bus driver. The difference between bus driver and function driver is not as significant as you imply. It's not two completely separate types of driver. A bus driver is just a driver that creates PDOs.
    3. This distinction does not exist. Both bus drivers and function drivers create an FDO. If you create child devices, then you are a bus driver.
    4. Requests are always sent to a device object. If there are several of the same type of hardware in a computer, you will have many device objects but only one driver object. The driver object has the callbacks, so that's how the system finds the routines to call, but the request is aimed at a device object.

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

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

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 12 September 2022 Live, Online
Internals & Software Drivers 23 October 2022 Live, Online
Kernel Debugging 14 November 2022 Live, Online
Developing Minifilters 5 December 2022 Live, Online