Re: AddDevice question

Tim Newsham wrote: > >My driver requires a control device. I have traditionally made this >device in DriverEntry with...
Re: AddDevice question
Tim Newsham <> wrote:
>
>My driver requires a control device. I have traditionally made this
>device in DriverEntry with IoCreateDevice and IoCreateSymbolicLink.
>Now I’m trying to register an AddDevice function instead. One thing
>that confuses me is that AddDevice gets called with a device already
>made. Am I supposed to create a device with IoCreateDevice and
>IoCreateSymbolicLink and ignore the device I am given? Am I supposed
>to attach my created device to the device I am given? Am I supposed
>to use the device I am given instead of creating my own device (is the
>created device already set up to use my driver’s dispatch table)?

You’ve received 3 answers already, and the answer you need is kind of a
combination of all of them.

Your AddDevice is handed a PDO that was created by and belongs to the bus
driver below you. You will create your FDO by calling IoCreateDevice, then
attach it to the PDO you were handed by calling
IoAttachDeviceToDeviceStack. That’s a PnP stack.

Then, since you need a control device, you’ll call IoCreateDevice again to
create your control device. It does not belong to a device stack (it’s not
a PnP device), so you won’t attach it to anything.

You can create a symbolic link to either or both of those, depending on
what you need to do.

Tim Roberts,
Providenza & Boekelheide, Inc.

We will be happy to hear your thoughts

Leave a reply

TechEggs
Logo