/// <summary>
        /// Deep copy constructor.
        /// </summary>
        public SmbTransTransactNmpipeSuccessResponsePacket(SmbTransTransactNmpipeSuccessResponsePacket packet)
            : base(packet)
        {
            this.InitDefaultValue();

            if (packet.transData.ReadData != null)
            {
                this.transData.ReadData = new byte[packet.transData.ReadData.Length];
                Array.Copy(packet.transData.ReadData, this.transData.ReadData, packet.transData.ReadData.Length);
            }
            else
            {
                this.transData.ReadData = new byte[0];
            }
        }
示例#2
0
        /// <summary>
        /// Deep copy constructor.
        /// </summary>
        public SmbTransTransactNmpipeSuccessResponsePacket(SmbTransTransactNmpipeSuccessResponsePacket packet)
            : base(packet)
        {
            this.InitDefaultValue();

            if (packet.transData.ReadData != null)
            {
                this.transData.ReadData = new byte[packet.transData.ReadData.Length];
                Array.Copy(packet.transData.ReadData, this.transData.ReadData, packet.transData.ReadData.Length);
            }
            else
            {
                this.transData.ReadData = new byte[0];
            }
        }
        /// <summary>
        /// server response the trans transact nmpipe request from client.
        /// </summary>
        /// <param name="open">the file open between server and client</param>
        /// <param name="data">The actual bytes</param>
        /// <param name = "available">indicates the number of bytes remaining to be read</param>
        public override void SendTransTransactNmpipeResponse(IFileServiceServerOpen open, byte[] data, int available)
        {
            CifsServerPerConnection connection = open.TreeConnect.Session.Connection as CifsServerPerConnection;

            foreach (SmbTransTransactNmpipeRequestPacket request in connection.PendingRequestTable)
            {
                if (request != null &&
                    request.SmbHeader.Uid == open.TreeConnect.Session.SessionId &&
                    request.SmbHeader.Tid == open.TreeConnect.TreeConnectId)
                {
                    SmbTransTransactNmpipeSuccessResponsePacket response =
                        this.cifsServer.CreateTransTransactNmpipeSuccessResponse(
                            connection, request, data);
                    if (available > 0)
                    {
                        Cifs.SmbHeader header = response.SmbHeader;
                        header.Status      = (uint)NtStatus.STATUS_BUFFER_OVERFLOW;
                        response.SmbHeader = header;
                    }
                    this.cifsServer.SendPacket(response, connection);
                    return;
                }
            }
        }
        public SmbTransTransactNmpipeSuccessResponsePacket CreateTransTransactNmpipeSuccessResponse(
            CifsServerPerConnection connection,
            SmbTransTransactNmpipeRequestPacket request,
            byte[] readData)
        {
            readData = readData ?? new byte[0];
            SmbTransTransactNmpipeSuccessResponsePacket response = new SmbTransTransactNmpipeSuccessResponsePacket();
            response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);

            TRANS_TRANSACT_NMPIPE_Response_Trans_Data transData = response.TransData;
            transData.ReadData = readData;
            response.TransData = transData;

            response.UpdateCountAndOffset();

            return response;
        }