NPCancelConnection

Breaks a network connection.

DWORD NPCancelConnection(
  LPTSTR lpName,
  BOOL fForce
  DWORD dwFlags
  );
 
lpName
The name of either the redirected local device or the remote network resource to disconnect from. In the former case, only the redirection specified is broken. In the latter case, only the deviceless connection to the remote network resource is broken.
fForce
Used to indicate if the disconnect should be done forcefully in the event of open files or jobs on the connection. If FALSE is specified, the call will fail if there are open files or jobs. If set, CONNECT_REFCOUNT will not be set.
dwFlags
Additional information about the connection. Currently has the following bit value:
CONNECT_REFCOUNT The connection has a reference count on the session and, if set, the caller is requesting that the reference count be decremented. Otherwise the caller is requesting that the session be removed entirely for all users.

WN_NOT_CONNECTED lpName not a redirected device, or not currently connected to lpName.
WN_OPEN_FILES There are open files, and fForce was FALSE.