The UnenableRouter function decrements the reference count that tracks the number of enable-IP-forwarding requests. When this reference count reaches zero, UneableRouter turns off IP forwarding on the local computer.
DWORD WINAPI UnenableRouter( OVERLAPPED *pOverlapped, LPDWORD lpdwEnableCount OPTIONAL );
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.
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 IP-forwarding reference count for another process. Also, if IP forwarding was enabled by a given process, it cannot be disabled by a different process.
If the process that calls EnableRouter terminates without calling UnenableRouter, the system will decrement the IP-forwarding reference count 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.