Calling IoCreateDevice multiple times in AddDevice

****NOTE****This is all pseudo code to express a given situation****

I want to create have 4 symbolic links and 4 devices (channels) for each
entry to AddDevice…

* 2 Call to AddDevice = 4 IoCreateDevice calls, 4 IoCreateSymbolicLink
calls
* 2 Calls to AddDevice = 8 IoCreateDevice calls, 8 IoCreateSymbolicLink
calls

Let’s say I have 2 pysical PCI cards in the system:

I want to call IoCreateDevice 8 times (4 per card) in a for loop

** Format is MyDevice[card number]_[channel number] **

What happens that when My DeviceControl function and all other funtions are
called the PDEVICE_OBJECT (fdo)
that is passed into the function is always the FDO of the last
IoCreateDevice call, regardless of the Symbolic link name given
to CreateFile and registered to the FDO?

See below for more info…

Any help would be great!

Regards,
Mike

Here are the device names for each IoCreateDevice…

note, I supply the same PDO, but save each off each FDO returned (which are
different)

/* PCI card 0 */
\Device\MyDevice0_0 /* Channel 0 */
\Device\MyDevice0_1 /* Channel 1 */
\Device\MyDevice0_2 /* Channel 2 */
\Device\MyDevice0_3 /* Channel 3 */

/* PCI card 1 */
\Device\MyDevice1_0 /* Channel 0 */
\Device\MyDevice1_1 /* Channel 1*/
\Device\MyDevice1_1 /* Channel 2 */
\Device\MyDevice1_1 /* Channel 3 */

Then, I create the sym links

/* PCI Card 0 */
IoCreateSymbolicLink(“\MyDeviceName0_0”,“\Device\MyDevice0_0)
IoCreateSymbolicLink(”\MyDeviceName0_0",“\Device\MyDevice0_0)
IoCreateSymbolicLink(”\MyDeviceName0_0",“\Device\MyDevice0_0)
IoCreateSymbolicLink(”\MyDeviceName0_0","\Device\MyDevice0_0)

/* PCI Card 1 */
IoCreateSymbolicLink(“\MyDeviceName0_0”,“\Device\MyDevice0_0)
IoCreateSymbolicLink(”\MyDeviceName0_0",“\Device\MyDevice0_0)
IoCreateSymbolicLink(”\MyDeviceName0_0",“\Device\MyDevice0_0)
IoCreateSymbolicLink(”\MyDeviceName0_0","\Device\MyDevice0_0)

“This message may contain company proprietary information. If you are not
the intended recipient, any disclosure, copying, distribution or reliance on
the contents of this message is prohibited. If you received this message in
error, please delete and notify me.”

Your design is broken. Pnp assumes one PDO one FDO, with the possibility of
multiple upper lower filters. Instead your choices are to use multiple
device interfaces rather than multiple devices, or to get much more
complicated and turn your pci function driver into a bus driver for your
‘channel’ devices, creating PDOs to represent the channels, and writing a
separate function driver to provide the channel FDOs. See the toaster sample
for some clues about how to do this.

-----Original Message-----
From: Randazzo, Michael [mailto:xxxxx@ddc-web.com]
Sent: Wednesday, May 07, 2003 3:27 PM
To: NT Developers Interest List
Subject: [ntdev] Calling IoCreateDevice multiple times in AddDevice

****NOTE****This is all pseudo code to express a given situation****

I want to create have 4 symbolic links and 4 devices
(channels) for each entry to AddDevice…

* 2 Call to AddDevice = 4 IoCreateDevice calls, 4
IoCreateSymbolicLink calls
* 2 Calls to AddDevice = 8 IoCreateDevice calls, 8
IoCreateSymbolicLink calls

Let’s say I have 2 pysical PCI cards in the system:

I want to call IoCreateDevice 8 times (4 per card) in a for loop

** Format is MyDevice[card number]_[channel number] **

What happens that when My DeviceControl function and all
other funtions are called the PDEVICE_OBJECT (fdo) that is
passed into the function is always the FDO of the last
IoCreateDevice call, regardless of the Symbolic link name
given to CreateFile and registered to the FDO?

See below for more info…

Any help would be great!

Regards,
Mike

Here are the device names for each IoCreateDevice…

note, I supply the same PDO, but save each off each FDO
returned (which are
different)

/* PCI card 0 */
\Device\MyDevice0_0 /* Channel 0 */
\Device\MyDevice0_1 /* Channel 1 */
\Device\MyDevice0_2 /* Channel 2 */
\Device\MyDevice0_3 /* Channel 3 */

/* PCI card 1 */
\Device\MyDevice1_0 /* Channel 0 */
\Device\MyDevice1_1 /* Channel 1*/
\Device\MyDevice1_1 /* Channel 2 */
\Device\MyDevice1_1 /* Channel 3 */

Then, I create the sym links

/* PCI Card 0 */
IoCreateSymbolicLink(“\MyDeviceName0_0”,“\Device\MyDevice0_0)
IoCreateSymbolicLink(”\MyDeviceName0_0",“\Device\MyDevice0_0)
IoCreateSymbolicLink(”\MyDeviceName0_0",“\Device\MyDevice0_0)
IoCreateSymbolicLink(”\MyDeviceName0_0","\Device\MyDevice0_0)

/* PCI Card 1 */
IoCreateSymbolicLink(“\MyDeviceName0_0”,“\Device\MyDevice0_0)
IoCreateSymbolicLink(”\MyDeviceName0_0",“\Device\MyDevice0_0)
IoCreateSymbolicLink(”\MyDeviceName0_0",“\Device\MyDevice0_0)
IoCreateSymbolicLink(”\MyDeviceName0_0","\Device\MyDevice0_0)

“This message may contain company proprietary information. If
you are not the intended recipient, any disclosure, copying,
distribution or reliance on the contents of this message is
prohibited. If you received this message in error, please
delete and notify me.”


You are currently subscribed to ntdev as:
xxxxx@stratus.com To unsubscribe send a blank email to
xxxxx@lists.osr.com