//函数WNetCancelConnection2的返回值
public enum WNetCancelConnection2ReturnCode
{
NO_ERROR=0, /*没有发生错误*/
ERROR_BAD_PROFILE=1206, /*The user profile is in an incorrect format. */
ERROR_CANNOT_OPEN_PROFILE=1205, /*The system is unable to open the user profile to process persistent connections. */
ERROR_DEVICE_IN_USE=2404, /*The device is in use by an active process and cannot be disconnected.*/
ERROR_EXTENDED_ERROR=1208, /*A network-specific error occurred. To obtain a description of the error, call the WNetGetLastError function.*/
ERROR_NOT_CONNECTED=2250, /*The name specified by the lpName parameter is not a redirected device, or the system is not currently connected to the device specified by the parameter. */
ERROR_OPEN_FILES=2401 /*There are open files, and the fForce parameter is FALSE.*/
}
//函数WNetAddConnection2的返回值
public enum WNetAddConnection2ReturnCode
{
NO_ERROR=0, /*没有发生错误*/
ERROR_ACCESS_DENIED=5, /*Access to the network resource was denied. */
ERROR_ALREADY_ASSIGNED=85, /*The local device specified by the lpLocalName member is already connected to a network resource. */
ERROR_BAD_DEV_TYPE=66, /*The type of local device and the type of network resource do not match. */
ERROR_BAD_DEVICE=1200, /*The value specified by lpLocalName is invalid. */
ERROR_BAD_NET_NAME=67, /*The value specified by the lpRemoteName member is not acceptable to any network resource provider, either because the resource name is invalid, or because the named resource cannot be located. */
ERROR_BAD_PROFILE=1206, /*The user profile is in an incorrect format.*/
ERROR_BAD_PROVIDER=1204, /*The value specified by the lpProvider member does not match any provider. */
ERROR_BUSY=170, /*The router or provider is busy, possibly initializing. The caller should retry. */
ERROR_CANCELLED=1223, /*The attempt to make the connection was cancelled by the user through a dialog box from one of the network resource providers, or by a called resource. */
ERROR_CANNOT_OPEN_PROFILE=1205, /*The system is unable to open the user profile to process persistent connections. */
ERROR_DEVICE_ALREADY_REMEMBERED=1202, /*An entry for the device specified by lpLocalName is already in the user profile. */
ERROR_EXTENDED_ERROR=1208, /*A network-specific error occurred. Call the WNetGetLastError function to obtain a description of the error. */
ERROR_INVALID_PASSWORD=86, /*The specified password is invalid and the CONNECT_INTERACTIVE flag is not set. */
ERROR_NO_NET_OR_BAD_PATH=1203, /*The operation cannot be performed because a network component is not started or because a specified name cannot be used. */
ERROR_NO_NETWORK=1222 /*The network is unavailable. */
}
//NETRESOURCE结构:The NETRESOURCE structure contains information about a network resource. The structure is returned during enumeration of network resources. NETRESOURCE is also specified when making or querying a network connection with calls to various Windows Networking functions.
public struct NetResource
{
public ResourceEnumerationScope dwScope;
public ResourceType dwType;
public ResourceDisplayType dwDisplayType;
public ResourceUsage dwUsage;
public string lpLocalName;
public string lpRemoteName;
public string lpComment;
public string lpProvider;
}