public void FSCCFSCTLNameRequest(int messageId, int sessionId, int treeId, bool isSigned, int fid, FSCCFSCTLName fsctlName) { #region Create Packet NamespaceCifs.SmbNtTransactIoctlRequestPacket smbPacket = new NamespaceCifs.SmbNtTransactIoctlRequestPacket(); ushort uid = (ushort)this.uId[(uint)sessionId]; uint functionCode = (uint)fsctlName; byte[] data = new byte[DataCount]; this.fsccFSCTLName = fsctlName.ToString(); smbPacket = this.smbClientStack.CreateNTTransIOCtlRequest( (ushort)this.fId[(uint)fid], true, byte.MinValue, functionCode, data); 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); VerifyTransport(smbPacketResponse); VerifyCommonMessageSyntax(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 { NamespaceCifs.SmbNtTransactIoctlResponsePacket smbNtTransactIoctlResponsePacket = response as SmbNtTransactIoctlResponsePacket; NamespaceCifs.SmbHeader ntTransactIoctlResponseHeader = smbNtTransactIoctlResponsePacket.SmbHeader; VerifyMessageSyntaxFsctlNameResponse(smbNtTransactIoctlResponsePacket); this.FSCCFSCTLNameResponse( ntTransactIoctlResponseHeader.Mid + this.addMidMark, this.QueryUidTable(smbPacketResponse), this.QueryTidTable(smbPacketResponse), (smbPacketResponse).IsSignRequired, (MessageStatus)ntTransactIoctlResponseHeader.Status); } #endregion }
public static void FSCCFSCTLNameRequest(int messageId, int sessionId, int treeId, bool isSigned, int fid, FSCCFSCTLName fsctlName) { Condition.IsTrue(smbConnection.openedFiles.ContainsKey(fid)); Condition.IsTrue(smbConnection.openedFiles[fid].treeId == treeId); Checker.CheckRequest(smbConnection, messageId, sessionId, treeId, isSigned, smbState); smbRequest = new FSCTLNameRequest(messageId, sessionId, treeId, fid, isSigned, fsctlName); Update.UpdateRequest(smbConnection, smbRequest); }
/// <summary> /// NT_TRANSACT_IOCTL Client Request /// </summary> /// <param name="messageId"> Message ID used to identify the message.</param> /// <param name="sessionId"> Session ID used to identify the session.</param> /// <param name="treeId"> Tree ID used to identify the tree connection.</param> /// <param name="isSigned">Indicate whether the SUT has message signing enabled or required.</param> /// <param name="fid"> The target file identifier. </param> /// <param name="copychunkResumeKey">The server resume key for a source file.</param> /// <param name="length"> The number of bytes to copy from the source file to the target file.</param> public FSCTLNameRequest(int messageId, int sessionId, int treeId, int fid, bool isSigned, FSCCFSCTLName fsctlName) : base(messageId, Command.FSCC_FSCTL_NAME) { this.sessionId = sessionId; this.treeId = treeId; this.fid = fid; this.isSigned = isSigned; this.fsctlName = fsctlName; }