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.
 

Syntax


MINIPORT_START_DEVICE MiniportStartDevice;

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

Parameters

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
NDIS_STATUS_SUCCESS

The miniport driver handled the start device request successfully.

NDIS_STATUS_RESOURCES

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

NDIS_STATUS_FAILURE

MiniportFilterResourceRequirements failed for reasons other than insufficient resources.

 

Remarks

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.

Examples

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:


MINIPORT_START_DEVICE MyStartDevice;

Then, implement your function as follows:


_Use_decl_annotations_
NDIS_STATUS
 MyStartDevice(
    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.

Requirements

Target platform

Version

Supported in NDIS 6.0 and later.

Header

Ndis.h (include Ndis.h)

IRQL

PASSIVE_LEVEL

See also

IRP_MN_START_DEVICE
MiniportAddDevice
MiniportFilterResourceRequirements
MiniportInitializeEx
NDIS_MINIPORT_PNP_CHARACTERISTICS

 

 

Send comments about this topic to Microsoft

Show: