/// <summary> /// Create Trans2SetFileInformation request for client to set the file information on server. /// </summary> /// <param name = "messageId">the id of message, used to identity the request and the server response. </param> /// <param name = "sessionUid">the valid session id, must be response by server of the session setup request. </param> /// <param name = "treeId">the valid tree connect id, must be response by server of the tree connect. </param> /// <param name = "flags"> /// The Flags field contains individual flags, as specified in [CIFS] sections 2.4.2 and 3.1.1. /// </param> /// <param name = "flags2"> /// The Flags2 field contains individual bit flags that, depending on the negotiated SMB dialect, indicate /// various client and server capabilities. /// </param> /// <param name = "fileId">the valid file id to operation on, response by server. </param> /// <param name = "transactOptions"> /// A set of bit flags that alter the behavior of the requested operation. Unused bit fields MUST be set to /// zero by the client sending the request, and MUST be ignored by the server receiving the request. The /// client MAY set either or both of the following bit flags /// </param> /// <param name = "timeOut"> /// The maximum amount of time in milliseconds to wait for the operation to complete. The client SHOULD set /// this to 0 to indicate that no time-out is given. If the operation does not complete within the specified /// time, the server MAY abort the request and send a failure response. /// </param> /// <param name = "isUsePathThrough"> /// Indicates that the client is requesting a native Microsoft Windows® NT operating system information level, /// as specified in section 3.2.4.7 and in [MS-FSCC] section 2.4. /// </param> /// <param name = "informationLevel"> /// Indicates that client specifies the information it is requesting. Server return different data based on /// the client's request. /// </param> /// <param name = "data">the information data to be set. </param> /// <returns>a set file information request packet </returns> private SmbTrans2SetFileInformationRequestPacket CreateTrans2SetFileInformationRequest( ushort messageId, ushort sessionUid, ushort treeId, SmbHeader_Flags_Values flags, SmbHeader_Flags2_Values flags2, ushort fileId, Trans2SmbParametersFlags transactOptions, uint timeOut, bool isUsePathThrough, SetInformationLevel informationLevel, byte[] data) { if (isUsePathThrough) { informationLevel = (SetInformationLevel) (informationLevel + SmbCapability.CONST_SMB_INFO_PASSTHROUGH); } SmbTrans2SetFileInformationRequestPacket packet = new SmbTrans2SetFileInformationRequestPacket( this.cifsClient.CreateTrans2SetFileInformationRequest( messageId, sessionUid, treeId, (SmbFlags)flags, (SmbFlags2)flags2, this.capability.MaxParameterCount, this.capability.MaxDataCount, this.capability.MaxSetupCount, transactOptions, timeOut, "", fileId, informationLevel, data)); packet.UpdateCountAndOffset(); return packet; }
public void TraditionalTestCase_IgnoreFields_SET_FILE_09_Case() { #region Connect to the specified server smbClientStack.Connect(serverName, serverPort, ipVersion, bufferSize); #endregion #region Send the Negotiate request // Create a SMB_COM_NEGOTIATE request. SmbNegotiateRequestPacket negotiateRequest = smbClientStack.CreateNegotiateRequest( StackSmb.SignState.NONE, new string[] { DialectNameString.PCNET1, DialectNameString.LANMAN10, DialectNameString.WFW10, DialectNameString.LANMAN12, DialectNameString.LANMAN21, DialectNameString.NTLANMAN }); // Send the SMB_COM_NEGOTIATE request and expect the response in timeout milliseconds. smbClientStack.SendPacket(negotiateRequest); StackPacket response = smbClientStack.ExpectPacket(timeout); // Check whether server returns a response. Site.Assert.IsNotNull( response, "SMB_COM_NEGOTIATE response should not be null."); // Check whether server returns a SMB_COM_NEGOTIATE response. Site.Assert.IsInstanceOfType( response, typeof(SmbNegotiateResponsePacket), "SMB_COM_NEGOTIATE response should be received."); // Check the response validity by verifying the Status field in the SMB Header packet. SmbNegotiateResponsePacket negotiateResponse = (SmbNegotiateResponsePacket)response; Site.Assert.AreEqual <uint>( (uint)SmbStatus.STATUS_SUCCESS, negotiateRequest.SmbHeader.Status, "SMB_COM_NEGOTIATE response status should be SUCCESS."); #endregion #region Send the first SMB_COM_SESSION_SETUP_ANDX Request SmbSecurityPackage smbSecurityPackage = (SmbSecurityPackage)Enum.Parse( typeof(SmbSecurityPackage), Site.Properties["SmbSecurityPackageType"] as string, true); // Create the first SMB_COM_SESSION_SETUP_ANDX request. SmbSessionSetupAndxRequestPacket sessionSetupAndxRequest = smbClientStack.CreateFirstSessionSetupRequest( smbSecurityPackage, serverName, domainName, userName, password); // Send the first SMB_COM_SESSION_SETUP_ANDX request and expect the response in timeout milliseconds. smbClientStack.SendPacket(sessionSetupAndxRequest); response = smbClientStack.ExpectPacket(timeout); // Check whether server return a response. Site.Assert.IsNotNull( response, "SMB_COM_SESSION_SETUP_ANDX response should not be null."); // Check whether server returns a the SMB_COM_SESSION_SETUP_ANDX response. Site.Assert.IsInstanceOfType( response, typeof(SmbSessionSetupAndxResponsePacket), "SMB_COM_SESSION_SETUP_ANDX response should be received."); // Check the response validity by verifying the Status field in the SMB Header packet. // If SMB SecurityPackage type is NTLM, the expected SUCCESS response status is STATUS_MORE_PROCESSING_REQUIRED, // else if SMB SecurityPackage type is Kerberos, the expected SUCCESS response status is STATUS_SUCCESS. SmbSessionSetupAndxResponsePacket sessionSetupResponse = (SmbSessionSetupAndxResponsePacket)response; Site.Assert.IsTrue( (int)sessionSetupResponse.SmbHeader.Status == (int)SmbStatus.STATUS_MORE_PROCESSING_REQUIRED || (int)sessionSetupResponse.SmbHeader.Status == (int)SmbStatus.STATUS_SUCCESS, "SMB_COM_SESSION_SETUP_ANDX response status should be SUCCESS."); #endregion #region Send the second SMB_COM_SESSION_SETUP_ANDX request // Create the second SMB_COM_SESSION_SETUP_ANDX request. ushort sessionUid = sessionSetupResponse.SmbHeader.Uid; if ((int)sessionSetupResponse.SmbHeader.Status == (int)SmbStatus.STATUS_MORE_PROCESSING_REQUIRED) { SmbSessionSetupAndxRequestPacket secondSessionSetupRequest = smbClientStack.CreateSecondSessionSetupRequest(sessionUid, smbSecurityPackage); // Send the second SMB_COM_SESSION_SETUP_ANDX request and expect the response in timeout milliseconds. smbClientStack.SendPacket(secondSessionSetupRequest); response = smbClientStack.ExpectPacket(timeout); // Check whether server returns a response. Site.Assert.IsNotNull( response, "SMB_COM_SESSION_SETUP_ANDX response should not be null."); // Check whether server returns a the SMB_COM_SESSION_SETUP_ANDX response. Site.Assert.IsInstanceOfType( response, typeof(SmbSessionSetupAndxResponsePacket), "SMB_COM_SESSION_SETUP_ANDX response should be received."); // Check the response validity by verifying the Status field in the SMB Header packet. sessionSetupResponse = (SmbSessionSetupAndxResponsePacket)response; Site.Assert.AreEqual <uint>( (uint)SmbStatus.STATUS_SUCCESS, sessionSetupResponse.SmbHeader.Status, "SMB_COM_SESSION_SETUP_ANDX response status should be SUCCESS."); } #endregion #region Send the SMB_COM_TREE_CONNECT_ANDX request // Create the SMB_COM_TREE_CONNECT_ANDX request. string path = Site.Properties["SutNtfsShare1FullName"]; SmbTreeConnectAndxRequestPacket treeconnectRequest = smbClientStack.CreateTreeConnectRequest(sessionUid, path); // Send the SMB_COM_TREE_CONNECT_ANDX request and expect the response in timeout milliseconds. smbClientStack.SendPacket(treeconnectRequest); response = smbClientStack.ExpectPacket(timeout); // Check whether server returns a response. Site.Assert.IsNotNull( response, "SMB_COM_TREE_CONNECT_ANDX response should not be null."); // Check whether server returns a SMB_COM_TREE_CONNECT_ANDX response. Site.Assert.IsInstanceOfType( response, typeof(SmbTreeConnectAndxResponsePacket), "SMB_COM_TREE_CONNECT_ANDX response should be received."); // Check the response validity by verifying the Status field in the SMB Header packet. SmbTreeConnectAndxResponsePacket treeConnectResponse = (SmbTreeConnectAndxResponsePacket)response; Site.Assert.AreEqual <uint>( (uint)SmbStatus.STATUS_SUCCESS, treeConnectResponse.SmbHeader.Status, "SMB_COM_TREE_CONNECT_ANDX response status should be SUCCESS."); #endregion #region Send the SMB_COM_NT_CREATE_ANDX request // Create the Create request. ushort treeId = treeConnectResponse.SmbHeader.Tid; string fileName = Site.Properties["SutShareTest2"]; SmbNtCreateAndxRequestPacket createRequest = smbClientStack.CreateCreateRequest( treeId, fileName, StackCifs.NtTransactDesiredAccess.GENERIC_ALL, StackCifs.SMB_EXT_FILE_ATTR.NONE, StackCifs.NtTransactShareAccess.FILE_SHARE_DELETE | StackCifs.NtTransactShareAccess.FILE_SHARE_READ | StackCifs.NtTransactShareAccess.FILE_SHARE_WRITE, StackCifs.NtTransactCreateDisposition.FILE_OPEN_IF, NtTransactCreateOptions.FILE_NON_DIRECTORY_FILE, StackCifs.NtTransactImpersonationLevel.SEC_IDENTIFY, CreateFlags.NT_CREATE_REQUEST_OPLOCK); // Send the SMB_COM_NT_CREATE_ANDX request and expect the response in timeout milliseconds. smbClientStack.SendPacket(createRequest); response = smbClientStack.ExpectPacket(timeout); // Check whether server returns a response. Site.Assert.IsNotNull( response, "SMB_COM_NT_CREATE_ANDX response should not be null."); // Check if server returns a SMB_COM_NT_CREATE_ANDX response. Site.Assert.IsInstanceOfType( response, typeof(SmbNtCreateAndxResponsePacket), "SMB_COM_NT_CREATE_ANDX response should be received."); // Check the response validity by verifying the Status field in the SMB Header packet. SmbNtCreateAndxResponsePacket createResponse = (SmbNtCreateAndxResponsePacket)response; Site.Assert.AreEqual <uint>( (uint)SmbStatus.STATUS_SUCCESS, createResponse.SmbHeader.Status, "SMB_COM_NT_CREATE_ANDX response status should be SUCCESS."); #endregion #region Send the TRANS2_SET_FILE_INFORMATION request // Create a TRANS2_SET_FILE_INFORMATION request. ushort fileId = createResponse.SmbParameters.FID; StackFscc.FileLinkInformation fileLinkInformation = new StackFscc.FileLinkInformation(); // 1 indicates that if the link already exists, it should be replaced with the new link. fileLinkInformation.ReplaceIfExists = 1; // The Reserved filed is a 7 bytes array fileLinkInformation.Reserved = new byte[7]; // The name of the newly created link. fileLinkInformation.FileName = Encoding.Unicode.GetBytes("wl.txt.lnk"); fileLinkInformation.FileNameLength = (uint)fileLinkInformation.FileName.Length; // 0 indicates a network operations. fileLinkInformation.RootDirectory = 0; StackFscc.FsccFileLinkInformationRequestPacket linkPacket = new StackFscc.FsccFileLinkInformationRequestPacket(); linkPacket.Payload = TypeMarshal.ToBytes <StackFscc.FileLinkInformation>(fileLinkInformation); byte[] data = linkPacket.ToBytes(); smbClientStack.Capability.IsUsePassThrough = false; // Create a TRANS2_SET_FILE_INFORMATION Request. SmbTrans2SetFileInformationRequestPacket trans2SetFileInformationRequest = smbClientStack.CreateTrans2SetFileInformationRequest( fileId, StackCifs.Trans2SmbParametersFlags.NONE, StackCifs.SetInformationLevel.SMB_INFO_STANDARD, data); // Send the TRANS2_SET_FILE_INFORMATION request and expect the response in timeout milliseconds. smbClientStack.SendPacket(trans2SetFileInformationRequest); response = smbClientStack.ExpectPacket(timeout); // Check whether server returns a response. Site.Assert.IsNotNull( response, "TRANS2_SET_FILE_INFORMATION response should not be null."); // Check whether server returns a TRANS2_SET_FILE_INFORMATION response. Site.Assert.IsInstanceOfType( response, typeof(SmbTrans2SetFileInformationResponsePacket), "TRANS2_SET_FILE_INFORMATION response should be received."); // Check the response validity by verifying the Status field in the SMB Header packet. SmbTrans2SetFileInformationResponsePacket trans2SetFileInformationResponse = (SmbTrans2SetFileInformationResponsePacket)response; Site.Assert.AreEqual <uint>( (uint)SmbStatus.STATUS_SUCCESS, trans2SetFileInformationResponse.SmbHeader.Status, "TRANS2_SET_FILE_INFORMATION response status should be SUCCESS."); #endregion #region Send the TRANS2_SET_FILE_INFORMATION request StackFscc.FsccFileLinkInformationRequestPacket linkPacket2 = new StackFscc.FsccFileLinkInformationRequestPacket(); fileLinkInformation = new StackFscc.FileLinkInformation(); // 1 indicates that if the link already exists, it should be replaced with the new link. fileLinkInformation.ReplaceIfExists = 1; // The Reserved filed is a 7 bytes array fileLinkInformation.Reserved = new byte[7]; // The name of the newly created link. fileLinkInformation.FileName = Encoding.Unicode.GetBytes("wl.txt.lnk"); fileLinkInformation.FileNameLength = (uint)fileLinkInformation.FileName.Length; // 0 indicates a network operations. fileLinkInformation.RootDirectory = 0; linkPacket2.Payload = TypeMarshal.ToBytes <StackFscc.FileLinkInformation>(fileLinkInformation); smbClientStack.Capability.IsUsePassThrough = false; // Create a TRANS2_SET_FILE_INFORMATION request. SmbTrans2SetFileInformationRequestPacket trans2SetFileInformationRequest2 = smbClientStack.CreateTrans2SetFileInformationRequest( fileId, StackCifs.Trans2SmbParametersFlags.NONE, StackCifs.SetInformationLevel.SMB_INFO_STANDARD, linkPacket2.ToBytes()); // Send the TRANS2_SET_FILE_INFORMATION request and expect the response in timeout milliseconds. smbClientStack.SendPacket(trans2SetFileInformationRequest2); StackPacket response2 = smbClientStack.ExpectPacket(timeout); // Check whether server returns a response. Site.Assert.IsNotNull( response2, "TRANS2_SET_FILE_INFORMATION response should not be null."); // Check whether server returns a TRANS2_SET_FILE_INFORMATION response. Site.Assert.IsInstanceOfType( response, typeof(SmbTrans2SetFileInformationResponsePacket), "TRANS2_SET_FILE_INFORMATION response should be received."); // Check the response validity by verifying the Status field in the SMB Header packet. SmbTrans2SetFileInformationResponsePacket trans2SetFileInformationResponse2 = (SmbTrans2SetFileInformationResponsePacket)response2; Site.Assert.AreEqual <uint>( (uint)SmbStatus.STATUS_SUCCESS, trans2SetFileInformationResponse.SmbHeader.Status, "TRANS2_SET_FILE_INFORMATION response status should be SUCCESS."); #endregion #region Send the SMB_CLOSE request // Create the SMB_CLOSE request. SmbCloseRequestPacket CloseRequest = smbClientStack.CreateCloseRequest(fileId); // Send the Close request and expect the response in timeout milliseconds. smbClientStack.SendPacket(CloseRequest); response = smbClientStack.ExpectPacket(timeout); // Check whether server returns a response. Site.Assert.IsNotNull( response, "SMB_CLOSE response should not be null."); // Check whether server returns a SMB_CLOSE response. Site.Assert.IsInstanceOfType( response, typeof(SmbCloseResponsePacket), "SMB_CLOSE response should be received."); // Check the response validity by verifying the Status field in the SMB Header packet. SmbCloseResponsePacket closeResponse = (SmbCloseResponsePacket)response; Site.Assert.AreEqual <uint>( (uint)SmbStatus.STATUS_SUCCESS, closeResponse.SmbHeader.Status, "SMB_CLOSE response status should be SUCCESS."); #endregion #region Send the SMB_COM_TREE_DISCONNECT request // Create the SMB_COM_TREE_DISCONNECT request. SmbTreeDisconnectRequestPacket treeDisconnectRequest = smbClientStack.CreateTreeDisconnectRequest(treeId); // Send the TreeDisconnect request and expect the response in timeout milliseconds. smbClientStack.SendPacket(treeDisconnectRequest); response = smbClientStack.ExpectPacket(timeout); // Check whether server returns a response. Site.Assert.IsNotNull( response, "SMB_COM_TREE_DISCONNECT response should not be null."); // Check whether server returns a SMB_COM_TREE_DISCONNECT response. Site.Assert.IsInstanceOfType( response, typeof(SmbTreeDisconnectResponsePacket), "SMB_COM_TREE_DISCONNECT response should be received."); // Check the response validity by verifying the Status field in the SMB Header packet. SmbTreeDisconnectResponsePacket treeDisconnectResponse = (SmbTreeDisconnectResponsePacket)response; Site.Assert.AreEqual <uint>( (uint)SmbStatus.STATUS_SUCCESS, treeDisconnectResponse.SmbHeader.Status, "SMB_COM_TREE_DISCONNECT response status should be SUCCESS."); #endregion #region Send the SMB_COM_LOGOFF_ANDX request // Create the SMB_COM_LOGOFF_ANDX request. SmbLogoffAndxRequestPacket logoffRequest = smbClientStack.CreateLogoffRequest(sessionUid); // Send the LogOff request and expect the response in timeout milliseconds. smbClientStack.SendPacket(logoffRequest); response = smbClientStack.ExpectPacket(timeout); // Check whether server returns a response. Site.Assert.IsNotNull( response, "SMB_COM_LOGOFF_ANDX response should not be null."); // Check whether server returns a response. Site.Assert.IsInstanceOfType( response, typeof(SmbLogoffAndxResponsePacket), "SMB_COM_LOGOFF_ANDX response should be received."); // Check the response validity by verifying the Status field in the SMB Header packet. SmbLogoffAndxResponsePacket logoffResponse = (SmbLogoffAndxResponsePacket)response; Site.Assert.AreEqual <uint>( (uint)SmbStatus.STATUS_SUCCESS, logoffResponse.SmbHeader.Status, "SMB_COM_LOGOFF_ANDX response status should be SUCCESS."); #endregion #region Disconnect // Disconnect smbClientStack.Disconnect(); Site.Assert.IsFalse( smbClientStack.IsDataAvailable, "SmbClient should not receive any packet after Disconnect method is called."); #endregion #region Capture requirement r109590 // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-SMB_R109590"); // // Verify MS-SMB requirement: MS-SMB_R109590 // bool isVerifyR109590 = VerifyisVerifyTrans2SetFileInformation( trans2SetFileInformationResponse, trans2SetFileInformationResponse2); Site.CaptureRequirementIfIsTrue( isVerifyR109590, 109590, @"<77> Section 2.2.8.4: Reserved (3 bytes): reply is the same whether zero or non-zero"); #endregion }
/// <summary> /// TRANS2_SET_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="relaceEnable"> /// Indicate whether the new name or link will replace the original one that exists already. /// </param> /// <param name="isUsePassthrough"> /// Indicate whether adding SMB_INFO_PASSTHROUGH in InformationLevel field of the request. /// </param> /// <param name="informationLevel">This can be used to query information from the server.</param> /// <param name="fid">The file identifier.</param> /// <param name="fileName">File name.</param> /// <param name="isRootDirecotyNull">Whether the root directory is null.</param> /// <param name="reserved">The reserved int value.</param> public void Trans2SetFileInfoRequest( int messageId, int sessionId, int treeId, bool isSigned, bool isReplaceEnable, bool isUsePassthrough, [Domain("InfoLevelSetByFid")] InformationLevel informationLevel, int fid, string fileName, bool isRootDirecotyNull, int reserved) { #region Create Packet SmbTrans2SetFileInformationRequestPacket smbPacket = new SmbTrans2SetFileInformationRequestPacket(); ushort uid = (ushort)this.uId[(uint)sessionId]; ushort fileId = (ushort)this.fId[(uint)fid]; ushort level = this.informationLevelBytes[(ushort)informationLevel]; NamespaceCifs.Trans2SmbParametersFlags transactOptions = NamespaceCifs.Trans2SmbParametersFlags.NONE; byte replaceIfExists = byte.MinValue; if (isReplaceEnable) { replaceIfExists++; } this.smbClientStack.Capability.IsUsePathThrough = isUsePassthrough; // Rename data NamespaceFscc.FileRenameInformation_SMB fileRenameInfor = new NamespaceFscc.FileRenameInformation_SMB(); fileRenameInfor.ReplaceIfExists = replaceIfExists; fileRenameInfor.Reserved = new byte[ReservedSize]; fileRenameInfor.FileName = Encoding.Unicode.GetBytes(fileName); fileRenameInfor.FileNameLength = (uint)fileRenameInfor.FileName.Length; fileRenameInfor.RootDirectory = (NamespaceFscc.RootDirectory_Values)uint.MinValue; NamespaceFscc.FsccFileRenameInformationRequestPacket renamePacket = new NamespaceFscc.FsccFileRenameInformationRequestPacket(); renamePacket.FileRenameInformationSmb = fileRenameInfor; smbPacket = this.smbClientStack.CreateTrans2SetFileInformationRequest( fileId, transactOptions, (NamespaceCifs.SetInformationLevel)level, renamePacket.ToBytes()); 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; if (smbErrorHeader.Status == (uint)MessageStatus.StatusInvalidInfoClass) { smbErrorHeader.Status = (uint)MessageStatus.NotSupported; } //Workaround temp code (How To Set TRANS2_SET_FILE_INFORMATION to rename class.) if (informationLevel == InformationLevel.SmbSetFileBasicInfo && !bool.Parse(Site.Properties["IsTDI33017Fixed"])) { this.ErrorResponse(smbErrorHeader.Mid + this.addMidMark, MessageStatus.InvalidParameter); } else { //Workaround temp code (How to trigger ObjectNameNotCollision) if ((isReplaceEnable == false && string.Equals(Site.Properties["SutShareExistFile"], fileName)) && !bool.Parse(Site.Properties["IsTDQ33015Fixed"])) { this.ErrorResponse(smbErrorHeader.Mid + this.addMidMark, MessageStatus.ObjectNameNotCollision); } else { this.ErrorResponse(smbErrorHeader.Mid + this.addMidMark, (MessageStatus)smbErrorHeader.Status); } } } else { SmbTrans2SetFileInformationResponsePacket smbTrans2SetFileInformationPacket = response as SmbTrans2SetFileInformationResponsePacket; NamespaceCifs.SmbHeader trans2SetFileInformationResponseHeader = smbTrans2SetFileInformationPacket.SmbHeader; this.Trans2SetFileInfoResponse( trans2SetFileInformationResponseHeader.Mid + this.addMidMark, this.QueryUidTable(smbPacketResponse), this.QueryTidTable(smbPacketResponse), (smbPacketResponse).IsSignRequired, (MessageStatus)trans2SetFileInformationResponseHeader.Status); } #endregion }
/// <summary> /// find the transaction2 packet. /// </summary> /// <param name="command">the command of transaction2 packet.</param> /// <returns>the target transaction2 packet</returns> private static SmbPacket FindTheTrans2Packet(Trans2SubCommand command) { SmbPacket smbPacket = null; switch ((Trans2SubCommand)command) { case Trans2SubCommand.TRANS2_FIND_FIRST2: smbPacket = new SmbTrans2FindFirst2RequestPacket(); break; case Trans2SubCommand.TRANS2_FIND_NEXT2: smbPacket = new SmbTrans2FindNext2RequestPacket(); break; case Trans2SubCommand.TRANS2_QUERY_FS_INFORMATION: smbPacket = new SmbTrans2QueryFsInformationRequestPacket(); break; case Trans2SubCommand.TRANS2_SET_FS_INFORMATION: smbPacket = new SmbTrans2SetFsInformationRequestPacket(); break; case Trans2SubCommand.TRANS2_QUERY_PATH_INFORMATION: smbPacket = new SmbTrans2QueryPathInformationRequestPacket(); break; case Trans2SubCommand.TRANS2_SET_PATH_INFORMATION: smbPacket = new SmbTrans2SetPathInformationRequestPacket(); break; case Trans2SubCommand.TRANS2_QUERY_FILE_INFORMATION: smbPacket = new SmbTrans2QueryFileInformationRequestPacket(); break; case Trans2SubCommand.TRANS2_SET_FILE_INFORMATION: smbPacket = new SmbTrans2SetFileInformationRequestPacket(); break; case Trans2SubCommand.TRANS2_GET_DFS_REFERRAL: smbPacket = new SmbTrans2GetDfsReferralRequestPacket(); break; default: break; } return smbPacket; }