/// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbNtTransFsctlSrvCopyChunkResponsePacket(Cifs.SmbNtTransactIoctlResponsePacket packet)
     : base(packet)
 {
     this.ntTransData =
         CifsMessageUtils.ToStuct<NT_TRANSACT_COPY_CHUNK_Response_NT_Trans_Data>(
         packet.NtTransData.Data);
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbNtTransFsctlSrvEnumerateSnapshotsResponsePacket(Cifs.SmbNtTransactIoctlResponsePacket packet)
     : base(packet)
 {
     this.ntTransData =
         CifsMessageUtils.ToStuct<NT_TRANSACT_ENUMERATE_SNAPSHOTS_Response_NT_Trans_Data>(
         packet.NtTransData.Data);
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbNtTransFsctlSrvRequestResumeKeyResponsePacket(Cifs.SmbNtTransactIoctlResponsePacket packet)
     : base(packet)
 {
     this.ntTransData =
         CifsMessageUtils.ToStuct<NT_TRANSACT_RESUME_KEY_Response_NT_Trans_Data>(
         packet.NtTransData.Data);
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbNtTransFsctlSrvCopyChunkRequestPacket(Cifs.SmbNtTransactIoctlRequestPacket packet)
     : base(packet)
 {
     if (packet.NtTransData.Data != null && packet.NtTransData.Data.Length > 0)
     {
         this.ntTransData =
           CifsMessageUtils.ToStuct<NT_TRANSACT_COPY_CHUNK_Request_NT_Trans_Data>(
             packet.NtTransData.Data);
     }
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbTransReadNmpipeRequestPacket(Cifs.SmbTransReadNmpipeRequestPacket packet)
     : base(packet)
 {
     this.smbParameters = SmbMessageUtils.ConvertTransactionFilePacketPayload(packet.SmbParameters);
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbReadAndxResponsePacket(Cifs.SmbReadAndxResponsePacket packet)
     : base(packet)
 {
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbTrans2GetDfsReferralRequestPacket(Cifs.SmbTrans2GetDfsReferalRequestPacket packet)
     : base(packet)
 {
     this.smbParameters = SmbMessageUtils.ConvertTransaction2PacketPayload(packet.SmbParameters);
 }
        /// <summary>
        /// convert the payload of write request packet from base class format to sub class format, that is 
        /// Cifs to Smb format.
        /// </summary>
        /// <param name="baseClassFormatPayload">the base class format, Cifs format.</param>
        /// <returns>the sub class format, Smb format</returns>
        internal static Smb.SMB_COM_WRITE_ANDX_Request_SMB_Parameters ConvertSmbComWriteRequestPacketPayload(
            Cifs.SMB_COM_WRITE_ANDX_Request_SMB_Parameters baseClassFormatPayload)
        {
            Smb.SMB_COM_WRITE_ANDX_Request_SMB_Parameters
                subClassFormatPayload = new Smb.SMB_COM_WRITE_ANDX_Request_SMB_Parameters();

            subClassFormatPayload.WordCount = baseClassFormatPayload.WordCount;
            subClassFormatPayload.AndXCommand = baseClassFormatPayload.AndXCommand;
            subClassFormatPayload.AndXReserved = baseClassFormatPayload.AndXReserved;
            subClassFormatPayload.AndXOffset = baseClassFormatPayload.AndXOffset;
            subClassFormatPayload.FID = baseClassFormatPayload.FID;
            subClassFormatPayload.Offset = baseClassFormatPayload.Offset;
            subClassFormatPayload.Timeout = baseClassFormatPayload.Timeout;
            subClassFormatPayload.WriteMode = baseClassFormatPayload.WriteMode;
            subClassFormatPayload.Remaining = baseClassFormatPayload.Remaining;
            subClassFormatPayload.DataLengthHigh = baseClassFormatPayload.Reserved;
            subClassFormatPayload.DataLength = baseClassFormatPayload.DataLength;
            subClassFormatPayload.DataOffset = baseClassFormatPayload.DataOffset;
            subClassFormatPayload.OffsetHigh = baseClassFormatPayload.OffsetHigh;

            return subClassFormatPayload;
        }
        /// <summary>
        /// convert the payload of transaction2 packet from base class format to sub class format, that is 
        /// Cifs format to Smb format. 
        /// </summary>
        /// <param name = "baseClassFormatPayload">the base class format, Cifs format </param>
        /// <returns>the sub class format, Smb format </returns>
        internal static Smb.SMB_COM_TRANSACTION2_Request_SMB_Parameters ConvertTransaction2PacketPayload(
            Cifs.SMB_COM_TRANSACTION2_Request_SMB_Parameters baseClassFormatPayload)
        {
            Smb.SMB_COM_TRANSACTION2_Request_SMB_Parameters
                subClassFormatPayload = new Smb.SMB_COM_TRANSACTION2_Request_SMB_Parameters();

            subClassFormatPayload.WordCount = baseClassFormatPayload.WordCount;
            subClassFormatPayload.TotalParameterCount = baseClassFormatPayload.TotalParameterCount;
            subClassFormatPayload.TotalDataCount = baseClassFormatPayload.TotalDataCount;
            subClassFormatPayload.MaxParameterCount = baseClassFormatPayload.MaxParameterCount;
            subClassFormatPayload.MaxDataCount = baseClassFormatPayload.MaxDataCount;
            subClassFormatPayload.MaxSetupCount = baseClassFormatPayload.MaxSetupCount;
            subClassFormatPayload.Reserved1 = baseClassFormatPayload.Reserved1;
            subClassFormatPayload.Flags = baseClassFormatPayload.Flags;
            subClassFormatPayload.Timeout = baseClassFormatPayload.Timeout;
            subClassFormatPayload.Reserved2 = baseClassFormatPayload.Reserved2;
            subClassFormatPayload.ParameterCount = baseClassFormatPayload.ParameterCount;
            subClassFormatPayload.ParameterOffset = baseClassFormatPayload.ParameterOffset;
            subClassFormatPayload.DataCount = baseClassFormatPayload.DataCount;
            subClassFormatPayload.DataOffset = baseClassFormatPayload.DataOffset;
            subClassFormatPayload.SetupCount = baseClassFormatPayload.SetupCount;
            subClassFormatPayload.Reserved3 = baseClassFormatPayload.Reserved3;
            subClassFormatPayload.Subcommand = baseClassFormatPayload.Setup[0];

            return subClassFormatPayload;
        }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbNtTransFsctlSrvEnumerateSnapshotsRequestPacket(Cifs.SmbNtTransactIoctlRequestPacket packet)
     : base(packet)
 {
 }
        /// <summary>
        /// convert the payload of read response packet from base class format to sub class format, that is 
        /// Cifs to Smb format.
        /// </summary>
        /// <param name="baseClassFormatPayload">the base class format, Cifs format.</param>
        /// <returns>the sub class format, Smb format</returns>
        internal static Smb.SMB_COM_READ_ANDX_Response_SMB_Parameters ConvertSmbComReadResponsePacketPayload(
            Cifs.SMB_COM_READ_ANDX_Response_SMB_Parameters baseClassFormatPayload)
        {
            Smb.SMB_COM_READ_ANDX_Response_SMB_Parameters
                subClassFormatPayload = new Smb.SMB_COM_READ_ANDX_Response_SMB_Parameters();

            subClassFormatPayload.WordCount = baseClassFormatPayload.WordCount;
            subClassFormatPayload.AndXCommand = baseClassFormatPayload.AndXCommand;
            subClassFormatPayload.AndXReserved = baseClassFormatPayload.AndXReserved;
            subClassFormatPayload.AndXOffset = baseClassFormatPayload.AndXOffset;
            subClassFormatPayload.Available = baseClassFormatPayload.Available;
            subClassFormatPayload.DataCompactionMode = baseClassFormatPayload.DataCompactionMode;
            subClassFormatPayload.Reserved1 = baseClassFormatPayload.Reserved1;
            subClassFormatPayload.DataLength = baseClassFormatPayload.DataLength;
            subClassFormatPayload.DataOffset = baseClassFormatPayload.DataOffset;
            // DataLengthHigh stored in the first ushort of base.
            subClassFormatPayload.DataLengthHigh = baseClassFormatPayload.Reserved2[0];
            // reserved2 must be 4 words.
            subClassFormatPayload.Reserved2 = new ushort[4];
            subClassFormatPayload.Reserved2[0] = baseClassFormatPayload.Reserved2[1];
            subClassFormatPayload.Reserved2[1] = baseClassFormatPayload.Reserved2[2];
            subClassFormatPayload.Reserved2[2] = baseClassFormatPayload.Reserved2[3];
            subClassFormatPayload.Reserved2[3] = baseClassFormatPayload.Reserved2[4];

            return subClassFormatPayload;
        }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbReadAndxRequestPacket(Cifs.SmbReadAndxRequestPacket packet)
     : base(packet)
 {
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbTransWriteNmpipeResponsePacket(Cifs.SmbTransWriteNmpipeSuccessResponsePacket packet)
     : base(packet)
 {
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbTreeDisconnectRequestPacket(Cifs.SmbTreeDisconnectRequestPacket packet)
     : base(packet)
 {
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbLogoffAndxRequestPacket(Cifs.SmbLogoffAndxRequestPacket packet)
     : base(packet)
 {
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbWriteAndxRequestPacket(Cifs.SmbWriteAndxRequestPacket packet)
     : base(packet)
 {
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbWriteAndxResponsePacket(Cifs.SmbWriteAndxResponsePacket packet)
     : base(packet)
 {
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbTrans2QueryFileInformationResponsePacket(Cifs.SmbTrans2QueryFileInformationFinalResponsePacket packet)
     : base(packet)
 {
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbNtTransactCreateRequestPacket(Cifs.SmbNtTransactCreateRequestPacket packet)
     : base(packet)
 {
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbTrans2GetDfsReferralResponsePacket(Cifs.SmbTrans2GetDfsReferalFinalResponsePacket packet)
     : base(packet)
 {
 }
        /// <summary>
        /// convert the payload of tree connect packet from base class format to sub class format, that is 
        /// Cifs to Smb format.
        /// </summary>
        /// <param name="baseClassFormatPayload">the base class format, Cifs format.</param>
        /// <returns>the sub class format, Smb format</returns>
        internal static Smb.SMB_COM_NT_CREATE_ANDX_Response_SMB_Parameters ConvertSmbComCreatePacketPayload(
            Cifs.SMB_COM_NT_CREATE_ANDX_Response_SMB_Parameters baseClassFormatPayload)
        {
            Smb.SMB_COM_NT_CREATE_ANDX_Response_SMB_Parameters
                subClassFormatPayload = new Smb.SMB_COM_NT_CREATE_ANDX_Response_SMB_Parameters();

            subClassFormatPayload.WordCount = baseClassFormatPayload.WordCount;
            subClassFormatPayload.AndXCommand = baseClassFormatPayload.AndXCommand;
            subClassFormatPayload.AndXReserved = baseClassFormatPayload.AndXReserved;
            subClassFormatPayload.AndXOffset = baseClassFormatPayload.AndXOffset;
            subClassFormatPayload.OplockLevel = baseClassFormatPayload.OplockLevel;
            subClassFormatPayload.FID = baseClassFormatPayload.FID;
            subClassFormatPayload.CreationAction = (uint)baseClassFormatPayload.CreateDisposition;
            subClassFormatPayload.CreateTime = baseClassFormatPayload.CreateTime;
            subClassFormatPayload.LastAccessTime = baseClassFormatPayload.LastAccessTime;
            subClassFormatPayload.LastWriteTime = baseClassFormatPayload.LastWriteTime;
            subClassFormatPayload.LastChangeTime = baseClassFormatPayload.LastChangeTime;
            subClassFormatPayload.ExtFileAttributes = (uint)baseClassFormatPayload.ExtFileAttributes;
            subClassFormatPayload.AllocationSize = baseClassFormatPayload.AllocationSize;
            subClassFormatPayload.EndOfFile = baseClassFormatPayload.EndOfFile;
            subClassFormatPayload.ResourceType = baseClassFormatPayload.ResourceType;
            subClassFormatPayload.NMPipeStatus_or_FileStatusFlags = baseClassFormatPayload.NMPipeStatus;
            subClassFormatPayload.Directory = baseClassFormatPayload.Directory;

            return subClassFormatPayload;
        }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbCloseResponsePacket(Cifs.SmbCloseResponsePacket packet)
     : base(packet)
 {
 }
        /// <summary>
        /// convert the payload of tree connect packet from base class format to sub class format, that is 
        /// Cifs to Smb format.
        /// </summary>
        /// <param name="baseClassFormatPayload">the base class format, Cifs format.</param>
        /// <returns>the sub class format, Smb format</returns>
        internal static Smb.SMB_COM_TREE_CONNECT_ANDX_Response_SMB_Parameters ConvertSmbComTreeConnectPacketPayload(
            Cifs.SMB_COM_TREE_CONNECT_ANDX_Response_SMB_Parameters baseClassFormatPayload)
        {
            Smb.SMB_COM_TREE_CONNECT_ANDX_Response_SMB_Parameters
                subClassFormatPayload = new Smb.SMB_COM_TREE_CONNECT_ANDX_Response_SMB_Parameters();

            subClassFormatPayload.WordCount = baseClassFormatPayload.WordCount;
            subClassFormatPayload.AndXCommand = baseClassFormatPayload.AndXCommand;
            subClassFormatPayload.AndXReserved = baseClassFormatPayload.AndXReserved;
            subClassFormatPayload.AndXOffset = baseClassFormatPayload.AndXOffset;
            subClassFormatPayload.OptionalSupport = baseClassFormatPayload.OptionalSupport;

            return subClassFormatPayload;
        }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbSessionSetupImplicitNtlmAndxResponsePacket(Cifs.SmbSessionSetupAndxResponsePacket packet)
     : base(packet)
 {
 }
        /// <summary>
        /// convert the payload of write response packet from base class format to sub class format, that is 
        /// Cifs to Smb format.
        /// </summary>
        /// <param name="baseClassFormatPayload">the base class format, Cifs format.</param>
        /// <returns>the sub class format, Smb format</returns>
        internal static Smb.SMB_COM_WRITE_ANDX_Response_SMB_Parameters ConvertSmbComWriteResponsePacketPayload(
            Cifs.SMB_COM_WRITE_ANDX_Response_SMB_Parameters baseClassFormatPayload)
        {
            Smb.SMB_COM_WRITE_ANDX_Response_SMB_Parameters
                subClassFormatPayload = new Smb.SMB_COM_WRITE_ANDX_Response_SMB_Parameters();

            subClassFormatPayload.WordCount = baseClassFormatPayload.WordCount;
            subClassFormatPayload.AndXCommand = baseClassFormatPayload.AndXCommand;
            subClassFormatPayload.AndXReserved = baseClassFormatPayload.AndXReserved;
            subClassFormatPayload.AndXOffset = baseClassFormatPayload.AndXOffset;
            subClassFormatPayload.Count = baseClassFormatPayload.Count;
            subClassFormatPayload.Available = baseClassFormatPayload.Available;
            // get CountHigh from the low 2 bytes of Reserved
            subClassFormatPayload.CountHigh = (ushort)baseClassFormatPayload.Reserved;
            subClassFormatPayload.Reserved = (ushort)(baseClassFormatPayload.Reserved >> 16);

            return subClassFormatPayload;
        }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbLogoffAndxResponsePacket(Cifs.SmbLogoffAndxResponsePacket packet)
     : base(packet)
 {
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbTransMailslotWriteRequestPacket(Cifs.SmbTransMailslotWriteRequestPacket packet)
     : base(packet)
 {
     this.smbParameters = SmbMessageUtils.ConvertTransactionMailslotPacketPayload(packet.SmbParameters);
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbTrans2SetPathInformationResponsePacket(
     Cifs.SmbTrans2SetPathInformationFinalResponsePacket packet)
     : base(packet)
 {
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbTrans2SetPathInformationRequestPacket(Cifs.SmbTrans2SetPathInformationRequestPacket packet)
     : base(packet)
 {
     this.smbParameters = SmbMessageUtils.ConvertTransaction2PacketPayload(packet.SmbParameters);
 }
 /// <summary>
 /// initialize packet from base packet. 
 /// </summary>
 /// <param name = "packet">the base packet to initialize this packet. </param>
 public SmbNegotiateRequestPacket(Cifs.SmbNegotiateRequestPacket packet)
     : base(packet)
 {
 }