Errors

To be consistent with Windows 3.1, the functions continue to return error codes. However, they also set the last error so GetLastError can also be used when the return code is not WN_SUCCESS.

The Windows 3.1 WinNet WN_ xxx error symbols have been retained. However, their values are mapped to the corresponding error in the Win32 error range. The mappings are as follows:


#define WN_ACCESS_DENIED        ERROR_ACCESS_DENIED
#define WN_ALREADY_CONNECTED    ERROR_ALREADY_ASSIGNED
#define WN_BAD_HANDLE           ERROR_INVALID_HANDLE
#define WN_BAD_LOCALNAME        ERROR_BAD_DEVICE
#define WN_BAD_NETNAME          ERROR_BAD_NET_NAME
#define WN_BAD_PASSWORD         ERROR_INVALID_PASSWORD
#define WN_BAD_POINTER          ERROR_INVALID_ADDRESS
#define WN_BAD_PROFILE          ERROR_BAD_PROFILE
#define WN_BAD_PROVIDER         ERROR_BAD_PROVIDER
#define WN_BAD_USER             ERROR_BAD_USERNAME
#define WN_BAD_VALUE            ERROR_INVALID_PARAMETER
#define WN_CANCEL               ERROR_OPERATION_ABORTED
#define WN_CANNOT_OPEN_PROFILE  ERROR_CANNOT_OPEN_PROFILE
#define WN_CONNECTION_CLOSED    ERROR_CONNECTION_UNAVAIL
#define WN_DEVICE_ERROR         ERROR_GEN_FAILURE
#define WN_DEVICE_IN_USE        ERROR_DEVICE_IN_USE
#define WN_EXTENDED_ERROR       ERROR_EXTENDED_ERROR
#define WN_FUNCTION_BUSY        ERROR_BUSY
#define WN_MORE_DATA            ERROR_MORE_DATA
#define WN_NO_ERROR             NO_ERROR
#define WN_NO_MORE_ENTRIES      ERROR_NO_MORE_ITEMS
#define WN_NO_NET_OR_BAD_PATH   ERROR_NO_NET_OR_BAD_PATH
#define WN_NO_NETWORK           ERROR_NO_NETWORK
#define WN_NOT_AUTHENTICATED    ERROR_NETWORK_ACCESS_DENIED
#define WN_NOT_CONNECTED        ERROR_NOT_CONNECTED
#define WN_NOT_CONTAINER        ERROR_NOT_CONTAINER
#define WN_NOT_LOGGED_ON        ERROR_NOT_LOGGED_ON
#define WN_NOT_SUPPORTED        ERROR_NOT_SUPPORTED
#define WN_OPEN_FILES           ERROR_OPEN_FILES
#define WN_OUT_OF_MEMORY        ERROR_NOT_ENOUGH_MEMORY
#define WN_RETRY                ERROR_RETRY
#define WN_SUCCESS              NO_ERROR
#define WN_WINDOWS_ERROR        ERROR_UNEXP_NET_ERR