Re: when does a PDO become a PDO ?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: shahar (shahar_at_discussions.microsoft.com)
Date: 08/10/04


Date: Mon, 9 Aug 2004 23:13:02 -0700

I still do not understand why I cannot attach to a running stack:
I get a device name in the pnp notification, I get the device object using
IoGetDeviceObjectPointer, and I attach to the device stack using
IoAttachDeviceToDeviceStack. What is wrong with that ?
I already implemented all of this and it all works perfectly under any
scenario I tested. My only problem is with calling IoGetDeviceProperty on
child PDO's of the bus. Calling IoGetDeviceProperty doesn't even cause any
problem, I just get STATUS_INVALID_DEVICE_REQUEST when calling it with a PDO
for a device that the PNP Manager never heard about, the only problem is that
the Driver Verifier bug checks on it.

"Mark Roddy" wrote:

> Like I said, and as you are now also hearing from other quarters: you have
> designed yourself into a corner. If the stack cannot be stopped then you
> cannot reliably insert or remove a filter. Those are the current
> constraints. Stopping or rebooting is currently the only reliable solution.
>
> --
>
> =====================
> Mark Roddy
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
> markr@hollistech.com
>
>
> "shahar" <shahar@discussions.microsoft.com> wrote in message
> news:A8FBCF0A-43D4-4804-9946-5CC373BEC9C5@microsoft.com...
> >I don't want to stop the device from the same reason I don't want to force
> >a
> > reboot:
> > My product installation must not disturb the user in any way.
> >
> > What is wrong with attaching to the top of a started device stack ?
> >
> > "Eliyas Yakub [MSFT]" wrote:
> >
> >> >Are you saying that there is no safe way to install a bus filter on a
> >> running system ?
> >>
> >> It depends on whether the device can be stopped (query-removed) at
> >> runtime
> >> and restarted. In order to insert the filter, the device stack has to be
> >> torn down and rebuilt. If the device cannot be stopped at runtime then
> >> setup
> >> the registry and reboot the system so that the filter gets loaded as part
> >> of
> >> the bus driver function stack.
> >>
> >> --
> >> --
> >> -Eliyas
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >> http://www.microsoft.com/whdc/driver/default.mspx
> >> http://www.microsoft.com/whdc/driver/kernel/KB-drv.mspx
> >>
> >>
> >>
> >> "shahar" <shahar@discussions.microsoft.com> wrote in message
> >> news:69482572-E29E-4B12-84C4-56F83052A524@microsoft.com...
> >> > Even if I will find a sollution for attaching to the device stack
> >> > before
> >> it
> >> > starts I will still have to deal with a scenario where the device stack
> >> > is
> >> > already started because this will surely be the case when my product is
> >> first
> >> > installed on a computer (I do not want to force a restart when my
> >> > product
> >> is
> >> > installed).
> >> >
> >> > Are you saying that there is no safe way to install a bus filter on a
> >> > running system ?
> >> >
> >> > "Mark Roddy" wrote:
> >> >
> >> > > Comments inline.
> >> > >
> >> > > --
> >> > >
> >> > > =====================
> >> > > Mark Roddy
> >> > > Windows 2003/XP/2000 Consulting
> >> > > Hollis Technology Solutions 603-321-1032
> >> > > www.hollistech.com
> >> > > markr@hollistech.com
> >> > >
> >> > >
> >> > > "shahar" <shahar@discussions.microsoft.com> wrote in message
> >> > > news:92B29FF6-842C-4A8C-A87D-05DCFF733E7D@microsoft.com...
> >> > > > My product is attaching to a very specific type of bus. I only
> >> > > > attach
> >> to
> >> > > > the
> >> > > > device stack after I am informed by a pnp notification I registered
> >> > > > (IoRegisterPnpNotification) for a device interface that this
> >> > > > specific
> >> bus
> >> > > > registers.
> >> > >
> >> > > Like I said, this is the wrong approach. You have designed yourself
> >> > > into
> >> a
> >> > > corner here.
> >> > >
> >> > > > Since I will be notified only after the device completes it's
> >> > > > IRP_MN_START_DEVICE, it is not possible for me to be there before
> >> that,
> >> > > > thus
> >> > > > I am forced to do things this way.
> >> > > >
> >> > > > Is there another way to check if the pnp knows about the PDO ?
> >> > > >
> >> > >
> >> > > Not that I know of. Go back and rethink how you are attaching to the
> >> > > bus
> >> > > driver FDO.
> >> > >
> >> > > > "Mark Roddy" wrote:
> >> > > >
> >> > > >> Attaching to the bus FDO 'long after it started' is a design flaw
> >> > > >> you
> >> > > >> ought
> >> > > >> to fix. Make your inquiries when you see a start device for the
> >> > > >> PDO
> >> in
> >> > > >> question, as that will guarantee that the PDO is in fact a PDO.
> >> > > >>
> >> > > >> I have no idea why Microsoft bugchecks on an invalid PDO rather
> >> > > >> than
> >> > > >> returning an error. I suppose it is a gentle warning that you are
> >> doing
> >> > > >> things the wrong way :-)
> >> > > >>
> >> > > >> --
> >> > > >>
> >> > > >> =====================
> >> > > >> Mark Roddy
> >> > > >> Windows 2003/XP/2000 Consulting
> >> > > >> Hollis Technology Solutions 603-321-1032
> >> > > >> www.hollistech.com
> >> > > >> markr@hollistech.com
> >> > > >>
> >> > > >>
> >> > > >> "shahar" <shahar@discussions.microsoft.com> wrote in message
> >> > > >> news:65D27172-9DA8-4938-B31D-28E9BFEB5026@microsoft.com...
> >> > > >> >I am writing a bus filter and I would like to call functions
> >> > > >> >like:
> >> > > >> > IoGetDeviceProperty, IoQueryDevicePnpState and
> >> > > >> > IoRequestDeviceEject
> >> > > >> > on pdo's that my filter sees in IRP_MN_QUERY_DEVICE_RELATIONS
> >> queries
> >> > > >> > that
> >> > > >> > are sent to the bus I'm filtering.
> >> > > >> > The problem is that I attach to the bus long after it is started
> >> and I
> >> > > >> > can't
> >> > > >> > know if this is the first time that the pdo is reported or if it
> >> was
> >> > > >> > reported
> >> > > >> > a long time ago and maybe even started already.
> >> > > >> > Calling any of the functions I mentioned on a PDO that was not
> >> reported
> >> > > >> > to
> >> > > >> > the pnp manager yet will generate a bugcheck.
> >> > > >> > My questions is: How can I know if the pnp manager already knows
> >> about
> >> > > >> > the
> >> > > >> > PDO ? when exactly is it alright to call those functions with
> >> > > >> > the
> >> pdo ?
> >> > > >> > I will also be very glad if someone can explain why do those
> >> functions
> >> > > >> > bugcheck when using an uninitialized pdo instead of just
> >> > > >> > returning
> >> with
> >> > > >> > a
> >> > > >> > failed status.
> >> > > >> >
> >> > > >> > Thank you,
> >> > > >> > Shahar.
> >> > > >>
> >> > > >>
> >> > > >>
> >> > >
> >> > >
> >> > >
> >>
> >>
> >>
>
>
>



