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

            this.smbParameters.WordCount = packet.SmbParameters.WordCount;
            this.smbParameters.FID = packet.SmbParameters.FID;
            this.smbParameters.CountOfBytesToUnlock = packet.SmbParameters.CountOfBytesToUnlock;
            this.smbParameters.UnlockOffsetInBytes = packet.SmbParameters.UnlockOffsetInBytes;

            this.smbData.ByteCount = packet.SmbData.ByteCount;
        }
Esempio n. 2
0
        /// <summary>
        /// Deep copy constructor.
        /// </summary>
        public SmbUnlockByteRangeRequestPacket(SmbUnlockByteRangeRequestPacket packet)
            : base(packet)
        {
            this.InitDefaultValue();

            this.smbParameters.WordCount            = packet.SmbParameters.WordCount;
            this.smbParameters.FID                  = packet.SmbParameters.FID;
            this.smbParameters.CountOfBytesToUnlock = packet.SmbParameters.CountOfBytesToUnlock;
            this.smbParameters.UnlockOffsetInBytes  = packet.SmbParameters.UnlockOffsetInBytes;

            this.smbData.ByteCount = packet.SmbData.ByteCount;
        }
        /// <summary>
        /// to create a UnlockByteRange request packet.
        /// </summary>
        /// <param name="messageId">This field SHOULD be the multiplex ID that is used to associate a response with a
        /// request.</param>
        /// <param name="uid">This field SHOULD identify the authenticated instance of the user.</param>
        /// <param name="treeId">This field identifies the subdirectory (or tree) on the server that the client is
        /// accessing.</param>
        /// <param name="flags">An 8-bit field of 1-bit flags describing various features in effect for the
        /// message</param>
        /// <param name="flags2">A 16-bit field of 1-bit flags that represent various features in effect for the
        /// message. Unspecified bits are reserved and MUST be zero.</param>
        /// <param name="fid">This field MUST be a valid 16-bit signed integer indicating the file from which the data
        /// MUST be read</param>
        /// <param name="countOfBytesToUnlock">This field is a 32-bit unsigned integer indicating the number of
        /// contiguous bytes to be unlocked</param>
        /// <param name="unlockOffsetInBytes">ULONG This field is a 32-bit unsigned integer indicating the offset in
        /// number of bytes from which to begin the unlock. Because this field is limited to 32-bits this command is
        /// inappropriate for files having 64-bit offsets</param>
        /// <returns>a UnlockByteRange request packet</returns>
        public SmbUnlockByteRangeRequestPacket CreateUnlockByteRangeRequest(
            ushort messageId,
            ushort uid,
            ushort treeId,
            SmbFlags flags,
            SmbFlags2 flags2,
            ushort fid,
            uint countOfBytesToUnlock,
            uint unlockOffsetInBytes)
        {
            SmbUnlockByteRangeRequestPacket packet = new SmbUnlockByteRangeRequestPacket();

            packet.SmbHeader = CifsMessageUtils.CreateSmbHeader(SmbCommand.SMB_COM_UNLOCK_byte_RANGE,
                messageId, uid, treeId, flags, flags2);

            SMB_COM_UNLOCK_BYTE_RANGE_Request_SMB_Parameters smbParameters =
                new SMB_COM_UNLOCK_BYTE_RANGE_Request_SMB_Parameters();
            smbParameters.FID = fid;
            smbParameters.CountOfBytesToUnlock = countOfBytesToUnlock;
            smbParameters.UnlockOffsetInBytes = unlockOffsetInBytes;
            smbParameters.WordCount = (byte)(Marshal.SizeOf(smbParameters) / NumBytesOfWord);

            SMB_COM_UNLOCK_BYTE_RANGE_Request_SMB_Data smbData = new SMB_COM_UNLOCK_BYTE_RANGE_Request_SMB_Data();
            smbData.ByteCount = 0;

            packet.SmbParameters = smbParameters;
            packet.SmbData = smbData;

            return packet;
        }
        public SmbUnlockByteRangeResponsePacket CreateUnlockByteRangeResponse(
            CifsServerPerConnection connection,
            SmbUnlockByteRangeRequestPacket request)
        {
            SmbUnlockByteRangeResponsePacket response = new SmbUnlockByteRangeResponsePacket();
            response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);

            return response;
        }