EnableRouter function (iphlpapi.h)

The EnableRouter function turns on IPv4 forwarding on the local computer. EnableRouter also increments a reference count that tracks the number of requests to enable IPv4 forwarding.

Syntax

IPHLPAPI_DLL_LINKAGE DWORD EnableRouter(
  HANDLE     *pHandle,
  OVERLAPPED *pOverlapped
);

Parameters

pHandle

A pointer to a handle. This parameter is currently unused.

pOverlapped

A pointer to an OVERLAPPED structure. Except for the hEvent member, all members of this structure should be set to zero. The hEvent member should contain a handle to a valid event object. Use the CreateEvent function to create this event object.

Return value

If the EnableRouter function succeeds, the return value is ERROR_IO_PENDING.

If the function fails, use FormatMessage to obtain the message string for the returned error.

Return code Description
ERROR_INVALID_PARAMETER
One of the parameters is invalid. This error is returned if the pOverlapped parameter is NULL.
Other
Use FormatMessage to obtain the message string for the returned error.

Remarks

The EnableRouter function is specific to IPv4 forwarding. If the process that calls EnableRouter terminates without calling UnenableRouter, the system decrements the reference count that tracks the number of requests to enable IPv4 forwarding as though the process had called UnenableRouter.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header iphlpapi.h
Library Iphlpapi.lib
DLL Iphlpapi.dll

See also

CreateEvent

IP Helper Function Reference

IP Helper Start Page

OVERLAPPED

UnenableRouter