Пример #1
0
 public void Add(ShareInfo0Entry entry)
 {
     if (Entries == null)
     {
         Entries = new NDRConformantArray <ShareInfo0Entry>();
     }
     Entries.Add(entry);
 }
Пример #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);
            }
            }
        }
Пример #3
0
        public void Read(NDRParser parser)
        {
            parser.BeginStructure(); // SHARE_INFO Union
            Level = parser.ReadUInt32();
            switch (Level)
            {
            case 100:
                ShareInfo0Entry info0 = null;
                parser.ReadEmbeddedStructureFullPointer <ShareInfo0Entry>(ref info0);
                Info = info0;
                break;

            case 101:
                ShareInfo1Entry info1 = null;
                parser.ReadEmbeddedStructureFullPointer <ShareInfo1Entry>(ref info1);
                Info = info1;
                break;

            default:
                throw new NotImplementedException();
            }
            parser.EndStructure(); // SHARE_INFO Union
        }