Sometimes as a bus driver you need to access the PDO's Device Parameters key of its device node (to set a value for a class installer for instance) or register a device interface for a raw PDO. These are actually instances of a bigger problem, when is the PDO actually recognized as a PDO by the PnP manager? There are quite a few APIs that only accept a PDO and will bugcheck if you don't pass a PDO. Some of these DDIS are (not definitive by any means)

  • IoRegisterDeviceInterface
  • IoWMISuggestInstanceName
  • IoInvalidateDeviceState
  • IoReportTargetDeviceChange
  • IoRequestDeviceEject

The DDK is silent on this issue so you are left to guess. Left to your own devices (no pun intended ;) ), you could guess that by the time IRP_MN_START_DEVICE arrives in your device's pnp dispatch routine, you know your PDO has been recognized...but that is usually way too late (and if it is not too late, then use this minor code as your solution). The very first point in time after successfully calling IoCreateDevice() that your reported PDO is actually a PDO is when you recieve a IRP_MN_QUERY_RESOURCE_REQUIREMENTS. KMDF uses this to track the "recognized" state of the PDO and it has been confirmed by the PnP team (and supposedly there is a KB article out there somewhere) that this is the first minor code sent to a recognized PDO.