RtmDeleteRoute

[This is preliminary documentation and subject to change.]

The RtmDeleteRoute function deletes a route entry.

DWORD RtmDeleteRoute(
  HANDLE ClientHandle,    // handle that identifies client
  PVOID Route,            // pointer to route structure
  DWORD Flags,            // best route change status
  PVOID CurBestRoute      // pointer to new best route
);
 

Parameters

ClientHandle
Handle that identifies the client and therefore the routing protocol of the added/updated route. Obtain this handle by calling RtmRegisterClient.
Route
Pointer to a protocol-family-specific structure containing the new/updated route. The following fields will be used by the RTM to update the routing table:
RR_Network
The destination network number
RR_InterfaceID
The index of the interface through which the route was received.
RR_NextHopAddress
The network address of the next hop router.
Flags
A pointer to a set of flags that indicate the type of the change message, and what information was placed in the provided buffers. This parameter will be one of the following values.
Flags Values
RTM_NO_CHANGE Deleting the route did not affect the best route to any destination network, that is, another entry represents a route to the same destination network, and has a lower metric.
RTM_ROUTE_DELETED The route deleted was the only route available for a particular destination network.
RTM_ROUTE_CHANGED After this route was deleted, another route became the best route to a particular destination network. CurBestRoute points to the information for the new best route.

CurBestRoute
Pointer to a structure to receive the current best route information (if any). The type of the structure is specific to the protocol family (for example, IP or IPX).

This parameter is optional. If the caller specifies NULL for this parameter the current best route information is not returned.

Return Values

NO_ERROR
The route was added or updated successfully.
ERROR_INVALID_HANDLE
The client handle parameter is not a valid RTM handle.
ERROR_INVALID_PARAMETER
The route structure pointed to by the Route parameter contains a member value.
ERROR_NO_SUCH_ROUTE
No entries in the routing table match the parameters of the specified route.
ERROR_NO_SYSTEM_RESOURCES
Insufficient resources to perform the operation.

Remarks

The function generates a route-change message if the best route to a destination network has changed as the result of the deletion. However, the route change message is not sent to the client that makes this call. Instead, relevant information is returned by this function directly to that client.

QuickInfo

  Windows NT: Use version 5.0 and later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in rtm.h.
  Import Library: Link with rtm.lib.

See Also

RtmAddRoute, RtmDequeueRouteChangeMessage