This topic has not yet been rated - Rate this topic

UnenableRouter function

Applies to: desktop apps only

The UnenableRouter 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 computer.

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 [out, optional]

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 is not able to 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 since there might be other outstanding EnableRouter requests. So the value returned for the lpdwEnableCountparmameter 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 though 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.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Iphlpapi.h

Library

Iphlpapi.lib

DLL

Iphlpapi.dll

See also

IP Helper Start Page
IP Helper Function Reference
CloseHandle
EnableRouter
OVERLAPPED

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