Relevant Pages

  • Re: Mouse & keyboard filters
    ... you can only do this by restarting the mouse stack, ... > all mouse devices and then select the one to attach to? ... >>> I intend to write a driver that would filter mouse IO, ... >>> to the appropriate device stack during driver initialization, BUT, how ...
    (microsoft.public.development.device.drivers)
  • Re: Whats the secmantics of IoDetachDevice?
    ... The above requirement has to be met only by those FS filters that attach ... to A which is then likely to go away, and B is now top of stack. ... a newbie may try to attach its non-PnP device to PnP stack with disastrous ...
    (microsoft.public.development.device.drivers)
  • Re: Mouse & keyboard filters
    ... Thanks for your responce, Can you please elaborate, how can I restart the ... same apply for attaching to the keyboard stack? ... stack to be able to dynamically attach to it? ...
    (microsoft.public.development.device.drivers)
  • Method for attaching an uppper-filter to a new volume?
    ... Does anybody know the preferred method to attach an upper-filter driver to a ... I have an upper-filter driver ... volume is created and a formatting operation ... cannot rebuild the volume stack to include my driver (using the SetupDixxx ...
    (microsoft.public.development.device.drivers)
  • Re: Irp/Urb Completion Routine Is Called Only Once
    ... > I re-initialize the Urb and attach it to the Irp the same way each time ... > before forwarding down the stack. ...
    (microsoft.public.development.device.drivers)