Search code examples
windowsdevice-driver

What does Windows mean by a device that is "on the device path for a special file (such as the paging file, hibernate file, or crash dump file)"?


I noticed if you are processing an IRP_MN_QUERY_DEVICE_RELATIONS with a PowerRelations type and you add a power relation you are supposed to then send IRP_MN_DEVICE_USAGE_NOTIFICATION IRPs your device receives to the target device

If the target device is on the device path for a special file (such as the paging file, hibernate file, or crash dump file)...

I have not seen that wording before and have not had much luck googling it. Following the link for IRP_MN_DEVICE_USAGE_NOTIFICATION it explains a bit more but not much details on what it actually is to have a special file attached to your device.

System components send this IRP to ask the drivers for a device whether the device can support a special file. Special files include paging files, dump files, and hibernation files. If all the drivers for the device succeed the IRP, the system creates the special file.

What does it mean to be on the device path for a special file and what sorts of devices typically are?


Solution

  • Disclaimer: I'm not familiar with the control code in question.

    However, the meaning of the documentation seems clear enough.

    Consider the paging file, for example, which is typically C:\pagefile.sys. From the kernel's point of view, that's

    \Device\HarddiskVolume1\pagefile.sys
    

    Which makes Device\HarddiskVolume1 a device that is "on the device path to a special file". Reading the documentation, the rules in question also apply to any other device that this device depends upon.

    In practical terms, you only need to worry about this if you're a storage device of some kind, or a bus device that supports storage devices. If this applies to you, and if you support special files (i.e., return success when you receive IRP_MN_DEVICE_USAGE_NOTIFICATION with InPath set to TRUE) and if you have a non-trivial power dependency on another device, then you have to forward the IRP as described.

    If you don't need to support special files, you can just fail the call. There's probably no need to support special files on a removable media device, for example, so USB controllers, hubs, etc., probably don't support them. But a RAID controller probably does need to support special files, at least if you want to be able to install Windows on the RAID disk.