Exemplo n.º 1
0
        public override byte[] GetResponseBytes(ushort opNum, byte[] requestBytes)
        {
            switch ((WorkstationServiceOpName)opNum)
            {
            case WorkstationServiceOpName.NetrWkstaGetInfo:
                NetrWkstaGetInfoRequest  request  = new NetrWkstaGetInfoRequest(requestBytes);
                NetrWkstaGetInfoResponse response = GetNetrWkstaGetInfoResponse(request);
                return(response.GetBytes());

            default:
                throw new UnsupportedOpNumException();
            }
        }
Exemplo n.º 2
0
        public NetrWkstaGetInfoResponse GetNetrWkstaGetInfoResponse(NetrWkstaGetInfoRequest request)
        {
            NetrWkstaGetInfoResponse response = new NetrWkstaGetInfoResponse();

            switch (request.Level)
            {
            case 100:
            {
                WorkstationInfo100 info = new WorkstationInfo100();
                info.PlatformID         = m_platformID;
                info.ComputerName.Value = m_computerName;
                info.LanGroup.Value     = m_lanGroup;
                info.VerMajor           = m_verMajor;
                info.VerMinor           = m_verMinor;
                response.WkstaInfo      = new WorkstationInfo(info);
                response.Result         = Win32Error.ERROR_SUCCESS;
                return(response);
            }

            case 101:
            {
                WorkstationInfo101 info = new WorkstationInfo101();
                info.PlatformID         = m_platformID;
                info.ComputerName.Value = m_computerName;
                info.LanGroup.Value     = m_lanGroup;
                info.VerMajor           = m_verMajor;
                info.VerMinor           = m_verMinor;
                info.LanRoot.Value      = m_lanGroup;
                response.WkstaInfo      = new WorkstationInfo(info);
                response.Result         = Win32Error.ERROR_SUCCESS;
                return(response);
            }

            case 102:
            case 502:
            {
                response.WkstaInfo = new WorkstationInfo(request.Level);
                response.Result    = Win32Error.ERROR_NOT_SUPPORTED;
                return(response);
            }

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