S?ren,
Are you trying to create a device object for every miniport (adapter
instance) or just a single device object for the ‘driver’?
NdisMRegisterDevice() is more often used as a way of creating a ‘control
device’ associated with the driver and not individual auxilary device
objects associated with each miniport adapter.
If you only need one for the driver, global data is no different.
If you really are trying to create a device object for each adapter, then
two things come to mind:
-
You potentially have the wrong model of interaction. Perhaps custom
OIDs would be a better choice and communicate to the miniport adapters via
something like NDISUIO (NDISPROT in the DDK) or via WMI and avoid the
auxilary device altogether.
-
You are convinced this is the right thing. In that case, you could
stick the DeviceObject pointer in the ADAPTER structure and scan the list of
adapter structures looking for a match on each IRP submitted. In other
words, lookup the appropriate adapter with each request. Rather a pain and
some might argue inefficient but RW locks (instead of the veritable
spinlock) protecting the global list of ADAPTERs can help a bit.
I will refrain from endorsing the ever popular ‘hijack’ NDIS’s own PDO for
the miniport or other bits of NDIS-internals-aware suggestions. I’m sure
they will surface, however. If you really need to get every ounce of
performance out of a DeviceIOControl() interface to an NDIS Miniport driver,
you should keep reading through (1) above until you settle on ‘custom
protocol’ as the solution.
Good luck,
Dave Cattley
Consulting Engineer
Systems Software Development
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of S?ren Dreijer
Sent: Saturday, January 07, 2006 4:04 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] NDIS drivers and device extensions
According to MSDN, NDIS drivers that use NdisMRegisterDevice cannot use the
device extension field in the device object.
What should one use instead then? I’m reluctant to use a global variable to
store the necessary data…
The thing is that I want to share data between some of the IOCTL dispatch
routines and the MiniportSendPackets() function. I could have done this
easily if I had access to the device extension field, but unfortunately I do
not.
Oh, and this is a miniport driver, if you hadn’t spotted that yet ![:slight_smile: :slight_smile:](/images/emoji/twitter/slight_smile.png?v=12)
–S?ren
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@msn.com To unsubscribe
send a blank email to xxxxx@lists.osr.com