コード例 #1
0
ファイル: ServerService.cs プロジェクト: gonsovsky/dnSvc
        public NetrServerGetInfoResponse GetNetrWkstaGetInfoResponse(NetrServerGetInfoRequest request)
        {
            NetrServerGetInfoResponse response = new NetrServerGetInfoResponse();

            switch (request.Level)
            {
            case 100:
            {
                ServerInfo100 info = new ServerInfo100();
                info.PlatformID       = m_platformID;
                info.ServerName.Value = m_serverName;
                response.InfoStruct   = new ServerInfo(info);
                response.Result       = Win32Error.ERROR_SUCCESS;
                return(response);
            }

            case 101:
            {
                ServerInfo101 info = new ServerInfo101();
                info.PlatformID       = m_platformID;
                info.ServerName.Value = m_serverName;
                info.VerMajor         = m_verMajor;
                info.VerMinor         = m_verMinor;
                info.Type             = m_serverType;
                info.Comment.Value    = String.Empty;
                response.InfoStruct   = new ServerInfo(info);
                response.Result       = Win32Error.ERROR_SUCCESS;
                return(response);
            }

            case 102:
            case 103:
            case 502:
            case 503:
            {
                response.InfoStruct = new ServerInfo(request.Level);
                response.Result     = Win32Error.ERROR_NOT_SUPPORTED;
                return(response);
            }

            default:
            {
                response.InfoStruct = new ServerInfo(request.Level);
                response.Result     = Win32Error.ERROR_INVALID_LEVEL;
                return(response);
            }
            }
        }
コード例 #2
0
ファイル: ServerInfo.cs プロジェクト: gonsovsky/dnSvc
        public void Read(NDRParser parser)
        {
            parser.BeginStructure(); // SERVER_INFO Union
            Level = parser.ReadUInt32();
            switch (Level)
            {
            case 100:
                ServerInfo100 info100 = null;
                parser.ReadEmbeddedStructureFullPointer <ServerInfo100>(ref info100);
                Info = info100;
                break;

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

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