| WORD WNetAddConnection(szNetPath, szPassword, szLocalName) | |||
| LPSTR szNetPath; | |||
| LPSTR szPassword; | |||
| LPSTR szLocalName; |
The WNetAddConnection function redirects a local device (either a disk drive or a printer port) to a shared device on a remote server.
szNetPath
Points to a null-terminated string specifying the shared device or remote server.
szPassword
Points to a null-terminated string specifying the network password for the specified device or server.
szLocalName
Points to a null-terminated string specifying the local drive or device to be redirected. All szLocalName strings 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 values.
| Value | Meaning |
| WN_ACCESS_DENIED | Security violation. |
| WN_ALREADY_CONNECTED | Local device already connected to a remote resource. |
| WN_BAD_LOCALNAME | Invalid local device name. |
| WN_BAD_NETNAME | Invalid network resource name. |
| WN_BAD_PASSWORD | Invalid password. |
| WN_BAD_POINTER | Invalid pointer. |
| WN_NET_ERROR | Network error. |
| WN_NOT_SUPPORTED | Function not supported. |
| WN_OUT_OF_MEMORY | Out of memory. |
| WN_SUCCESS | Success. |
The export ordinal for this function is 17.