MINIPORT_START_DEVICE callback function

The MiniportStartDevice function enables a miniport driver to remove resources that it added in the MiniportFilterResourceRequirements function.

Note  You must declare the function by using the MINIPORT_START_DEVICE type. For more information, see the following Examples section.



NDIS_STATUS MiniportStartDevice(
  _In_ NDIS_HANDLE MiniportAddDeviceContext,
  _In_ PIRP        Irp
{ ... }


MiniportAddDeviceContext [in]

A handle for a driver-allocated context area that the miniport driver registered with NDIS in the MiniportAddDevice function.

Irp [in]

A pointer to an IRP_MN_START_DEVICE IRP.

Return value

MiniportStartDevice returns one of the following values:

Return codeDescription

The miniport driver handled the start device request successfully.


The miniport driver could not handle the start device request because of low resources.


MiniportFilterResourceRequirements failed for reasons other than insufficient resources.



MiniportStartDevice is an optional function. Miniport drivers that support MSI-X can specify an entry point for this function in the NDIS_MINIPORT_PNP_CHARACTERISTICS structure. When NDIS receives a request from the Plug and Play (PnP) manager to start a device, NDIS calls the MiniportStartDevice function, if any. If a miniport driver adds new resources in the MiniportFilterResourceRequirements function, it should provide a MiniportStartDevice function to remove the resources.

If a miniport driver modifies resources in such a way that an underlying bus driver cannot recognize the resources, the driver should provide a MiniportStartDevice function to remove the resources. An underlying bus driver might fail a start device request if it does not recognize resources that a miniport driver added in MiniportFilterResourceRequirements. If the miniport driver adds message interrupt resources, it must not remove them from MiniportStartDevice.

NDIS calls MiniportStartDevice before it forwards the start device request to the underlying drivers. If an underlying driver successfully completes the request, NDIS calls the MiniportInitializeEx function to initialize the miniport adapter.

NDIS calls MiniportStartDevice at IRQL = PASSIVE_LEVEL.


To define a MiniportStartDevice function, you must first provide a function declaration that identifies the type of function you're defining. Windows provides a set of function types for drivers. Declaring a function using the function types helps Code Analysis for Drivers, Static Driver Verifier (SDV), and other verification tools find errors, and it's a requirement for writing drivers for the Windows operating system.

For example, to define a MiniportStartDevice function that is named "MyStartDevice", use the MINIPORT_START_DEVICE type as shown in this code example:


Then, implement your function as follows:

    NDIS_HANDLE  MiniportAddDeviceContext,
    PIRP  Irp

The MINIPORT_START_DEVICE function type is defined in the Ndis.h header file. To more accurately identify errors when you run the code analysis tools, be sure to add the _Use_decl_annotations_ annotation to your function definition. The _Use_decl_annotations_ annotation ensures that the annotations that are applied to the MINIPORT_START_DEVICE function type in the header file are used. For more information about the requirements for function declarations, see Declaring Functions by Using Function Role Types for NDIS Drivers. For information about _Use_decl_annotations_, see Annotating Function Behavior.


Target platform


Supported in NDIS 6.0 and later.


Ndis.h (include Ndis.h)



See also




Send comments about this topic to Microsoft