This documentation is archived and is not being maintained.

NdisIMGetDeviceContext function

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

NdisIMGetDeviceContext allows an NDIS intermediate driver's MiniportInitialize function to access the device context area allocated by its ProtocolBindAdapter function.


NDIS_HANDLE NdisIMGetDeviceContext(
  _In_ NDIS_HANDLE MiniportAdapterHandle


MiniportAdapterHandle [in]

Specifies the handle input to MiniportInitialize.

Return value

NdisIMGetDeviceContext returns access to the device context area for the virtual NIC identified by MiniportAdapterHandle, or it returns NULL if the driver's ProtocolBindAdapter function did not allocate such a device context area.


An NDIS intermediate driver's MiniportInitialize function calls NdisIMGetDeviceContext to access the device context area for the virtual NIC it is initializing. Usually, the memory for such an area is provided by the intermediate driver's ProtocolBindAdapter function, which calls NdisIMInitializeDeviceInstanceEx with a pointer to this area, thereby causing the driver's MiniportInitialize function to be called. However, an intermediate driver is not required to have such a context area.

On return from NdisIMGetDeviceContext, MiniportInitialize sets up the driver-defined state for the virtual NIC with whatever information the intermediate driver writer intends to be useful to still higher level protocols that bind themselves subsequently to its virtual NIC.

Still higher level NDIS protocols bound to the same virtual NIC subsequently can access this device context area by calling NdisIMGetBindingContext from their ProtocolBindAdapter functions.

Callers of NdisIMGetDeviceContext must be running at IRQL <= DISPATCH_LEVEL. Typically, NDIS calls MiniportInitialize functions at IRQL = PASSIVE_LEVEL.


Target platform



Not supported for NDIS 6.0 drivers in Windows Vista. Supported for NDIS 5.1 drivers in Windows Vista and Windows XP.


Ndis.h (include Ndis.h)




<= DISPATCH_LEVEL (See Remarks section)

See also




Send comments about this topic to Microsoft