How many copies of drivers?

Hello Everybody,

This is a further extension to the question regarding how many copies of a DLL.

Let us assume that there are two NIC cards of the same make, model etc. on a
single PC. Will there be two copies of the driver or will there be a single copy
of a driver in the memory handling both these interfaces?

Regards,
Bhargav

JOJAN wrote:

There will be single copy of CODE but multiple DATA (one for each
application). i.e., applications cannot share global variables in the DLL as
in Win 3.1

jojan

> -----Original Message-----
> From: Ashok Kumar Vijaya Srinivas Kadavakollu
> [mailto:xxxxx@wipro.com]
> Sent: Thursday, April 05, 2001 10:22 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: how DLL are loaded in memory
>
>
> Hi Ajitabh,
>
> There will be only a single copy of the DLL loaded into the
> memory shared
> by both the applications.
>
> rgds,
> Ashok
>
>
> *************************************
> K.V.S.Ashok Kumar,
> Systems Engineer - Microsoft labs,
> Network & Systems S/W group,
> E&I Solutions, Wipro Technologies,
> Hi-Tech City, Madhapur,
> Hyderabad.
> Ph: +91-40-6565363(D)
> Fax: +91-40-3119801
> E-mail : xxxxx@wipro.com
> visit us at: http://www.wipro.com
> “Success is the ability to go from one failure to
> another with no loss of enthusiasm” - Churchill
> *************************************
>
>
>
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Ajitabh Prakash
> Sent: Friday, March 16, 2001 11:23 PM
> To: NT Developers Interest List
> Subject: [ntdev] how DLL are loaded in memory
>
>
> hi all,
> I have a question regarding a loading the DLL in
> the memory.If two
> applications load the same DLL in the memory will there be
> two copies of the
> DLL in the address space of the each application or there
> will be one copy
> of DLL in the memory shared between the two Applications ??
>
>
> Thanx,
> Ajitabh
>
> —
> You are currently subscribed to ntdev as: xxxxx@wipro.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nestec.net
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: xxxxx@wipro.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

>Let us assume that there are two NIC cards of the same make, model etc. on a

single PC. Will there be two copies of the driver or will there be a
single copy
of a driver in the memory handling both these interfaces?

There will be ONE copy of the driver code and global data, and generally
multiple device objects (with extensions). A NT4 driver will generally find
all the devices, and create unique device objects, in it’s DriverEntry
function. A W2K driver will dynamically create/destroy logical device
objects in response to AddDevice and PnP calls. For W2K, the physical
device objects are created by the bus device, when it enumerates the bus.
There are also more complex scenarios. Like a compatibility WDM driver I
did that created legacy style device objects in DriverEntry (so old apps
could open the devices anytime), and hooked these up to actual devices at
AddDevice time when you really plugged in the device. Not only did the W2K
driver model change from NT4->W2k, the application interface to drivers
changed. Changing many third party apps to fit the W2K model was not an option.

  • Jan

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

Hello Jan,
I’ve to write a function driver on w2k to support two PCI cards having
same deviceID & vendorID. Can you please explain me more or provide
some website address where I can get more information ?
Here is my understanding about this :
Bus driver will detect 2 cards & it will open Found new hardware wizard
twice. I’ve to write 2 inf files so that there will be different service
names.
AddDevice routine will be called twice, I’ll create 2 device objects for
2 cards. I’ll keep 2 device extensions. However I’ve a doubt. Driver object
stores a pointer to device extension. Then will it store 2 device extension
pointers ?
As the physical device objects will be different for 2 cards, I’ve to
register
interface separately for them. Also while processing all the events &
procedures,
I’ll get device object pointer, so I’ll first check for which device object
this
request has come & then process it.
Please let me know whether my above understanding is right or not.

There are also more complex scenarios. Like a compatibility WDM driver I
did that created legacy style device objects in DriverEntry (so old apps
could open the devices anytime), and hooked these up to actual devices at
AddDevice time when you really plugged in the device.
Can you please explain more ?
Please provide me some pointers to get more information, if possible.
Thanks & Regards,
Aparna Argade
Wipro Technologies.

----- Original Message -----
From: “Jan Bottorff”
To: “NT Developers Interest List”
Sent: Thursday, April 05, 2001 11:57 AM
Subject: [ntdev] Re: How many copies of drivers?

>
> >Let us assume that there are two NIC cards of the same make, model etc.
on a
> >single PC. Will there be two copies of the driver or will there be a
> >single copy
> >of a driver in the memory handling both these interfaces?
>
> There will be ONE copy of the driver code and global data, and generally
> multiple device objects (with extensions). A NT4 driver will generally
find
> all the devices, and create unique device objects, in it’s DriverEntry
> function. A W2K driver will dynamically create/destroy logical device
> objects in response to AddDevice and PnP calls. For W2K, the physical
> device objects are created by the bus device, when it enumerates the bus.
> There are also more complex scenarios. Like a compatibility WDM driver I
> did that created legacy style device objects in DriverEntry (so old apps
> could open the devices anytime), and hooked these up to actual devices at
> AddDevice time when you really plugged in the device. Not only did the W2K
> driver model change from NT4->W2k, the application interface to drivers
> changed. Changing many third party apps to fit the W2K model was not an
option.
>
> - Jan
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@wipro.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

