Platform SDK: Internet Protocol Helper

CreateIpForwardEntry

The CreateIpForwardEntry function creates a route in the local computer's IP routing table.

DWORD CreateIpForwardEntry( 
  PMIB_IPFORWARDROW pRoute    // pointer to route information
);

Parameters

pRoute
Pointer to a MIB_IPFORWARDROW structure that specifies the information for the new route. The caller must specify values for all members of this structure. The caller must specify PROTO_IP_NETMGMT for the dwForwardProto member of MIB_IPFORWARDROW.

Return Values

If the function succeeds, the return value is NO_ERROR.

If the function fails, the return value is one of the following error codes.

Value Meaning
ERROR_INVALID_PARAMETER The pRoute parameter is NULL, or SetIpFowardEntry is unable to read from the memory pointed to by pRoute, or one of the members of the MIB_IPFORWARDROW structure is invalid.
ERROR_NOT_SUPPORTED The IP transport is not configured on the local computer.
Other Use FormatMessage to obtain the message string for the returned error.

Remarks

To modify an existing route in the IP routing table, use the SetIpForwardEntry function.

The caller should not specify a routing protocol — for example, PROTO_IP_OSPF — for the dwForwardProto member of the MIB_IPFORWARDROW structure. Routing protocol identifiers are used only to identify route information received through the specified routing protocol. For example, PROTO_IP_OSPF is used only to identify route information received through the OSPF routing protocol.

The dwForwardPolicy member of the MIB_IPFORWARDROW structure is currently unused. The caller should specify zero for this member.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 SP4 or later.
  Windows 95/98: Requires Windows 98.
  Header: Declared in Iphlpapi.h.
  Library: Use Iphlpapi.lib.

See Also

DeleteIpForwardEntry, MIB_IPFORWARDROW, SetIpForwardEntry