A Hole In My Head

Doron Holan's musings on drivers and other nibbles and bits

Browse by Tags

Tagged Content List
  • Blog Post: Developing Drivers with the Windows® Driver Foundation, i.e. the WDF book, is apparently out of print

    Looks like the going price on Amazon is >$250 :(. The good news is that you can still get the book as an e-book at O'Reilly, http://oreilly.com/catalog/9780735623743/ , or at Safari, for around $50. Not as convenient as a hard copy IMHO, but it is better than nothing or spending $250.
  • Blog Post: WDFREQUESTs are for sharing in KMDF v1.9

    In my last post I described why a WDFREQUEST is unique to a particular WDFDEVICE.  There is one particular programming pattern where this is not the behavior you want.  This pattern is when you have each PDO accepting IO requests which it then forwards on to the parent WDFDEVICE for processing...
  • Blog Post: WDFREQUESTs are not for sharing

    FYI: this is a bit of a long post, but I wanted to be thorough and illustrative and give some insight into how the framework works and potential design that could have been made, but were not for the sake of simplicity and performance A common misconception a WDFREQUEST handle is the assumption that...
  • Blog Post: How do I cancel an IRP that another thread may be completing at the same time?

    Let's say that you allocated a PIRP and sent it down your device stack. You free the PIRP in the completion routine and then return STATUS_MORE_PROCESSING_REQUIRED. To make life more fun, you decide that you want to be able to cancel the sent IRP after you have sent it so you try to do it simple like...
  • Blog Post: EvtDevicePreprocessWdmIrp is not entirely free

    One of the WDM escapes in KMDF is EvtDeviceWdmIrpPreprocess (or EvtDevicePreprocessWdmIrp in the API in which you register it) which you can register for by calling WdfDeviceInitAssignWdmIrpPreprocessCallback .  This function allows you to process a WDM PIRP before KMDF sees it and potentially processes...
  • Blog Post: How to share HW resources with another driver not in the same PnP hierarchy

    First, I have to say that I don't agree with this design pattern at all . I think it leads to too many problems and complications that are not worth the pain. The only reason I am writing this entry is that I have seen so many people get this wrong or not account for some details and I want to make sure...
  • Blog Post: WdfDeviceRetrieveDeviceInterfaceString and PDOs

    When you initially create a PDO, it takes a few steps for PnP to recognize it. I wrote this problem of determining when a PDO becomes a PDO last year . At the end of the post I mentioned that KMDF handles all of this state management for you underneath the covers. This works for 99% of the client drivers...
  • Blog Post: Setting a security descriptor on a legacy device object

    Setting the security descriptor allows you to control who can open a handle to the device object. Typically you can call IoCreateDeviceSecure to create the device object and have the correct DACL from the start. One issue with IoCreateDeviceSecure is that the SDDL string is limited to what it can describe...
  • Blog Post: Having two names is not necessarily better than one, part 2

    Previously I wrote about what happens when there are 2 devices in a stack with a name and all of the associated issues that arise from it. In that vein I want to write about what happens when you give your device object a name in KMDF and compare it to WDM. In a WDM driver, if you specify a name for...
  • Blog Post: Problems with not having a current IRP stack location, part 2

    This problem falls into the category being hidden by a macro that does not indicate in its name what it touches. If you call IoMarkIrpPending on an IRP that you allocated in your driver, chances are that you are corrupting memory. First, let's look at the implementation of this function (from wdm.h)...
  • Blog Post: Filtering HID collections and setting I/O flags

    Over the past 3 years or so, I have been casually referring to KMDF as the ultimate driver compat layer. Just like Windows has an application compatibility layer which shields applications from OS changes, KMDF provides the same type of compatibility across device stacks. For the most part each stack...
  • Blog Post: Supporting query interface in KMDF

    In my last post I talked about bidirectional interfaces which can have both input and output parameters. KMDF supports both unidirectional and bidirectional interfaces. As is the case with many KMDF APIs and behaviors, we allow you to implement the easy pattern with little to no work and let you opt...
  • Blog Post: Power relationships in a bus driver

    A small but important rule in WDM is that while a PDO is in D0, the parent must be in D0 as well. A very simple statement that can cause a lot of trouble ;). What I have seen is that very few WDM drivers enforce this rule (while KMDF does implement this rule, so all KMDF drivers inherit this for free...
  • Blog Post: Problems associated with arming yourself for wake

    Hindsite in this case is 20/20, but arming your device for wake can open yourself up to multitude of race conditions and hard problems. Some of them you can solve in your driver, some of them you must accept that they are there and leave them be. Arming yourself for wake can be broken down into 2 scenarios...
  • Blog Post: I can't imagine how much work it would be to actually /write/ a book

    All I can say is that it is a ton of work to review one. We just finished all of the reviews for the WDF book and man was it alot of work! We have an awesome set of writers, I really don't know how they managed it all. From creating the content, taking a ton of feedback and edits from a large number...
  • Blog Post: Which PnP and power IRPs are synchronized against each other?

    In my previous post , I talked about how state changing PnP IRPs (refered to from now own as just PnP IRPs) are serialized against each other and briefly mentioned which power IRPs they were synchronized against. This merits its own entry. In short, PnP IRPs are only synchronized against system power...
  • Blog Post: How does WdfDeviceSetFailed work? (AKA the case of the missing WDK documentation for REENUMERATE_SELF_INTERFACE_STANDARD)

    KMDF is built on top of public interfaces. This means that it uses only APIs found in the WDK (or what was the DDK). This creates a dilemma. On the one hand we want to add features to the framework that are compelling and add value, but on the other we cannot rely on the OS to provide this functionality...
  • Blog Post: Concise and easy to use parameter types in KMDF

    One of the goals of KMDF was to use clear and concise types in our parameters and structures so that their intended use was clear and there was a safe way to use them. Some of them were obvious to us at the start, others were suggested to us by our beta testers and outside community as better alternatives...
  • Blog Post: Where are the WDF files in the WDK?

    The WDF (both UMDF and KMDF) files in the WDK are not found in a single directory, rather they are spread out across the entire WDK directory tree. Why? Because the WDK is not just WDF J and the WDK has directories for different purposes, so replicating a specifically purposed directory (like redistributables...
  • Blog Post: Should I use the chk or fre KMDF coinstaller?

    This has been asked quite a few times and is a major point of confusion for KMDF developers. The KMDF coinstaller comes in 2 flavors, chk and fre. Both flavors reside in the same directory in the WDK (winddk\6000\redist\wdf\<arch>) and have their own unique filenames (fre is WdfCoInstaller01005...
  • Blog Post: How to return the number of bytes required for a subsequent operation

    A very common pattern is to allow a caller to ask for the number bytes (or elements) required and then ask for the data, many user mode Win32 APIs (like RegQueryValueEx ) and kernel mode (like IoGetDeviceProperty ) implement it. You first ask for the number of bytes needed (passing NULL and a pointer...
  • Blog Post: Have you been waiting for a book on WDF?

    Well wait no more! We (the technical writers on WHDC and the WDF team) is working on a book and it was just announced (the description is currently a little wonky though). The book will cover both KMDF and UMDF and the static analysis tools (SDV and PreFAST for Drivers). Hope you will like it, we are...
  • Blog Post: Hindsight is 20/20, EvtDriverUnload should have not been in KMDF

    The KMDF model evolved over the entire development cycle. It was refined and refactored multiple times. A lot of WDM abstractions leak through the to the KMDF model. These leaks usually forced their way into the model because without them, KMDF cannot function properly. Other abstraction leaks were just...
  • Blog Post: WDM to KMDF porting guide now available on WHDC

    We have been working on this one for the last couple of weeks. There is now a WDM to KMDF porting guide on WHDC. There are 2 documents in the download. The first is a very in depth document which goes into great detail about each function, IRP major code, etc that you need to port over. The second is...
  • Blog Post: How do I debug a failed device install or disable?

    Debugging a failed device install or disable can be tough. The error could be hidden in the depths of the system and it might take awhile to figure it out. The error code on the device might be of some help, but it is not always clear. For instance, you might get a code 10 for a failed start which means...
Page 1 of 2 (42 items) 12