public static void FSCCTrans2QueryPathInfoRequest(int messageId, int sessionId, int treeId, bool isSigned, FSCCTransaction2QueryPathInforLevel informationLevel) { Checker.CheckRequest(smbConnection, messageId, sessionId, treeId, isSigned, smbState); smbRequest = new FSCCTrans2QueryPathInfoRequest(messageId, sessionId, treeId, isSigned, informationLevel); Condition.IsTrue(smbConnection.sutCapabilities.Contains(Capabilities.CapNtSmbs)); if (informationLevel == FSCCTransaction2QueryPathInforLevel.FileAccessInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileAccessInformation"); } else if (informationLevel == FSCCTransaction2QueryPathInforLevel.FileAlignmentInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileAlignmentInformation"); } else if (informationLevel == FSCCTransaction2QueryPathInforLevel.FileAlternateNameInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileAlternateNameInformation"); } else if (informationLevel == FSCCTransaction2QueryPathInforLevel.FileAttributeTagInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileAttributeTagInformation"); } else if (informationLevel == FSCCTransaction2QueryPathInforLevel.FileBasicInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileBasicInformation"); } else if (informationLevel == FSCCTransaction2QueryPathInforLevel.FileCompressionInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileCompressionInformation"); } else if (informationLevel == FSCCTransaction2QueryPathInforLevel.FileEaInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileEaInformation"); } else if (informationLevel == FSCCTransaction2QueryPathInforLevel.FileInternalInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileInternalInformation"); } else if (informationLevel == FSCCTransaction2QueryPathInforLevel.FileModeInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileModeInformation"); } else if (informationLevel == FSCCTransaction2QueryPathInforLevel.FileNameInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileNameInformation"); } else if (informationLevel == FSCCTransaction2QueryPathInforLevel.FileNetworkOpenInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileNetworkOpenInformation"); } else if (informationLevel == FSCCTransaction2QueryPathInforLevel.FilePositionInformation) { Requirement.AssumeCaptured("Information level in FSCC is FilePositionInformation"); } else if (informationLevel == FSCCTransaction2QueryPathInforLevel.FileStandardInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileStandardInformation"); } else if (informationLevel == FSCCTransaction2QueryPathInforLevel.FileStreamInformation) { Requirement.AssumeCaptured("Information level in FSCC is FileStreamInformation"); } Update.UpdateRequest(smbConnection, smbRequest); }
/// <summary> /// TRANS2_QUERY_FILE_INFORMATION Request. /// </summary> /// <param name="messageId">This is used to associate a response with a request.</param> /// <param name="sessionId"> /// Set this value to 0 to request a new session setup, or set this value to a previously established session /// identifier to request reauthenticate to an existing session. /// </param> /// <param name="treeId"> /// This field identifies the subdirectory (or tree) (also referred as a share in this document) on the /// server that the client is accessing. /// </param> /// <param name="isSigned"> /// Indicate whether the SUT has message signing enabled or required. /// </param> /// <param name="isUsePassthrough"> /// Indicate whether adding SMB_INFO_PASSTHROUGH in InformationLevel field of the request. /// </param> /// <param name="isReparse">Indicate whether it is reparsed or not.</param> /// <param name="informationLevel">This can be used to query information from the server.</param> /// <param name="gmtTokenIndex">The index of the GMT token configured by CheckPreviousVersion action.</param> public void FSCCTrans2QueryPathInfoRequest( int messageId, int sessionId, int treeId, bool isSigned, //bool isUsePassthrough, //bool isReparse, //[Domain("InfoLevelQueriedByPath")] InformationLevel informationLevel, //int gmtTokenIndex) FSCCTransaction2QueryPathInforLevel informationLevel) { #region Create Packet SmbTrans2QueryPathInformationRequestPacket smbPacket = new SmbTrans2QueryPathInformationRequestPacket(); ushort uid = (ushort)this.uId[(uint)sessionId]; ushort requestedTid = (ushort)this.tId[(uint)treeId]; ushort transactOptions = ushort.MinValue; string fileName = string.Empty; fsccQueryPathLevel = (ushort)informationLevel; fileName = Site.Properties["SutShareExistFile"] as string; ushort level = this.FSCCInformationLevelBytesQueryPath[(ushort)informationLevel]; smbPacket = this.smbClientStack.CreateTrans2QueryPathInformationRequest( requestedTid, fileName, (NamespaceCifs.Trans2SmbParametersFlags)transactOptions, (NamespaceCifs.QueryInformationLevel)level, this.maxDataCount, false); if (isSigned) { NamespaceCifs.CifsClientPerConnection connection = this.smbClientStack.Context.GetConnection(ConnectionId); NamespaceCifs.CifsClientPerSession session = this.smbClientStack.Context.GetSession(ConnectionId, uid); smbPacket.Sign(connection.ClientNextSendSequenceNumber, session.SessionKey); } #endregion #region Send and Receive ExpectPacket this.smbClientStack.SendPacket(smbPacket); StackPacket response = this.smbClientStack.ExpectPacket(this.timeout); NamespaceCifs.SmbPacket smbPacketResponse = (NamespaceCifs.SmbPacket)response; this.QueryUidTable(smbPacketResponse); this.QueryTidTable(smbPacketResponse); if (response.GetType() == typeof(SmbErrorResponsePacket)) { SmbErrorResponsePacket smbErrorResponsePacket = response as SmbErrorResponsePacket; NamespaceCifs.SmbHeader smbErrorHeader = smbErrorResponsePacket.SmbHeader; this.ErrorResponse( smbErrorHeader.Mid + this.addMidMark, (MessageStatus)smbErrorHeader.Status); } else { SmbTrans2QueryPathInformationResponsePacket smbTrans2QueryPathInformationPacket = response as SmbTrans2QueryPathInformationResponsePacket; NamespaceCifs.SmbHeader trans2QueryPathInformationResponseHeader = smbTrans2QueryPathInformationPacket.SmbHeader; FSCCTrans2QueryPathInformation(smbTrans2QueryPathInformationPacket); this.FSCCTrans2QueryPathInfoResponse( trans2QueryPathInformationResponseHeader.Mid + this.addMidMark, this.QueryUidTable(smbPacketResponse), this.QueryTidTable(smbPacketResponse), (smbPacketResponse).IsSignRequired, (MessageStatus)trans2QueryPathInformationResponseHeader.Status); } #endregion }
/// <summary> /// TRANS2_QUERY_PATH_INFORMATION Request /// </summary> /// <param name="messageId"> This is used to associate a response with a request.</param> /// <param name="sessionId"> Set this value to 0 to request a new session setup, or set this value to a /// previously established session identifier to reauthenticate to an existing session. </param> /// <param name="treeId"> This field identifies the subdirectory (or tree) (also referred to as a share /// in this document) on the server that the client is accessing. </param> /// <param name="isSigned"> Indicates whether the server has message signing enabled or required.</param> /// <param name="gmtTokenIndex"> The index of the GMT token configured by CheckPreviousVersion action</param> /// <param name="isUsePassthrough"> Indicates whether adding SMB_INFO_PASSTHROUGH in InformationLevel field of /// the request.</param> /// <param name="isReparse">Indicates whether the SMB_FLAGS2_REPARSE_PATH is set in the Flag2 field of the /// SMB header.</param> /// <param name="informationLevel"> This can be used to query information from the server.</param> public FSCCTrans2QueryPathInfoRequest( int messageId, int sessionId, int treeId, bool isSigned, FSCCTransaction2QueryPathInforLevel informationLevel) : base(messageId, Command.FSCCTRANS2_QUERY_PATH_INFORMATION) { this.sessionId = sessionId; this.treeId = treeId; this.isSigned = isSigned; this.informationLevel = informationLevel; }