public NetrShareGetInfoResponse GetNetrShareGetInfoResponse(NetrShareGetInfoRequest request)
        {
            int shareIndex = IndexOfShare(request.NetName);

            NetrShareGetInfoResponse response = new NetrShareGetInfoResponse();

            if (shareIndex == -1)
            {
                response.InfoStruct = new ShareInfo(request.Level);
                response.Result     = Win32Error.NERR_NetNameNotFound;
                return(response);
            }

            if (request.Level == 0)
            {
                ShareInfo0Entry info = new ShareInfo0Entry(m_shares[shareIndex]);
                response.InfoStruct = new ShareInfo(info);
            }
            else if (request.Level == 1)
            {
                ShareInfo1Entry info = new ShareInfo1Entry(m_shares[shareIndex], new ShareTypeExtended(ShareType.DiskDrive));
                response.InfoStruct = new ShareInfo(info);
            }
            else if (request.Level == 2)
            {
                ShareInfo2Entry info = new ShareInfo2Entry(m_shares[shareIndex], new ShareTypeExtended(ShareType.DiskDrive));
                response.InfoStruct = new ShareInfo(info);
            }
            else
            {
                throw new NotImplementedException();
            }
            response.Result = Win32Error.ERROR_SUCCESS;
            return(response);
        }
Exemple #2
0
        public NetrShareGetInfoResponse GetNetrShareGetInfoResponse(NetrShareGetInfoRequest request)
        {
            int shareIndex = IndexOfShare(request.NetName);

            NetrShareGetInfoResponse response = new NetrShareGetInfoResponse();

            if (shareIndex == -1)
            {
                response.InfoStruct = new ShareInfo(request.Level);
                response.Result     = Win32Error.NERR_NetNameNotFound;
                return(response);
            }

            switch (request.Level)
            {
            case 0:
            {
                ShareInfo0Entry info = new ShareInfo0Entry(m_shares[shareIndex]);
                response.InfoStruct = new ShareInfo(info);
                response.Result     = Win32Error.ERROR_SUCCESS;
                return(response);
            }

            case 1:
            {
                ShareInfo1Entry info = new ShareInfo1Entry(m_shares[shareIndex], new ShareTypeExtended(ShareType.DiskDrive));
                response.InfoStruct = new ShareInfo(info);
                response.Result     = Win32Error.ERROR_SUCCESS;
                return(response);
            }

            case 2:
            {
                ShareInfo2Entry info = new ShareInfo2Entry(m_shares[shareIndex], new ShareTypeExtended(ShareType.DiskDrive));
                response.InfoStruct = new ShareInfo(info);
                response.Result     = Win32Error.ERROR_SUCCESS;
                return(response);
            }

            case 501:
            case 502:
            case 503:
            case 1005:
            {
                response.InfoStruct = new ShareInfo(request.Level);
                response.Result     = Win32Error.ERROR_NOT_SUPPORTED;
                return(response);
            }

            default:
            {
                response.InfoStruct = new ShareInfo(request.Level);
                response.Result     = Win32Error.ERROR_INVALID_LEVEL;
                return(response);
            }
            }
        }