첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
본 블로그는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 블로그 콘텐츠 향상을 위해 쓰여집니다.

728x90
반응형
728x170
using System.Runtime.InteropServices;

#region WNET 연결 추가하기 2 - WNetAddConnection2(networkResource, password, userName, flag)

/// <summary>
/// WNET 연결 추가하기 2
/// </summary>
/// <param name="networkResource">네트워크 리소스</param>
/// <param name="password">패스워드</param>
/// <param name="userName">사용자명</param>
/// <param name="flag">플래그</param>
/// <returns>처리 결과</returns>
[DllImport("mpr")]
private static extern int WNetAddConnection2(NetworkResource networkResource, string password, string userName, int flag);

#endregion

/// <summary>
/// 리소스 범위
/// </summary>
public enum ResourceScope : int
{
    /// <summary>
    /// 연결시
    /// </summary>
    Connected = 1,

    /// <summary>
    /// 글로벌 네트워크
    /// </summary>
    GlobalNetwork,

    /// <summary>
    /// 기억시
    /// </summary>
    Remembered,

    /// <summary>
    /// 최근
    /// </summary>
    Recent,

    /// <summary>
    /// 컨텍스트
    /// </summary>
    Context
};

/// <summary>
/// 리소스 타입
/// </summary>
public enum ResourceType : int
{
    /// <summary>
    /// 아무거나
    /// </summary>
    Any = 0,

    /// <summary>
    /// 디스크
    /// </summary>
    Disk = 1,

    /// <summary>
    /// 인쇄
    /// </summary>
    Print = 2,

    /// <summary>
    /// 예약
    /// </summary>
    Reserved = 8,
}

/// <summary>
/// 리소스 디스플레이 타입
/// </summary>
public enum ResourceDisplayType : int
{
    /// <summary>
    /// 일반
    /// </summary>
    Generic = 0x0,

    /// <summary>
    /// 도메인
    /// </summary>
    Domain = 0x01,

    /// <summary>
    /// 서버
    /// </summary>
    Server = 0x02,

    /// <summary>
    /// 공유
    /// </summary>
    Share = 0x03,

    /// <summary>
    /// 파일
    /// </summary>
    File = 0x04,

    /// <summary>
    /// 그룹
    /// </summary>
    Group = 0x05,

    /// <summary>
    /// 네트워크
    /// </summary>
    Network = 0x06,

    /// <summary>
    /// 루트
    /// </summary>
    Root = 0x07,

    /// <summary>
    /// 공유 관리
    /// </summary>
    ShareAdmin = 0x08,

    /// <summary>
    /// 디렉토리
    /// </summary>
    Directory = 0x09,

    /// <summary>
    /// 트리
    /// </summary>
    Tree = 0x0a,

    /// <summary>
    /// NDS 컨테이너
    /// </summary>
    NDSContainer = 0x0b
}

/// <summary>
/// 네트워크 리소스
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public class NetworkResource
{
    //////////////////////////////////////////////////////////////////////////////////////////////////// Field
    ////////////////////////////////////////////////////////////////////////////////////////// Public

    #region Field

    /// <summary>
    /// 범위
    /// </summary>
    public ResourceScope Scope;

    /// <summary>
    /// 리소스 타입
    /// </summary>
    public ResourceType ResourceType;

    /// <summary>
    /// 디스플레이 타입
    /// </summary>
    public ResourceDisplayType DisplayType;

    /// <summary>
    /// 용법
    /// </summary>
    public int Usage;

    /// <summary>
    /// 지역명
    /// </summary>
    public string LocalName;

    /// <summary>
    /// 원격명
    /// </summary>
    public string RemoteName;

    /// <summary>
    /// 주석
    /// </summary>
    public string Comment;

    /// <summary>
    /// 공급자
    /// </summary>
    public string Provider;

    #endregion
}
728x90
반응형
그리드형
Posted by 사용자 icodebroker
TAG , ,

댓글을 달아 주세요