Share via


UnenableRouter (Compact 2013)

3/26/2014

This function decrements the reference count that tracks the number of requests to enable IPv4 forwarding. When this reference count reaches zero, UnenableRouter turns off IPv4 forwarding on the local device.

Syntax

DWORD WINAPI UnenableRouter(
             OVERLAPPED* pOverlapped,
  __out_opt  LPDWORD lpdwEnableCount
);

Parameters

  • pOverlapped
    A pointer to an OVERLAPPED structure. This structure should be the same as the one used in the call to the EnableRouter function.
  • lpdwEnableCount
    An optional pointer to a DWORD variable. This variable receives the number of references remaining.

Return Value

If the function succeeds, the return value is NO_ERROR.

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

Remarks

The UnenableRouter function is specific to IPv4 forwarding. Each call that a process makes to UnenableRouter must correspond to a previous call to EnableRouter by the same process. The system returns an error on extraneous calls to UnenableRouter. As a result, a given process cannot decrement the reference count that tracks the number of requests for enabling IPv4 forwarding for another process. Also, if IPv4 forwarding was enabled by a given process, it cannot be disabled by a different process.

It is not possible to accurately determine the reference count that tracks the number of requests for enabling IPv4 forwarding because there might be other outstanding EnableRouter requests. So the value returned for the lpdwEnableCount parmameter is always a large count equal to ULONG_MAX/2.

If the process that calls EnableRouter terminates without calling UnenableRouter, the system decrements the reference count that tracks requests to enable IPv4 forwarding as if the process had called UnenableRouter.

After calling the UnenableRouter, use the CloseHandle call to close the handle to the event object in the OVERLAPPED structure.

See Also

Reference

IP Helper Functions
EnableRouter

Other Resources

IP Helper
CloseHandle
OVERLAPPED