getting NDIS miniport adapter context from DEVICE_OBJECT

Is it possible and/or supported to be able to get the NDIS miniport
adapter context from a DEVICE_OBJECT?

I want to set up a callback in my miniport driver, and the only
parameter I can be called back with is the device object, but I need to
get some state information from the adapter context.

Thanks

James

Put all of your Miniport AdapterContext objects into a global linked list
protected by a RW lock.

Keep the value of the DEVICE_OBJECT in a field in the AdapterContext.

When your callback comes, grab the ‘read’ role of the RW lock, scan the list
for the AdapterContext with the matching DEVICE_OBJECT, drop the lock, and
go.

MiniportInitialize() enrolls the AdapterContext in the list protected by the
‘write’ role of the lock.

MiniportHalt() de-enrols the AdapterContext from the list protected by the
‘write’ role of the lock.

But I’m sure you could figure out some reverse engineered way to wander from
the PDEVICE_OBJECT through the DEVICE_EXTENSION into a miniport block and
ultimately to an adapter context. Unless you have some incredibly large
number of miniports, the list scan time will be mininimal.

This callback does not happen 5K times a second does it?

And why can’t you register an arbitrary pointer with whatever service you
are using?

Good Luck,
Dave Cattley

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of James Harper
Sent: Friday, June 19, 2009 7:16 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] getting NDIS miniport adapter context from DEVICE_OBJECT

Is it possible and/or supported to be able to get the NDIS miniport
adapter context from a DEVICE_OBJECT?

I want to set up a callback in my miniport driver, and the only
parameter I can be called back with is the device object, but I need to
get some state information from the adapter context.

Thanks

James


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer