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 UnsupportedOpNumException(); } }
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); } } }