IoReportTargetDeviceChangeAsynchronous Bluescreens with PNP_DETECTED_FATAL_ERROR

Hi all,

I wanted to communicate small piece of information (pid and ppid) through our file driver to an User mode application. Driver we use is a file system driver used to redirect file queries originating in our apps.

So I used sample code from MSDN which illustrates use of IoReportTargetDeviceChangeAsynchronous. Modified it to suit my needs and called It. I saw that system trapped with error:

d> !analyze -v
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************

PNP_DETECTED_FATAL_ERROR (ca)
PnP encountered a severe error, either as a result of a problem in a driver or
a problem in PnP itself. The first argument describes the nature of the
problem, the second argument is the address of the PDO. The other arguments
vary depending on argument 1.
Arguments:
Arg1: 00000002, Invalid PDO
An API which requires a PDO has been called with either an FDO,
a PDO which hasn’t been initialized yet (returned to PnP in a
QueryDeviceRelation/BusRelations), or some random piece of
memory.
Arg2: 85bf2bd8, Purported PDO.
Arg3: 00000000, Driver object.
Arg4: 00000000

Before call was made I verified that correct value is being passed (it is not null or some random memory)

Now documentation says that to PDO must be initialized. I checked some MSDN docs and seems that to call this method ,device driver must be PnP. Is it true? Also if this method cannot be called from non-PnP drivers, is there a way in which my driver can queue messages and user mode application can deqeueue them? Thanks in advance for your replies. I am new to drivers and need this information urgently.

If you are a non-pnp driver then how exactly do you have a PDO that
you can pass to this call?

The bugcheck is pretty clear: you are not passing in a valid PDO.
Calling this interface from a non-pnp driver for a non-pnp device
object makes no sense at all.

Mark Roddy

On Fri, Feb 18, 2011 at 8:08 AM, wrote:
> Hi all,
>
> I wanted to communicate small piece of information (pid and ppid) through our file driver to an ?User mode application. Driver we use is a file system driver used to redirect file queries originating in our apps.
>
> So I used sample code from MSDN which illustrates use of IoReportTargetDeviceChangeAsynchronous. Modified it to suit my needs and called It. I saw that system trapped with error:
>
>
> d> !analyze -v
> *
> * ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
> * ? ? ? ? ? ? ? ? ? ? ? ?Bugcheck Analysis ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

> * ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
>

>
> PNP_DETECTED_FATAL_ERROR (ca)
> PnP encountered a severe error, either as a result of a problem in a driver or
> a problem in PnP itself. ?The first argument describes the nature of the
> problem, the second argument is the address of the PDO. ?The other arguments
> vary depending on argument 1.
> Arguments:
> Arg1: 00000002, Invalid PDO
> ? ? ? ?An API which requires a PDO has been called with either an FDO,
> ? ? ? ?a PDO which hasn’t been initialized yet (returned to PnP in a
> ? ? ? ?QueryDeviceRelation/BusRelations), or some random piece of
> ? ? ? ?memory.
> Arg2: 85bf2bd8, Purported PDO.
> Arg3: 00000000, Driver object.
> Arg4: 00000000
>
> Before call was made I verified that correct value is being passed (it is not null or some random memory)
>
> Now documentation says that to PDO must be initialized. ?I checked some MSDN docs and seems that to call this method ,device driver must be PnP. Is it true? Also if this method cannot be called from non-PnP drivers, is there a way in which my driver can queue messages and user mode application can deqeueue them? Thanks in advance for your replies. I am new to drivers and need this information urgently.
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

Oh, and the way you queue ‘messages’ is you put them on an internal
queue for your non pnp device object, a queue you create in your
device extension, and your applications send your own customs IOCTLs
to your device object to fetch queued ‘messages’.

Mark Roddy

On Fri, Feb 18, 2011 at 10:10 AM, Mark Roddy wrote:
> If you are a non-pnp driver then how exactly do you have a PDO that
> you can pass to this call?
>
> The bugcheck is pretty clear: you are not passing in a valid PDO.
> Calling this interface from a non-pnp driver for a non-pnp device
> object makes no sense at all.
>
> Mark Roddy
>
>
>
> On Fri, Feb 18, 2011 at 8:08 AM, ? wrote:
>> Hi all,
>>
>> I wanted to communicate small piece of information (pid and ppid) through our file driver to an ?User mode application. Driver we use is a file system driver used to redirect file queries originating in our apps.
>>
>> So I used sample code from MSDN which illustrates use of IoReportTargetDeviceChangeAsynchronous. Modified it to suit my needs and called It. I saw that system trapped with error:
>>
>>
>> d> !analyze -v
>> *
>> * ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
>> * ? ? ? ? ? ? ? ? ? ? ? ?Bugcheck Analysis ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

>> * ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
>>

>>
>> PNP_DETECTED_FATAL_ERROR (ca)
>> PnP encountered a severe error, either as a result of a problem in a driver or
>> a problem in PnP itself. ?The first argument describes the nature of the
>> problem, the second argument is the address of the PDO. ?The other arguments
>> vary depending on argument 1.
>> Arguments:
>> Arg1: 00000002, Invalid PDO
>> ? ? ? ?An API which requires a PDO has been called with either an FDO,
>> ? ? ? ?a PDO which hasn’t been initialized yet (returned to PnP in a
>> ? ? ? ?QueryDeviceRelation/BusRelations), or some random piece of
>> ? ? ? ?memory.
>> Arg2: 85bf2bd8, Purported PDO.
>> Arg3: 00000000, Driver object.
>> Arg4: 00000000
>>
>> Before call was made I verified that correct value is being passed (it is not null or some random memory)
>>
>> Now documentation says that to PDO must be initialized. ?I checked some MSDN docs and seems that to call this method ,device driver must be PnP. Is it true? Also if this method cannot be called from non-PnP drivers, is there a way in which my driver can queue messages and user mode application can deqeueue them? Thanks in advance for your replies. I am new to drivers and need this information urgently.
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>>
>

Well PDO was initialized somewhere else. So what if I have a PDO? Does that mean driver is PnP?

You should know if your driver is a PnP driver or not. Perhaps you
should describe your driver rather than making us guess what it is and
what it is up to.

Where did you get this alleged PDO from? How do you know it is
initialized? The bugcheck is very clear: 85bf2bd8 is either not a PDO
at all or is not an initialized PDO.
From the dumpfile:
What is the output from windbg !devobj 85bf2bd8 ?
What is the output from windbg !devstack 85bf2bd8 ?

Mark Roddy

On Fri, Feb 18, 2011 at 10:50 AM, wrote:
> Well PDO was initialized somewhere else. So what if I have a PDO? Does that mean driver is PnP?
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

Here is the information dump.

kd> !devobj 85bf2bd8
Device object (85bf2bd8) is for:
\FileSystem\CtxSbx DriverObject 85bf2950
Current Irp 00000000 RefCount 2 Type 00000008 Flags 00000040
Dacl 887ae884 DevExt 00000000 DevObjExt 85bf2c90
ExtensionFlags (0x00000800)
Unknown flags 0x00000800
Device queue is not busy.

kd> !devstack 85bf2bd8
!DevObj !DrvObj !DevExt ObjectName

85bf2bd8 \FileSystem\CtxSbx 00000000

kd> !podev 85bf2bd8
Device object is for:
DriverObject 85bf2950
Current Irp 00000000 RefCount 0 Type 00000002 DevFlags 00000040
Device queue is not busy.
Device Object Extension: 85bf2c90:
PowerFlags: 00000000 =>SystemState=0 DeviceState=0
Dope: 00000000:

Yeah - so that is not a PDO. What are you trying to do again?

Mark Roddy

On Fri, Feb 18, 2011 at 7:59 PM, wrote:
> Here is the information dump.
>
> kd> !devobj 85bf2bd8
> Device object (85bf2bd8) is for:
> ?\FileSystem\CtxSbx DriverObject 85bf2950
> Current Irp 00000000 RefCount 2 Type 00000008 Flags 00000040
> Dacl 887ae884 DevExt 00000000 DevObjExt 85bf2c90
> ExtensionFlags (0x00000800)
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? Unknown flags 0x00000800
> Device queue is not busy.
>
> kd> !devstack 85bf2bd8
> ?!DevObj ? !DrvObj ? ? ? ? ? ?!DevExt ? ObjectName
>> 85bf2bd8 ?\FileSystem\CtxSbx 00000000
>
> kd> !podev 85bf2bd8
> Device object is for:
> ?DriverObject 85bf2950
> Current Irp 00000000 RefCount 0 Type 00000002 DevFlags 00000040
> Device queue is not busy.
> Device Object Extension: 85bf2c90:
> PowerFlags: 00000000 =>SystemState=0 DeviceState=0
> Dope: 00000000:
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>