My Pnp routine is not called

Hello,

For some reason, my Pnp routine isn’t called when I disable the device or
update the driver. Am I missing something?

This is the prototype…

NTSTATUS DispatchPnp( IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp )

And this is what I have in my DriverEntry routine…

DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
DriverObject->DriverExtension->AddDevice = ClassAddDevice;

AddDevice routine works fine…

Thank you,

Hi Mishka,

Do check whether your are clearing the flag of the device object you
create in AddDevice routine.

NewDeviceObject->Flags &= ~ DO_DEVICE_INITIALIZING;

-------- Check DDK for DEVICE_OBJECT help -----------------
It follows this …
DO_DEVICE_INITIALIZING The I/O Manager sets this flag when it creates
the device object.
A device function or filter driver clears the flag in its AddDevice
routine, after attaching the device object to the device stack, establishing
the device power state, and ORing the field with one of the power flags (if
necessary). The PnP Manager checks that the flag is clear after return from
AddDevice.


If this is not done, then there is the reason for your problem.

Cheers,

  • Jay

----- Original Message -----
From: “Mishka Iakouchev”
To: “NT Developers Interest List”
Sent: Sunday, June 16, 2002 9:15 AM
Subject: [ntdev] My Pnp routine is not called

> Hello,
>
> For some reason, my Pnp routine isn’t called when I disable the device or
> update the driver. Am I missing something?
>
> This is the prototype…
>
> NTSTATUS DispatchPnp( IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp )
>
> And this is what I have in my DriverEntry routine…
>
> DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
> DriverObject->DriverExtension->AddDevice = ClassAddDevice;
>
> AddDevice routine works fine…
>
> Thank you,
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@vsnl.net
> To unsubscribe send a blank email to %%email.unsub%%

Pnp routine?? Do you mean start or remove? If remove, are you waiting on a
remove event perhaps, that is not getting signalled?


Bill McKenzie

“Mishka Iakouchev” wrote in message
news:xxxxx@ntdev…
>
> Hello,
>
> For some reason, my Pnp routine isn’t called when I disable the device or
> update the driver. Am I missing something?
>
> This is the prototype…
>
> NTSTATUS DispatchPnp( IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp )
>
> And this is what I have in my DriverEntry routine…
>
> DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
> DriverObject->DriverExtension->AddDevice = ClassAddDevice;
>
> AddDevice routine works fine…
>
> Thank you,
>
>
>
>

Hi,

Yes, I do have the line you mentioned. I hope it’s not because I didn’t call
IoAttachDeviceToDeviceStack(). The function crashes my system and I am
trying to figure it out the cause.

----- Original Message -----
From: “Jayadev”
To: “NT Developers Interest List”
Sent: Sunday, June 16, 2002 12:37 PM
Subject: [ntdev] Re: My Pnp routine is not called

> Hi Mishka,
>
> Do check whether your are clearing the flag of the device object you
> create in AddDevice routine.
>
> NewDeviceObject->Flags &= ~ DO_DEVICE_INITIALIZING;
>
>
> -------- Check DDK for DEVICE_OBJECT help -----------------
> It follows this …
> DO_DEVICE_INITIALIZING The I/O Manager sets this flag when it
creates
> the device object.
> A device function or filter driver clears the flag in its AddDevice
> routine, after attaching the device object to the device stack,
establishing
> the device power state, and ORing the field with one of the power flags
(if
> necessary). The PnP Manager checks that the flag is clear after return
from
> AddDevice.
>
>
> --------------------------------------------------------------------------
>
> If this is not done, then there is the reason for your problem.
>
>
> Cheers,
> - Jay
>
>
>
>
> ----- Original Message -----
> From: “Mishka Iakouchev”
> To: “NT Developers Interest List”
> Sent: Sunday, June 16, 2002 9:15 AM
> Subject: [ntdev] My Pnp routine is not called
>
>
> > Hello,
> >
> > For some reason, my Pnp routine isn’t called when I disable the device
or
> > update the driver. Am I missing something?
> >
> > This is the prototype…
> >
> > NTSTATUS DispatchPnp( IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp )
> >
> > And this is what I have in my DriverEntry routine…
> >
> > DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
> > DriverObject->DriverExtension->AddDevice = ClassAddDevice;
> >
> > AddDevice routine works fine…
> >
> > Thank you,
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@vsnl.net
> > To unsubscribe send a blank email to %%email.unsub%%
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@sbcglobal.net
> To unsubscribe send a blank email to %%email.unsub%%