WNetRestoreConnection

  WORD WNetRestoreConnection(hwndParent, lpszDevice)    
  HWND hwndParent;    
  LPSTR lpszDevice;    

The WNetRestoreConnection function reconnects one or more permanently connected devices.

Parameters

hwndParent

Identifies the window to be used as the owner of any dialog or message boxes the network driver creates.

lpszDevice

Points to a null-terminated device name, such as for a disk or a printer. If this parameter is NULL, all devices are to be reconnected. If this parameter is 1, WNetRestoreConnection performs any initialization actions required by the driver and then reconnects all devices.

File Manager calls this function with the 1 value exactly once during its initialization, and does not make any calls with the NULL value.

Return Value

The return value is one of the following values.

Value Meaning

WN_ACCESS_DENIED Permission violation.
WN_ALREADY_CONNECTED The device is already connected.
WN_BAD_PASSWORD The user supplied an inaccurate password.
WN_CANCELLED The user cancelled the reconnection when prompted.
WN_CONTINUE A failure occurred, but the network driver has already reported the error to the user, and File Manager should not post a message box. The device is not valid and the File Manager should not access it.
WN_NET_ERROR A network error has occurred.
WN_NOT_SUPPORTED The driver does not support permanant connections.
WN_OUT_OF_MEMORY Out of memory.
WN_SUCCESS The device is reconnected.

Comments

The export ordinal for this function is 23.

During system initialization, the return value is ignored and the network driver should report all errors to the user.

If a connection exists, this function should not override it.

If a connection cannot be reestablished, an error is returned, but the device is not disconnected (that is, the connection is still remembered).

If this function is not supported, a minimum level of functionality will be implemented by Windows, which will read a list of connections and attempt to connect to them using WNetAddConnection.

See Also

WNetAddConnection