internal static MessageStatus WorkAroundSetFilePositionInfo(InputBufferSize inputBufferSize, InputBufferCurrentByteOffset currentByteOffset, MessageStatus returnedStatus, ITestSite site) { if (inputBufferSize != InputBufferSize.LessThan && currentByteOffset == InputBufferCurrentByteOffset.NotValid) { // [MS-SMB2] Section 3.3.5.20.1 Handling SMB2_0_INFO_FILE // If the request is for the FilePositionInformation information class, the SMB2 server SHOULD (348) set the CurrentByteOffset field to zero. // (348) Section 3.3.5.20.1: Windows-based SMB2 servers will set CurrentByteOffset to any value. // Per tested with Win2012/Win2012R2 SMB2 server, they return STATUS_SUCCESS. // To keep same model behavior according to MS-FSA, transfer the error code to STATUS_INVALID_PARAMETER returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(3004, MessageStatus.INVALID_PARAMETER, returnedStatus, site); } return(returnedStatus); }
internal static MessageStatus WorkAroundSetFilePositionInfo(InputBufferSize inputBufferSize, InputBufferCurrentByteOffset currentByteOffset, MessageStatus returnedStatus, ITestSite site) { if (inputBufferSize != InputBufferSize.LessThan && currentByteOffset == InputBufferCurrentByteOffset.NotValid) { // [MS-SMB2] Section 3.3.5.20.1 Handling SMB2_0_INFO_FILE // If the request is for the FilePositionInformation information class, the SMB2 server SHOULD (348) set the CurrentByteOffset field to zero. // (348) Section 3.3.5.20.1: Windows-based SMB2 servers will set CurrentByteOffset to any value. // Per tested with Win2012/Win2012R2 SMB2 server, they return STATUS_SUCCESS. // To keep same model behavior according to MS-FSA, transfer the error code to STATUS_INVALID_PARAMETER returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(3004, MessageStatus.INVALID_PARAMETER, returnedStatus, site); } return returnedStatus; }
internal static MessageStatus WorkAroundSetFilePositionInfo(InputBufferSize inputBufferSize, InputBufferCurrentByteOffset currentByteOffset, MessageStatus returnedStatus, ITestSite site) { if (inputBufferSize != InputBufferSize.LessThan && currentByteOffset == InputBufferCurrentByteOffset.NotValid) { // For SMB server, when InputBufferCurrentByteOffset is not valid, it does not failed with STATUS_INVALID_PARAMETER. // Instead, it return with STATUS_SUCCESS, and setting "EaErrorOffset" warning in the response buffer to tell user the offset is not correct. // To keep same model behavior according to MS-FSA, transfer the error code to STATUS_INVALID_PARAMETER returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(3004, MessageStatus.INVALID_PARAMETER, returnedStatus, site); } return(returnedStatus); }
public static MessageStatus SetFilePositionInfo(InputBufferSize inputBufferSize, InputBufferCurrentByteOffset currentByteOffset) { // If InputBufferSize is less than the size, in bytes, of the FILE_POSITION_INFORMATION structure if (inputBufferSize == InputBufferSize.LessThan) { Helper.CaptureRequirement(3002, @"[In FilePositionInformation]Pseudocode for the operation is as follows: If InputBufferSize is less than the size, in bytes, of the FILE_POSITION_INFORMATION structure, the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return MessageStatus.INFO_LENGTH_MISMATCH; } //InputBuffer.CurrentByteOffset is less than 0. if (currentByteOffset == InputBufferCurrentByteOffset.LessThanZero) { Helper.CaptureRequirement(3003, @"[In FilePositionInformation,Pseudocode for the operation is as follows:]The operation MUST be failed with STATUS_INVALID_PARAMETER under either of the following conditions:InputBuffer.CurrentByteOffset is less than 0."); return MessageStatus.INVALID_PARAMETER; } //Open.Mode contains FILE_NO_INTERMEDIATE_BUFFERING and InputBuffer.CurrentByteOffset is not an integer multiple of Open.File.Volume.SectorSize. if (((gOpenMode & CreateOptions.NO_INTERMEDIATE_BUFFERING) != 0) && (currentByteOffset == InputBufferCurrentByteOffset.NotValid)) { Helper.CaptureRequirement(3004, @"[In FilePositionInformation,Pseudocode for the operation is as follows:] The operation MUST be failed with STATUS_INVALID_PARAMETER under either of the following conditions: Open.Mode contains FILE_NO_INTERMEDIATE_BUFFERING and InputBuffer.CurrentByteOffset is not an integer multiple of Open.File.Volume.SectorSize."); return MessageStatus.INVALID_PARAMETER; } Helper.CaptureRequirement(3006, @"[In FilePositionInformation,Pseudocode for the operation is as follows:]The operation returns STATUS_SUCCESS.<63>"); return MessageStatus.SUCCESS; }