UINT WNetAddConnection(lpszNetPath, lpszPassword, lpszLocalName) | |||||
LPSTR lpszNetPath; | /* address of network device | */ | |||
LPSTR lpszPassword; | /* address of password | */ | |||
LPSTR lpszLocalName; | /* address of local device | */ |
The WNetAddConnection function redirects the specified local device (either a disk drive or a printer port) to the given shared device or remote server.
lpszNetPath
Points to a null-terminated string specifying the shared device or remote server.
lpszPassword
Points to a null-terminated string specifying the network password for the given device or server.
lpszLocalName
Points to a null-terminated string specifying the local drive or device to be redirected. All lpszLocalName strings (such as LPT1) are case-independent. Only the drive names A through Z and the device names LPT1 through LPT3 are used.
The return value is one of the following:
Value | Meaning |
WN_SUCCESS | The function was successful. |
WN_NOT_SUPPORTED | The function was not supported. |
WN_OUT_OF_MEMORY | The system was out of memory. |
WN_NET_ERROR | An error occurred on the network. |
WN_BAD_POINTER | The pointer was invalid. |
WN_BAD_NETNAME | The network resource name was invalid. |
WN_BAD_LOCALNAME | The local device name was invalid. |
WN_BAD_PASSWORD | The password was invalid. |
WN_ACCESS_DENIED | A security violation occurred. |
WN_ALREADY_CONNECTED | The local device was already connected to a remote resource. |