// ndis.h
MINIPORT_RESTART MiniportRestart;
NDIS_STATUS MiniportRestart(
[in] NDIS_HANDLE MiniportAdapterContext,
PNDIS_MINIPORT_RESTART_PARAMETERS RestartParameters
)
{...}
View the official Windows Driver Kit DDI referenceNo description available.
The MiniportRestart function initiates a restart request for a miniport adapter that is paused.
Note You must declare the function by using the MINIPORT_RESTART type. For more information, see the following Examples section.
MiniportAdapterContext [in]A handle to a context area that the miniport driver allocated in its MiniportInitializeEx function. The miniport driver uses this context area to maintain state information for a miniport adapter.
RestartParametersA pointer to an NDIS_MINIPORT_RESTART_PARAMETERS structure that defines the restart parameters for the miniport adapter.
MiniportRestart returns one of the following status values:
| Return code | Description |
|---|---|
| NDIS_STATUS_SUCCESS | MiniportRestart successfully restarted the flow of network data through the miniport adapter. |
| NDIS_STATUS_PENDING | MiniportRestart did not complete the restart operation and the operation will be completed asynchronously. The miniport driver must call the NdisMRestartComplete function when the operation is complete. |
| NDIS_STATUS_RESOURCES | MiniportRestart failed because of insufficient resources. |
| NDIS_STATUS_FAILURE | None of the preceding status values applies. In this situation, the driver should call the NdisWriteErrorLogEntry function with parameters that specify the reason for the failure. |
A driver specifies the MiniportRestart entry point when it calls the NdisMRegisterMiniportDriver function.
The miniport adapter that is specified by the MiniportAdapterContext parameter enters the Restarting state when NDIS calls MiniportRestart.
When NDIS calls MiniportRestart, a miniport driver:
If a miniport driver modifies the list of restart attributes, the miniport driver:
NDIS does not initiate other Plug and Play (PnP) operations for the miniport adapter, such as halt, initialize, power change, or a pause request, until the restart operation is complete.
After the miniport driver successfully restarts the send and receive operations, it must complete the restart operation. If the driver returns NDIS_STATUS_SUCCESS from MiniportRestart, the restart operation is complete. If the driver returns NDIS_STATUS_PENDING, it can continue restart operations. The restart operation is complete after the driver calls the NdisMRestartComplete function. After the restart operation is complete, the miniport adapter is in the Running state.
The miniport driver can resume indicating received packets for the miniport adapter immediately after NDIS calls MiniportRestart and before the driver calls NdisMRestartComplete. The miniport driver should be ready to accept send requests after the driver completes the restart request.
If the miniport driver does not restart the send and receive operations, the driver must return an appropriate failure status from MiniportRestart. In this situation, the driver must stop any send or receive operations that were started and then return to the Paused state.
NDIS calls MiniportRestart at IRQL = PASSIVE_LEVEL.
To define a MiniportRestart 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 MiniportRestart function that is named "MyRestart", use the MINIPORT_RESTART type as shown in this code example:
MINIPORT_RESTART MyRestart;
Then, implement your function as follows:
_Use_decl_annotations_
NDIS_STATUS
MyRestart(
NDIS_HANDLE MiniportAdapterContext,
PNDIS_MINIPORT_RESTART_PARAMETERS RestartParameters
)
{...}
The MINIPORT_RESTART 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_RESTART 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.
NDIS_MINIPORT_RESTART_PARAMETERS
NDIS_RESTART_GENERAL_ATTRIBUTES
NdisAllocateMemoryWithTagPriority
OID_GEN_MINIPORT_RESTART_ATTRIBUTES