Question on PnP Irps!

Hi

I am writing a function driver for PCI controller. When device is
disabled from device manager, driver gets IRP_MN_QUERY_REMOVE_DEVICE and
IRP_MN_REMOVE_DEVICE in normal condition.

Under the same condition, when driver is busy with device IRPs, it
returns STATUS_UNSUCCESSFUL for IRP_MN_QUERY_REMOVE_DEVICE. It
maintainsthe device state without any change.

Following this Pnp manager sends IRP_MN_CANCEL_REMOVE_DEVICE, this
IRPis passed to lower driver without any change(also setting
status=STATUS_SUCCESS). After this OS prompts for a system restart
dialog asking user to restart to enable the system setting changes.

Is this expected behavior under Win2000? Are am I missing something?

Regards
Venky


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Venky,

I think this is a valid behavour and it is done to
tell the user (in one sense) that the device cannot be
removed right now, but the action you have performed
is taken into account the next time you reboot.

Internally, Windows (Or a ClassInstaller) would have
cleared the corresponding entries from the registry,
so that the next time after reboot, windows would have
no clue about the device.

Cheers,
Jay

— Varadan Venkatesh wrote:
> Hi
>
> I am writing a function driver for PCI controller.
> When device is
> disabled from device manager, driver gets
> IRP_MN_QUERY_REMOVE_DEVICE and
> IRP_MN_REMOVE_DEVICE in normal condition.
>
> Under the same condition, when driver is busy with
> device IRPs, it
> returns STATUS_UNSUCCESSFUL for
> IRP_MN_QUERY_REMOVE_DEVICE. It
> maintainsthe device state without any change.
>
> Following this Pnp manager sends
> IRP_MN_CANCEL_REMOVE_DEVICE, this
> IRPis passed to lower driver without any change(also
> setting
> status=STATUS_SUCCESS). After this OS prompts for a
> system restart
> dialog asking user to restart to enable the system
> setting changes.
>
> Is this expected behavior under Win2000? Are am I
> missing something?
>
> Regards
> Venky
>
>
>
>
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Jay,
I have the same problem. As I understood, if IRP_MN_QUERY_REMOVE_DEVICE
control
returns STATUS_SUCCESS, FDO receives REMOVE and then AddDevice() is called
with
existing PDO to create FDO again. I can not remove my device’s FDO , since
it can cause
problems in my driver. On the other hand I dont want OS to prompt for a
system restart for
each new device.
What can I do?
May I do the work of ClassInstaller in the registry, before receiving
QUERY_REMOVE.

Regards,
Dany

-----Original Message-----
From: jayadev m n [mailto:xxxxx@yahoo.com]
Sent: Thursday, September 06, 2001 4:54 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Question on PnP Irps!

Venky,

I think this is a valid behavour and it is done to
tell the user (in one sense) that the device cannot be
removed right now, but the action you have performed
is taken into account the next time you reboot.

Internally, Windows (Or a ClassInstaller) would have
cleared the corresponding entries from the registry,
so that the next time after reboot, windows would have
no clue about the device.

Cheers,
Jay

— Varadan Venkatesh wrote:
> Hi
>
> I am writing a function driver for PCI controller.
> When device is
> disabled from device manager, driver gets
> IRP_MN_QUERY_REMOVE_DEVICE and
> IRP_MN_REMOVE_DEVICE in normal condition.
>
> Under the same condition, when driver is busy with
> device IRPs, it
> returns STATUS_UNSUCCESSFUL for
> IRP_MN_QUERY_REMOVE_DEVICE. It
> maintainsthe device state without any change.
>
> Following this Pnp manager sends
> IRP_MN_CANCEL_REMOVE_DEVICE, this
> IRPis passed to lower driver without any change(also
> setting
> status=STATUS_SUCCESS). After this OS prompts for a
> system restart
> dialog asking user to restart to enable the system
> setting changes.
>
> Is this expected behavior under Win2000? Are am I
> missing something?
>
> Regards
> Venky
>
>
>
>
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com


You are currently subscribed to ntdev as: xxxxx@store-age.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Dany,
I think you can go for developping a classinstaller,
which will remove the device silently (But in reality,
the FDO would have not got delete).
If you remove the device from device manager and the
if the driver doesnot do the job, then the windows
throws the Restart message, if you dont want this to
happen, write a classinstaller.

You can use SetupDiXXX calls to do the job.

Cheers,
Jay

— Dany Polovets wrote:
> Jay,
> I have the same problem. As I understood, if
> IRP_MN_QUERY_REMOVE_DEVICE
> control
> returns STATUS_SUCCESS, FDO receives REMOVE and
> then AddDevice() is called
> with
> existing PDO to create FDO again. I can not remove
> my device’s FDO , since
> it can cause
> problems in my driver. On the other hand I dont want
> OS to prompt for a
> system restart for
> each new device.
> What can I do?
> May I do the work of ClassInstaller in the registry,
> before receiving
> QUERY_REMOVE.
>
> Regards,
> Dany
>
>
> -----Original Message-----
> From: jayadev m n [mailto:xxxxx@yahoo.com]
> Sent: Thursday, September 06, 2001 4:54 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Question on PnP Irps!
>
>
> Venky,
>
> I think this is a valid behavour and it is done to
> tell the user (in one sense) that the device cannot
> be
> removed right now, but the action you have performed
> is taken into account the next time you reboot.
>
> Internally, Windows (Or a ClassInstaller) would have
> cleared the corresponding entries from the registry,
> so that the next time after reboot, windows would
> have
> no clue about the device.
>
> Cheers,
> Jay
>
>
> — Varadan Venkatesh
> wrote:
> > Hi
> >
> > I am writing a function driver for PCI controller.
> > When device is
> > disabled from device manager, driver gets
> > IRP_MN_QUERY_REMOVE_DEVICE and
> > IRP_MN_REMOVE_DEVICE in normal condition.
> >
> > Under the same condition, when driver is busy with
> > device IRPs, it
> > returns STATUS_UNSUCCESSFUL for
> > IRP_MN_QUERY_REMOVE_DEVICE. It
> > maintainsthe device state without any change.
> >
> > Following this Pnp manager sends
> > IRP_MN_CANCEL_REMOVE_DEVICE, this
> > IRPis passed to lower driver without any
> change(also
> > setting
> > status=STATUS_SUCCESS). After this OS prompts for
> a
> > system restart
> > dialog asking user to restart to enable the system
> > setting changes.
> >
> > Is this expected behavior under Win2000? Are am I
> > missing something?
> >
> > Regards
> > Venky
> >
> >
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as:
> > xxxxx@yahoo.com
> > To unsubscribe send a blank email to
> leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
>
> Do You Yahoo!?
> Get email alerts & NEW webcam video instant
> messaging with Yahoo! Messenger
> http://im.yahoo.com
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@store-age.com
> To unsubscribe send a blank email to
> leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Jay,
Can you describe it in more details please.
Can I write coinstaller instead?
Thanks,
Dany

-----Original Message-----
From: jayadev m n [mailto:xxxxx@yahoo.com]
Sent: Friday, September 07, 2001 8:44 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Question on PnP Irps!

Dany,
I think you can go for developping a classinstaller,
which will remove the device silently (But in reality,
the FDO would have not got delete).
If you remove the device from device manager and the
if the driver doesnot do the job, then the windows
throws the Restart message, if you dont want this to
happen, write a classinstaller.

You can use SetupDiXXX calls to do the job.

Cheers,
Jay

— Dany Polovets wrote:
> Jay,
> I have the same problem. As I understood, if
> IRP_MN_QUERY_REMOVE_DEVICE
> control
> returns STATUS_SUCCESS, FDO receives REMOVE and
> then AddDevice() is called
> with
> existing PDO to create FDO again. I can not remove
> my device’s FDO , since
> it can cause
> problems in my driver. On the other hand I dont want
> OS to prompt for a
> system restart for
> each new device.
> What can I do?
> May I do the work of ClassInstaller in the registry,
> before receiving
> QUERY_REMOVE.
>
> Regards,
> Dany
>
>
> -----Original Message-----
> From: jayadev m n [mailto:xxxxx@yahoo.com]
> Sent: Thursday, September 06, 2001 4:54 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Question on PnP Irps!
>
>
> Venky,
>
> I think this is a valid behavour and it is done to
> tell the user (in one sense) that the device cannot
> be
> removed right now, but the action you have performed
> is taken into account the next time you reboot.
>
> Internally, Windows (Or a ClassInstaller) would have
> cleared the corresponding entries from the registry,
> so that the next time after reboot, windows would
> have
> no clue about the device.
>
> Cheers,
> Jay
>
>
> — Varadan Venkatesh
> wrote:
> > Hi
> >
> > I am writing a function driver for PCI controller.
> > When device is
> > disabled from device manager, driver gets
> > IRP_MN_QUERY_REMOVE_DEVICE and
> > IRP_MN_REMOVE_DEVICE in normal condition.
> >
> > Under the same condition, when driver is busy with
> > device IRPs, it
> > returns STATUS_UNSUCCESSFUL for
> > IRP_MN_QUERY_REMOVE_DEVICE. It
> > maintainsthe device state without any change.
> >
> > Following this Pnp manager sends
> > IRP_MN_CANCEL_REMOVE_DEVICE, this
> > IRPis passed to lower driver without any
> change(also
> > setting
> > status=STATUS_SUCCESS). After this OS prompts for
> a
> > system restart
> > dialog asking user to restart to enable the system
> > setting changes.
> >
> > Is this expected behavior under Win2000? Are am I
> > missing something?
> >
> > Regards
> > Venky
> >
> >
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as:
> > xxxxx@yahoo.com
> > To unsubscribe send a blank email to
> leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
>
> Do You Yahoo!?
> Get email alerts & NEW webcam video instant
> messaging with Yahoo! Messenger
> http://im.yahoo.com
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@store-age.com
> To unsubscribe send a blank email to
> leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com


You are currently subscribed to ntdev as: xxxxx@store-age.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Dany,
CoInstallers are not used for the purpose we
talked
about. They are used to assist the user to do certain
setting which govern the working of the device, during

the installation process.

Ex: We can popup a dialog which has Baudrate,
flowControl, base address, etc. when are installing
the serial port devices.

While again as I said the class installers use the API
exported by the windows SetupDiXXX to load / unload a
driver.

Hint : Refer DDK and check the following
Data structure :

HDEVINFO
SP_DEVINFO_DATA

APIs

SetupDiGetClassDevs
SetupDiCreateDeviceInfoList
SetupDiCreateDeviceInfo
SetupDiGetDeviceInstallParams
SetupDiDeleteDeviceInfo
SetupDiDestroyDeviceInfoList
SetupDiSetDeviceInstallParams
SetupDiSetDeviceRegistryProperty
SetupDiCallClassInstaller
SetupDiInstallDevice
and much more.

I fear that you cannot get a full fledge sample any
where.

Also check this out “Virtual Net Device Installation
Code Sample” in DDK doc.

Cheers,
Jay


Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com