NdfRepairIncident function (ndfapi.h)

The NdfRepairIncident function repairs an incident without displaying a user interface.


HRESULT NdfRepairIncident(
  [in] NDFHANDLE    Handle,
  [in] RepairInfoEx *RepairEx,
       DWORD        dwWait


[in] Handle


Handle to the Network Diagnostics Framework incident. This handle should match the handle passed to NdfDiagnoseIncident.

[in] RepairEx

Type: RepairInfoEx*

A structure (obtained from NdfDiagnoseIncident) which indicates the particular repair to be performed.

Memory allocated to these structures should later be freed. For an example of how to do this, see the Microsoft Windows Network Diagnostics Samples.



The length of time, in milliseconds, to wait before terminating the diagnostic routine. INFINITE may be passed to this parameter if no timeout is desired.

Return value

Possible return values include, but are not limited to, the following.

Return code Description
Repair succeeded.
The repair executed successfully, but NDF validation still found a connectivity problem. If this value is returned, the session should be closed by calling NdfCloseIncident and another session should be created to continue the diagnosis.
The NDF incident handle is not valid.
The repair operation has terminated because it has taken longer than the time-out specified in dwWait.

Other failure codes are returned if the repair failed to execute. In that case, the client can call NdfRepairIncident again with a different repair.


NdfRepairIncident can only be called when NdfDiagnoseIncident is used for diagnostics. This is typically the case in scenarios where no user interface is shown, or where the standard Windows experience is not being used (as with Media Center and embedded applications). NdfRepairIncident should not be called when NdfExecuteDiagnosis is used.

Before using this API, an application must call an incident creation function such as NdfCreateWebIncident to begin the NDF diagnostics process. The application then calls NdfDiagnoseIncident to diagnose the issue. If the diagnostics process identifies some possible repairs, the application can call NdfRepairIncident to repair the problem without displaying a user interface. NdfCancelIncident can optionally be called from a separate thread if the application wants to cancel an ongoing NdfRepairIncident call. Finally, the application calls NdfCloseIncident.


Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header ndfapi.h
Library Ndfapi.lib
DLL Ndfapi.dll

See also