Beispiel #1
0
        public override byte[] GetResponseBytes(ushort opNum, byte[] requestBytes)
        {
            switch ((ServerServiceOpName)opNum)
            {
            case ServerServiceOpName.NetrShareEnum:
            {
                NetrShareEnumRequest  request  = new NetrShareEnumRequest(requestBytes);
                NetrShareEnumResponse response = GetNetrShareEnumResponse(request);
                return(response.GetBytes());
            }

            case ServerServiceOpName.NetrShareGetInfo:
            {
                NetrShareGetInfoRequest  request  = new NetrShareGetInfoRequest(requestBytes);
                NetrShareGetInfoResponse response = GetNetrShareGetInfoResponse(request);
                return(response.GetBytes());
            }

            case ServerServiceOpName.NetrServerGetInfo:
            {
                NetrServerGetInfoRequest  request  = new NetrServerGetInfoRequest(requestBytes);
                NetrServerGetInfoResponse response = GetNetrWkstaGetInfoResponse(request);
                return(response.GetBytes());
            }

            default:
                throw new NotImplementedException();
            }
        }
Beispiel #2
0
        public NetrServerGetInfoResponse GetNetrWkstaGetInfoResponse(NetrServerGetInfoRequest request)
        {
            NetrServerGetInfoResponse response = new NetrServerGetInfoResponse();

            if (request.Level == 100)
            {
                ServerInfo100 info = new ServerInfo100();
                info.PlatformID       = m_platformID;
                info.ServerName.Value = m_serverName;
                response.InfoStruct   = new ServerInfo(info);
            }
            else if (request.Level == 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);
            }
            else
            {
                throw new NotImplementedException();
            }
            response.Result = Win32Error.ERROR_SUCCESS;
            return(response);
        }
Beispiel #3
0
        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);
            }
            }
        }
Beispiel #4
0
        public NetrServerGetInfoResponse GetNetrWkstaGetInfoResponse(NetrServerGetInfoRequest request)
        {
            NetrServerGetInfoResponse response = new NetrServerGetInfoResponse();

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

            case 101:
            {
                ServerInfo101 info = new ServerInfo101
                {
                    PlatformID = m_platformID,
                    ServerName =
                    {
                        Value = m_serverName
                    },
                    VerMajor = m_verMajor,
                    VerMinor = m_verMinor,
                    Type     = m_serverType,
                    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);
            }
            }
        }