>I’ve to write a function driver on w2k to support two PCI cards having

same deviceID & vendorID.

Are these the SAME two devices or two different devices. Different devices
are supposed to have different subvendor/subdevice (or whatever that PCI
field is) ID’s.

Can you please explain me more or provide
some website address where I can get more information ?

See the W2K DDK on WDM function drivers. Or something like Walt Oney’s book
on WDM drivers.

Here is my understanding about this :
Bus driver will detect 2 cards & it will open Found new hardware wizard
twice.

Don’t positively remember for sure (INF files always seem to be black
magic), but if the hardware is identical, I believe only one driver get’s
installed. Driver searching is based on the PNP ID. If the PNP ID is
identical, I don’t believe a second instance will cause the hardware wizard
to be invoked.

I’ve to write 2 inf files so that there will be different service
names.

Are we talking identical hardware or not? An INF file will create a mapping
between a specific PNP ID and a specific driver. You can’t have two
different drivers associated with the same PNP ID. There have been times I
wanted to have the OS ask the driver if the inserted hardware belonged to
it, possibly polling a few drivers to find one that “claims” the device.
For example a fairly generic driver that knew how to query some category of
hardware for a match. W2K just didn’t seem to like this concept, and I
needed a zillion PNP id’s in the INF. It was an impossible task for me to
write an INF file than would have the correct PNP id’s for unknown future
versions of some third party’s hardware (which were designed to some
independent specs, so could be queried by a driver).

AddDevice routine will be called twice, I’ll create 2 device objects for
2 cards. I’ll keep 2 device extensions. However I’ve a doubt. Driver object
stores a pointer to device extension. Then will it store 2 device extension
pointers ?

The driver object stores a pointer to the chain of device objects, which
have pointers to their extensions. Don’t store a pointer to only one device
extension in the driver globals. Keep a pointer to a chain of device
extensions or walk the chain through the device objects.

As the physical device objects will be different for 2 cards, I’ve to
register
interface separately for them. Also while processing all the events &
procedures,
I’ll get device object pointer, so I’ll first check for which device object
this
request has come & then process it.
Please let me know whether my above understanding is right or not.

You will get called on your AddDevice entry point, and you need to create
logical devices for each physical device. The device extension is
associated with the logical device. The OS will pass the device object and
the IRP on operations. If you need to share data between the multiple
devices, allocate some from pool and have a pointer from each device
extension (or put it in driver globals). The device object has a pointer to
the device extension, so device unique data can easily be found for
requests for a specific device.

  • Jan

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

Thanks.
I’m looking “Controller & Multifunction Devices” subtopic under
Plug & Play topic in Walter Oney’s book. I hope it’ll solve my problem.
----- Original Message -----
From: “Jan Bottorff”
To: “NT Developers Interest List”
Sent: Thursday, April 05, 2001 3:14 PM
Subject: [ntdev] Re: How many copies of drivers?

>
> >I’ve to write a function driver on w2k to support two PCI cards having
> >same deviceID & vendorID.
>
> Are these the SAME two devices or two different devices. Different devices
> are supposed to have different subvendor/subdevice (or whatever that PCI
> field is) ID’s.
>
> >Can you please explain me more or provide
> >some website address where I can get more information ?
>
> See the W2K DDK on WDM function drivers. Or something like Walt Oney’s
book
> on WDM drivers.
>
> >Here is my understanding about this :
> >Bus driver will detect 2 cards & it will open Found new hardware wizard
> >twice.
>
> Don’t positively remember for sure (INF files always seem to be black
> magic), but if the hardware is identical, I believe only one driver get’s
> installed. Driver searching is based on the PNP ID. If the PNP ID is
> identical, I don’t believe a second instance will cause the hardware
wizard
> to be invoked.
>
> > I’ve to write 2 inf files so that there will be different service
> >names.
>
> Are we talking identical hardware or not? An INF file will create a
mapping
> between a specific PNP ID and a specific driver. You can’t have two
> different drivers associated with the same PNP ID. There have been times I
> wanted to have the OS ask the driver if the inserted hardware belonged to
> it, possibly polling a few drivers to find one that “claims” the device.
> For example a fairly generic driver that knew how to query some category
of
> hardware for a match. W2K just didn’t seem to like this concept, and I
> needed a zillion PNP id’s in the INF. It was an impossible task for me to
> write an INF file than would have the correct PNP id’s for unknown future
> versions of some third party’s hardware (which were designed to some
> independent specs, so could be queried by a driver).
>
> >AddDevice routine will be called twice, I’ll create 2 device objects for
> >2 cards. I’ll keep 2 device extensions. However I’ve a doubt. Driver
object
> >stores a pointer to device extension. Then will it store 2 device
extension
> >pointers ?
>
> The driver object stores a pointer to the chain of device objects, which
> have pointers to their extensions. Don’t store a pointer to only one
device
> extension in the driver globals. Keep a pointer to a chain of device
> extensions or walk the chain through the device objects.
>
> >As the physical device objects will be different for 2 cards, I’ve to
> >register
> >interface separately for them. Also while processing all the events &
> >procedures,
> >I’ll get device object pointer, so I’ll first check for which device
object
> >this
> >request has come & then process it.
> >Please let me know whether my above understanding is right or not.
>
> You will get called on your AddDevice entry point, and you need to create
> logical devices for each physical device. The device extension is
> associated with the logical device. The OS will pass the device object and
> the IRP on operations. If you need to share data between the multiple
> devices, allocate some from pool and have a pointer from each device
> extension (or put it in driver globals). The device object has a pointer
to
> the device extension, so device unique data can easily be found for
> requests for a specific device.
>
> - Jan
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@wipro.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

