This function breaks an existing network connection. This function is equivalent to WNetCancelConnection2 with CONNECT_UPDATE_PROFILE set for dwFlags, i.e., the list of persistent connections will be updated so that Windows will no longer restore this connection.
DWORD WNetCancelConnection(
LPTSTR lpName,
BOOL fForce
);
WN_NOT_CONNECTED | lpName not a redirected (nor persistent) device, or not currently connected to lpName |
WN_CANNOT_OPEN_PROFILE | Unable to open the user profile to process persistent connections. |
WN_DEVICE_IN_USE | The device is in use by an active process and cannot be disconnected. |
WN_BAD_PROFILE | The user profile is in an incorrect format. |
WN_OPEN_FILES | there are open files and fForce was FALSE. |
WN_FUNCTION_BUSY | The MPR or NP is busy (possibly initializing). The caller should retry. |
WN_EXTENDED_ERROR | a network specific error occurred. WNetGetLastError should be called to obtain a description of the error. |