Hi,

I'm a newbie by driver development. So I'm sorry if my question is too
simple or absurd.

Is it required to call IoAttachDeviceToDeviceStack routine in an AddDevice
routine for a WDM driver? I'm asking this because I need (for a homework -
we have a modified STUPID driver from Walter Oney) to add multiple devices
in an AddDevice routine (for each found parallel port a DO of type
FILE_DEVICE_PARALLEL_PORT) But I think this is against the device stack
mechanism. For each DO we need to get the corresponding parallel port device
object (so far I read it's parport.sys for WinXP not?) and save it in the
DO's device extension. And some Dispatch routines should forward the calls
to parallel port DO. But where is the device stack now? I'm adding multiple
devices in the AddDevice so it's impossible to call the
IoAttachDeviceToDeviceStack for each one. It means the newly created device
objects will not have a PDO from them. Is this true? And what are the side
effects if I don't add my device to the stack?

PS: As the end result we will implement a driver for a parallel port LCD
screen.

Thanks for all replies.

Re: Newbie question for IoAttachDeviceToDeviceStack by Peter

Peter
Thu Jun 24 09:11:09 CDT 2004

can you more clearly explain why you need to add more than one device to
each PDO from a single driver? You say that you need to do this, then only
mention adding one device object (of type FILE_DEVICE_PARALLEL_PORT) so i'm
not sure what the other devices objects you think you need are.

Is your question about how your driver can enumerate the parallel ports in
the system when it loads and access them? Based on the problem you're
trying to solve, i would have expected you to have a driver which did this,
then drove the parallel port to see if an LCD screen was attached, and then
to create an LCD screen device object for each port that had one. Is that
what you're trying to do?

---

Generally your driver only adds one device object to the device stack in
each call to AddDevice (which is called for each stack that is to contain
your driver).

you would call IoAttachDeviceToDeviceStack in your AddDevice routine using
the PDO that is supplied in the parameters. This will return a pointer to
the lower device object, which you store in your device object's
DeviceExtension.

Then in the dispatch routines you write, you can forward I/O requests to the
lower drivers or support them yourself.

-p



--
This posting is provided "AS IS" with no warranties, and confers no rights.
"IPrincipal" <balioglu@DONOTSPAM_in.tum.de> wrote in message
news:e4DrGJcWEHA.2844@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> I'm a newbie by driver development. So I'm sorry if my question is too
> simple or absurd.
>
> Is it required to call IoAttachDeviceToDeviceStack routine in an AddDevice
> routine for a WDM driver? I'm asking this because I need (for a homework -
> we have a modified STUPID driver from Walter Oney) to add multiple devices
> in an AddDevice routine (for each found parallel port a DO of type
> FILE_DEVICE_PARALLEL_PORT) But I think this is against the device stack
> mechanism. For each DO we need to get the corresponding parallel port
> device
> object (so far I read it's parport.sys for WinXP not?) and save it in the
> DO's device extension. And some Dispatch routines should forward the calls
> to parallel port DO. But where is the device stack now? I'm adding
> multiple
> devices in the AddDevice so it's impossible to call the
> IoAttachDeviceToDeviceStack for each one. It means the newly created
> device
> objects will not have a PDO from them. Is this true? And what are the side
> effects if I don't add my device to the stack?
>
> PS: As the end result we will implement a driver for a parallel port LCD
> screen.
>
> Thanks for all replies.
>
>



Re: Newbie question for IoAttachDeviceToDeviceStack by IPrincipal

IPrincipal
Fri Jun 25 02:59:48 CDT 2004

Hi,

Under the address http://www.phdcc.com/NTDevDrArt.html at the bottom of the
page is a similar sample code for an non-WDM NT Driver. The only difference
is that this logic must reside in the AddDevice routine (The homework says
so.) For now I just need to enumarate all the parallel ports, create dump
device objects (instead of an LCD screen device) for each port (assuming all
have attached LCD screens) and register them in the object manager. (This
part is for AddDevice routine) And after this my driver needs to forward
some of the IOCTL IRPs coming from the user-mode to the parallel port
associated with the dump device object.

Thanks for your help.



Re: Newbie question for IoAttachDeviceToDeviceStack by Peter

Peter
Fri Jun 25 12:22:53 CDT 2004

what does the driver attached to the parallel port stack actually do? What
does it do if there's no LCD screen attached to that port?

-p

--
This posting is provided "AS IS" with no warranties, and confers no rights.
"IPrincipal" <balioglu@DONOTSPAM_in.tum.de> wrote in message
news:uBH1kpoWEHA.2940@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> Under the address http://www.phdcc.com/NTDevDrArt.html at the bottom of
> the
> page is a similar sample code for an non-WDM NT Driver. The only
> difference
> is that this logic must reside in the AddDevice routine (The homework says
> so.) For now I just need to enumarate all the parallel ports, create dump
> device objects (instead of an LCD screen device) for each port (assuming
> all
> have attached LCD screens) and register them in the object manager. (This
> part is for AddDevice routine) And after this my driver needs to forward
> some of the IOCTL IRPs coming from the user-mode to the parallel port
> associated with the dump device object.
>
> Thanks for your help.
>
>