If you have ‘n’ card of the same PNP ID then it will invoke the Wizard ‘n’
times for each card, will load the same driver for all ‘n’ cards.

That is to say that 2 cards with same PNP ID cannot have different drivers.

Ramit.
----- Original Message -----
From: “Aparna Sachin Argade”
To: “NT Developers Interest List”
Sent: Thursday, April 05, 2001 4:20 PM
Subject: [ntdev] Re: How many copies of drivers?

> Thanks.
> I’m looking “Controller & Multifunction Devices” subtopic under
> Plug & Play topic in Walter Oney’s book. I hope it’ll solve my problem.
> ----- Original Message -----
> From: “Jan Bottorff”
> To: “NT Developers Interest List”
> Sent: Thursday, April 05, 2001 3:14 PM
> Subject: [ntdev] Re: How many copies of drivers?
>
>
> >
> > >I’ve to write a function driver on w2k to support two PCI cards having
> > >same deviceID & vendorID.
> >
> > Are these the SAME two devices or two different devices. Different
devices
> > are supposed to have different subvendor/subdevice (or whatever that PCI
> > field is) ID’s.
> >
> > >Can you please explain me more or provide
> > >some website address where I can get more information ?
> >
> > See the W2K DDK on WDM function drivers. Or something like Walt Oney’s
> book
> > on WDM drivers.
> >
> > >Here is my understanding about this :
> > >Bus driver will detect 2 cards & it will open Found new hardware wizard
> > >twice.
> >
> > Don’t positively remember for sure (INF files always seem to be black
> > magic), but if the hardware is identical, I believe only one driver
get’s
> > installed. Driver searching is based on the PNP ID. If the PNP ID is
> > identical, I don’t believe a second instance will cause the hardware
> wizard
> > to be invoked.
> >
> > > I’ve to write 2 inf files so that there will be different service
> > >names.
> >
> > Are we talking identical hardware or not? An INF file will create a
> mapping
> > between a specific PNP ID and a specific driver. You can’t have two
> > different drivers associated with the same PNP ID. There have been times
I
> > wanted to have the OS ask the driver if the inserted hardware belonged
to
> > it, possibly polling a few drivers to find one that “claims” the device.
> > For example a fairly generic driver that knew how to query some category
> of
> > hardware for a match. W2K just didn’t seem to like this concept, and I
> > needed a zillion PNP id’s in the INF. It was an impossible task for me
to
> > write an INF file than would have the correct PNP id’s for unknown
future
> > versions of some third party’s hardware (which were designed to some
> > independent specs, so could be queried by a driver).
> >
> > >AddDevice routine will be called twice, I’ll create 2 device objects
for
> > >2 cards. I’ll keep 2 device extensions. However I’ve a doubt. Driver
> object
> > >stores a pointer to device extension. Then will it store 2 device
> extension
> > >pointers ?
> >
> > The driver object stores a pointer to the chain of device objects, which
> > have pointers to their extensions. Don’t store a pointer to only one
> device
> > extension in the driver globals. Keep a pointer to a chain of device
> > extensions or walk the chain through the device objects.
> >
> > >As the physical device objects will be different for 2 cards, I’ve to
> > >register
> > >interface separately for them. Also while processing all the events &
> > >procedures,
> > >I’ll get device object pointer, so I’ll first check for which device
> object
> > >this
> > >request has come & then process it.
> > >Please let me know whether my above understanding is right or not.
> >
> > You will get called on your AddDevice entry point, and you need to
create
> > logical devices for each physical device. The device extension is
> > associated with the logical device. The OS will pass the device object
and
> > the IRP on operations. If you need to share data between the multiple
> > devices, allocate some from pool and have a pointer from each device
> > extension (or put it in driver globals). The device object has a pointer
> to
> > the device extension, so device unique data can easily be found for
> > requests for a specific device.
> >
> > - Jan
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@wipro.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@wipro.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

> stores a pointer to device extension. Then will it store 2 device
extension

pointers ?

Wrong. Driver object stores a pointer to the head of the device object
list
.
Nothing wrong having 2 or more device objects in the same driver.
Just do not use the global data and use the device extensions for it.

Max


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