/// <summary> /// to decode the smb parameters: from the general SmbParameters to the concrete Smb Parameters. /// </summary> /// <exception cref="NotImplementedException"> /// TD did not define the SmbParameters for Lan Manager Dialect. /// </exception> /// <exception cref="NotSupportedException">Unknow SmbParameters structure.</exception> protected override void DecodeParameters() { if (this.SmbParametersBlock.WordCount > 0) { if (this.smbParametersBlock.WordCount == WordCountOfCoreProtocol) { this.smbParameters.WordCount = this.smbParametersBlock.WordCount; this.smbParameters.DialectIndex = this.SmbParametersBlock.Words[0]; } else if (this.smbParametersBlock.WordCount == WordCountOfNtLanManager) { this.smbParameters = CifsMessageUtils.ToStuct <SMB_COM_NEGOTIATE_NtLanManagerResponse_SMB_Parameters>( CifsMessageUtils.ToBytes <SmbParameters>(this.smbParametersBlock)); } else if (this.smbParametersBlock.WordCount == WordCountOfLanManager) { throw new NotImplementedException("TD did not define the SmbParameters for Lan Manager Dialect."); } else { throw new NotSupportedException("Unknow SmbParameters structure."); } } else { this.smbParameters.WordCount = this.SmbParametersBlock.WordCount; } }
/// <summary> /// to decode the smb parameters: from the general SmbParameters to the concrete Smb Parameters. /// </summary> protected override void DecodeParameters() { if (this.smbParametersBlock.WordCount == WordCountOfCoreProtocol) { this.smbParameters.WordCount = this.smbParametersBlock.WordCount; using (MemoryStream memoryStream = new MemoryStream(CifsMessageUtils.ToBytesArray(this.SmbParametersBlock.Words))) { using (Channel channel = new Channel(null, memoryStream)) { this.smbParameters.DialectIndex = channel.Read <ushort>(); } } } else if (this.smbParametersBlock.WordCount == WordCountOfNtLanManager) { this.smbParameters = TypeMarshal.ToStruct <SMB_COM_NEGOTIATE_NtLanManagerResponse_SMB_Parameters>( CifsMessageUtils.ToBytes <SmbParameters>(this.smbParametersBlock)); } else if (this.smbParametersBlock.WordCount == WordCountOfLanManager) { throw new NotImplementedException("TD did not define the SmbParameters for Lan Manager Dialect."); } else { throw new NotSupportedException("Unknow SmbParameters structure."); } }
/// <summary> /// to decode the smb parameters: from the general SmbParameters to the concrete Smb Parameters. /// </summary> /// <exception cref="NotImplementedException"> /// TD did not define the SmbParameters for Lan Manager Dialect. /// </exception> /// <exception cref="NotSupportedException">Unknow SmbParameters structure.</exception> protected override void DecodeParameters() { if (this.SmbParametersBlock.WordCount > 0) { if (this.smbParametersBlock.WordCount == WordCountOfCoreProtocol) { this.smbParameters.WordCount = this.smbParametersBlock.WordCount; this.smbParameters.DialectIndex = this.SmbParametersBlock.Words[0]; } else if (this.smbParametersBlock.WordCount == WordCountOfNtLanManager) { this.smbParameters = CifsMessageUtils.ToStuct<SMB_COM_NEGOTIATE_NtLanManagerResponse_SMB_Parameters>( CifsMessageUtils.ToBytes<SmbParameters>(this.smbParametersBlock)); } else if (this.smbParametersBlock.WordCount == WordCountOfLanManager) { throw new NotImplementedException("TD did not define the SmbParameters for Lan Manager Dialect."); } else { throw new NotSupportedException("Unknow SmbParameters structure."); } } else { this.smbParameters.WordCount = this.SmbParametersBlock.WordCount; } }