internal static MessageStatus WorkaroundFsctlSisCopy(FileSystem fileSystem, BufferSize bufferSize, InputBufferFSCTL_SIS_COPYFILE inputBuffer, bool isCOPYFILE_SIS_LINKTrue, bool isIsEncryptedTrue, MessageStatus returnedStatus, ITestSite site) { if (fileSystem == FileSystem.FAT32) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(4732, MessageStatus.INVALID_DEVICE_REQUEST, returnedStatus, site); } else if (bufferSize == BufferSize.BufferSizeSuccess && inputBuffer == InputBufferFSCTL_SIS_COPYFILE.Initial && isCOPYFILE_SIS_LINKTrue == false && isIsEncryptedTrue == false) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(4773, MessageStatus.SUCCESS, returnedStatus, site); } else if ((bufferSize == BufferSize.LessThanSI_COPYFILE) || (inputBuffer == InputBufferFSCTL_SIS_COPYFILE.FlagsNotContainCOPYFILE_SIS_LINKAndCOPYFILE_SIS_REPLACE) || (inputBuffer == InputBufferFSCTL_SIS_COPYFILE.DestinationFileNameLengthLessThanZero) || (inputBuffer == InputBufferFSCTL_SIS_COPYFILE.DestinationFileNameLengthLargeThanMAXUSHORT) || (inputBuffer == InputBufferFSCTL_SIS_COPYFILE.InputBufferSizeLessThanOtherPlus)) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(4734, MessageStatus.INVALID_PARAMETER, returnedStatus, site); } else if (isCOPYFILE_SIS_LINKTrue || isIsEncryptedTrue) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(4755, MessageStatus.OBJECT_TYPE_MISMATCH, returnedStatus, site); } return(returnedStatus); }
internal WebSocketConfig ValidateInstance() { if (Url.HasNoContent()) { throw new ArgumentNullException(nameof(Url)); } if (BufferSize.HasNoContent() || BufferSize <= 0) { BufferSize = 512; } if (AutoReconnect.HasNoContent()) { AutoReconnect = false; } if (ReconnectInterval.HasNoContent() || ReconnectInterval.Equals(TimeSpan.FromSeconds(0))) { ReconnectInterval = TimeSpan.FromSeconds(10); } if (MaxReconnectAttempts.HasNoContent() || MaxReconnectAttempts == 0) { MaxReconnectAttempts = -1; } if (ConnectionTimeOut.HasNoContent() || ConnectionTimeOut.Equals(TimeSpan.FromSeconds(0))) { ConnectionTimeOut = TimeSpan.FromSeconds(30); } return(this); }
internal static MessageStatus WorkAroundFsCtlGetRetrivalPointsStatus(BufferSize bufferSize, bool isStartingVcnNegative, bool isStartingVcnGreatThanAllocationSize, MessageStatus returnedStatus, ITestSite site) { if ((bufferSize == BufferSize.LessThanSTARTING_VCN_INPUT_BUFFER) || (isStartingVcnNegative && !isStartingVcnGreatThanAllocationSize)) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1103, MessageStatus.INVALID_PARAMETER, returnedStatus, site); } else if (returnedStatus == MessageStatus.NOT_SUPPORTED) { // [MS-SMB] (footnote 136) Section 3.3.5.11.1: // The following FSCTL is explicitly blocked by Windows 8 and Windows Server 2012 and is failed with STATUS_NOT_SUPPORTED. // FSCTL_GET_RETRIEVAL_POINTERS 0x00090073 // Transfer the return code to keep same model behavior if (bufferSize == BufferSize.LessThanRETRIEVAL_POINTERS_BUFFER) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1083, MessageStatus.BUFFER_TOO_SMALL, returnedStatus, site); } else if (bufferSize == BufferSize.BufferSizeSuccess) { if (isStartingVcnGreatThanAllocationSize) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1083, MessageStatus.END_OF_FILE, returnedStatus, site); } else { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(2853, MessageStatus.SUCCESS, returnedStatus, site); } } } return(returnedStatus); }
internal static bool WorkaroundFsCtlGetReparsePoint(BufferSize bufferSize, ReparseTag openFileReparseTag, bool isBytesReturnedSet, ref MessageStatus returnedStatus, ITestSite site) { if ((bufferSize == BufferSize.BufferSizeSuccess && openFileReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG) || (bufferSize == BufferSize.LessThanREPARSE_DATA_BUFFER && openFileReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG) || (bufferSize == BufferSize.BufferSizeSuccess && openFileReparseTag == ReparseTag.IO_REPARSE_TAG_RESERVED_ZERO)) { isBytesReturnedSet = FsaUtility.TransferExpectedResult <bool>(1091, true, isBytesReturnedSet, site); if (returnedStatus == MessageStatus.NOT_A_REPARSE_POINT) { // If the open file is not a reparse point, SMB2 server will return STATUS_NOT_A_REPARSE_POINT // This is acceptable in model and expect as STATUS_SUCCESS. returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(2853, MessageStatus.SUCCESS, returnedStatus, site); } } else if (openFileReparseTag == ReparseTag.EMPTY) { return(isBytesReturnedSet); } else if (((openFileReparseTag != ReparseTag.NON_MICROSOFT_RANGE_TAG) && (BufferSize.LessThanREPARSE_DATA_BUFFER == bufferSize)) || ((openFileReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG) && (BufferSize.LessThanREPARSE_GUID_DATA_BUFFER == bufferSize))) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1083, MessageStatus.BUFFER_TOO_SMALL, returnedStatus, site); } else if (bufferSize == BufferSize.LessThanREPARSE_GUID_DATA_BUFFER && openFileReparseTag == ReparseTag.IO_REPARSE_TAG_RESERVED_ZERO) { isBytesReturnedSet = FsaUtility.TransferExpectedResult <bool>(1091, true, isBytesReturnedSet, site); } return(isBytesReturnedSet); }
internal static MessageStatus WorkaroundFsCtlReadFileUSNData(BufferSize bufferSize, MessageStatus returnedStatus, ITestSite site) { if (bufferSize == BufferSize.LessThanRecordLength) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(3873, MessageStatus.INFO_LENGTH_MISMATCH, returnedStatus, site); } return(returnedStatus); }
internal static MessageStatus WorkaroundFsCtlQueryAllocatedRanges(BufferSize bufferSize, MessageStatus returnedStatus, ref bool isBytesReturnedSet, ITestSite site) { if (bufferSize == BufferSize.OutLessThanFILE_ALLOCATED_RANGE_BUFFER) { isBytesReturnedSet = FsaUtility.TransferExpectedResult <bool>(3778, false, isBytesReturnedSet, site); returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(3778, MessageStatus.BUFFER_TOO_SMALL, returnedStatus, site); } return(returnedStatus); }
/// <summary> /// Defaults constructor. /// </summary> /// <seealso cref= #defaultTempDir() </seealso> /// <seealso cref= BufferSize#automatic() </seealso> public OfflineSorter() : this(DEFAULT_COMPARATOR, BufferSize.Automatic(), DefaultTempDir(), MAX_TEMPFILES) { if (!InstanceFieldsInitialized) { InitializeInstanceFields(); InstanceFieldsInitialized = true; } }
/// <summary> /// Defaults constructor with a custom comparator. /// </summary> /// <seealso cref= #defaultTempDir() </seealso> /// <seealso cref= BufferSize#automatic() </seealso> public OfflineSorter(IComparer <BytesRef> comparator) : this(comparator, BufferSize.Automatic(), DefaultTempDir(), MAX_TEMPFILES) { if (!InstanceFieldsInitialized) { InitializeInstanceFields(); InstanceFieldsInitialized = true; } }
private void CopyFile(object bufferSize) { BufferSize buf = (BufferSize)bufferSize; try { byte[] buffer = new byte[buf.Size]; long AllBytes = 0; using (FileStream fsOut = new FileStream(txtSource.Text, FileMode.Open, FileAccess.Read)) { long fSize = fsOut.Length; int ptr = (int)fSize / buf.Size; using (FileStream fsIn = new FileStream(txtDestinition.Text, FileMode.Create, FileAccess.Write)) { int startmin = DateTime.Now.Minute; int startsec = DateTime.Now.Second; while (true) { pauseEvent.WaitOne(Timeout.Infinite); if (shutdownEvent.WaitOne(0)) { break; } int bytesread = fsOut.Read(buffer, 0, buf.Size); if (bytesread == 0) { break; } fsIn.Write(buffer, 0, bytesread); AllBytes += bytesread; if (bytesread < buf.Size) { break; } progressBar1.Invoke(new Action(() => { progressBar1.Value = (int)(AllBytes * 1000 / fSize); progressBar1.PerformStep(); })); lblPrecentage.Invoke(new Action(() => { float progress = (float)progressBar1.Value / 10; lblPrecentage.Text = string.Format(" {0:F1}% ", progress); })); } int endmin = DateTime.Now.Minute; int endsec = DateTime.Now.Second; buf.AverageSpeed = (int)(fSize / (((endmin - startmin) * 60) + (endsec - startsec)) / 1024); listView1.Invoke(new Action(() => { ListViewItem lstv = listView1.Items.Add(buf.Size.ToString()); lstv.SubItems.Add(buf.AverageSpeed.ToString()); })); } } MessageBox.Show("Копирование завершено"); } catch (Exception e) { MessageBox.Show("Ошибка" + e.Message); } }
public bool Save(string filename) { XElement scanType = XElement.Load(filename); scanType.Element("DefaultScan").Value = ScanType; scanType.Element("BufferSize").Value = BufferSize.ToString(); scanType.Element("DefaultProfile").Value = DefaultProfile; scanType.Save(Filename); return(true); }
public BufferedOutStream(Stream stream, BufferSize bufferSize) { Verify.NotNull(stream, "stream"); this.stream = stream; this.syncLock = new Object(); this.bufferSize = bufferSize; this.bufferStream = new MemoryStream(bufferSize); this.timer = new Timer(state => Flush(), null, TimeSpan.Zero, TimeSpan.FromMilliseconds(25)); //TODO: Issue #18 - Option Configuration. }
internal static bool WorkAroundFsCtlGetReparsePoint(BufferSize bufferSize, ReparseTag openFileReparseTag, bool isBytesReturnedSet, ITestSite site) { if (!((openFileReparseTag == ReparseTag.EMPTY) || ((openFileReparseTag != ReparseTag.NON_MICROSOFT_RANGE_TAG) && (BufferSize.LessThanREPARSE_DATA_BUFFER == bufferSize)) || ((openFileReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG) && (BufferSize.LessThanREPARSE_GUID_DATA_BUFFER == bufferSize)))) { isBytesReturnedSet = FsaUtility.TransferExpectedResult <bool>(1091, true, isBytesReturnedSet, site); } return(isBytesReturnedSet); }
private void btnCopy_Click(object sender, EventArgs e) { BufferSize buffersize = new BufferSize(); if (tag == 0) { buffersize.Size = 512; } else if (tag == 1) { buffersize.Size = 1024; } else if (tag == 2) { buffersize.Size = 2 * 1024; } else if (tag == 3) { buffersize.Size = 4 * 1024; } else if (tag == 4) { buffersize.Size = 16 * 1024; } else if (tag == 5) { buffersize.Size = 64 * 1024; } else if (tag == 6) { buffersize.Size = 256 * 1024; } else if (tag == 7) { buffersize.Size = 1024 * 1024; } else if (tag == 8) { buffersize.Size = 4 * 1024 * 1024; } else if (tag == 9) { buffersize.Size = 16 * 1024 * 1024; } else if (tag == 10) { buffersize.Size = 32 * 1024 * 1024; } thread = new Thread(CopyFile); thread.Start(buffersize); tag++; }
public string GetLogString() { return("FullPath=" + File.ToString() + "\r\n" + "Creator=" + Creator.GetType().FullName + "\r\n" + "CreatedTimestamp=" + CreatedTimestamp.ToString("o") + "\r\n" + "LastAccess=(File: " + _lastAccess.GetFileName() + ", Method: " + _lastAccess.GetMethod().ReflectedType.FullName + ", Line: " + _lastAccess.GetFileLineNumber().ToString() + ")\r\n" + "Mode=" + Mode.ToString() + "\r\n" + "Access=" + Access.ToString() + "\r\n" + "Share=" + Share.ToString() + "\r\n" + "Options=" + Options.ToString() + "\r\n" + "BufferSize=" + BufferSize.ToString()); }
internal static bool WorkAroundFsCtlGetRetrivalPoints(BufferSize bufferSize, bool isStartingVcnNegative, bool isStartingVcnGreatThanAllocationSize, bool isElementsNotAllCopied, bool isBytesReturnedSet, ITestSite site) { if (!((bufferSize == BufferSize.LessThanSTARTING_VCN_INPUT_BUFFER) || (bufferSize == BufferSize.LessThanRETRIEVAL_POINTERS_BUFFER) || (isStartingVcnNegative) || (isStartingVcnGreatThanAllocationSize) || (isElementsNotAllCopied))) { isBytesReturnedSet = FsaUtility.TransferExpectedResult <bool>(5041, true, isBytesReturnedSet, site); } return(isBytesReturnedSet); }
internal static MessageStatus WorkaroundFsCtlGetRetrivalPoints(BufferSize bufferSize, bool isStartingVcnNegative, bool isStartingVcnGreatThanAllocationSize, bool isElementsNotAllCopied, ref bool isBytesReturnedSet, MessageStatus returnedStatus, ITestSite site) { if (bufferSize == BufferSize.LessThanSTARTING_VCN_INPUT_BUFFER || (isStartingVcnNegative && !isStartingVcnGreatThanAllocationSize)) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1103, MessageStatus.INVALID_PARAMETER, returnedStatus, site); } else if (bufferSize == BufferSize.BufferSizeSuccess && !isStartingVcnNegative && !isStartingVcnGreatThanAllocationSize && !isElementsNotAllCopied) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(5041, MessageStatus.SUCCESS, returnedStatus, site); isBytesReturnedSet = FsaUtility.TransferExpectedResult <bool>(1112, true, isBytesReturnedSet, site); } return(returnedStatus); }
internal static MessageStatus WorkaroundFsCtlSetZeroData(BufferSize bufferSize, InputBuffer_FSCTL_SET_ZERO_DATA inputBuffer, bool isIsDeletedTrue, bool isConflictDetected, MessageStatus returnedStatus, ITestSite site) { if (isIsDeletedTrue && bufferSize == BufferSize.BufferSizeSuccess && (inputBuffer == InputBuffer_FSCTL_SET_ZERO_DATA.BufferSuccess || inputBuffer == InputBuffer_FSCTL_SET_ZERO_DATA.FileOffsetGreatThanBeyondFinalZero)) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1309, MessageStatus.FILE_DELETED, returnedStatus, site); } else if (isConflictDetected && bufferSize == BufferSize.BufferSizeSuccess && (inputBuffer == InputBuffer_FSCTL_SET_ZERO_DATA.BufferSuccess || inputBuffer == InputBuffer_FSCTL_SET_ZERO_DATA.FileOffsetGreatThanBeyondFinalZero)) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1316, MessageStatus.FILE_LOCK_CONFLICT, returnedStatus, site); } return(returnedStatus); }
internal BufferBuilder(GraphicsDevice device, BufferSize size) { _device = device; VertexBuffers = new List <DeviceBuffer>(); IndexBuffers = new List <DeviceBuffer>(); IndirectBuffers = new List <IndirectIndirectBuffer>(); IndirectBufferGroups = new List <List <BufferGroup> >(); // Vertex buffer being about 4 times the size of the index buffer is about right. // A vertex is ~16 times the size of an index, but there's ~4 indexes per vertex so it evens out. _indexBufferSize = Sizes[size]; _vertexBufferSize = _indexBufferSize * 4; #if DEBUG AllocationInformation = new List <BufferAllocation>(); #endif }
/// <summary> /// All-details constructor. /// </summary> public OfflineSorter(IComparer <BytesRef> comparer, BufferSize ramBufferSize, DirectoryInfo tempDirectory, int maxTempfiles) { InitializeInstanceFields(); if (ramBufferSize.bytes < ABSOLUTE_MIN_SORT_BUFFER_SIZE) { throw new ArgumentException(MIN_BUFFER_SIZE_MSG + ": " + ramBufferSize.bytes); } if (maxTempfiles < 2) { throw new ArgumentException("maxTempFiles must be >= 2"); } this.ramBufferSize = ramBufferSize; this.maxTempFiles = maxTempfiles; this.comparer = comparer; }
/// <summary> /// All-details constructor. /// </summary> #pragma warning disable IDE0060 // Remove unused parameter public OfflineSorter(IComparer <BytesRef> comparer, BufferSize ramBufferSize, DirectoryInfo tempDirectory, int maxTempfiles) #pragma warning restore IDE0060 // Remove unused parameter { buffer = new BytesRefArray(bufferBytesUsed); if (ramBufferSize.bytes < ABSOLUTE_MIN_SORT_BUFFER_SIZE) { throw new ArgumentException(MIN_BUFFER_SIZE_MSG + ": " + ramBufferSize.bytes); } if (maxTempfiles < 2) { throw new ArgumentOutOfRangeException(nameof(maxTempfiles), "maxTempFiles must be >= 2"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention) } this.ramBufferSize = ramBufferSize; this.maxTempFiles = maxTempfiles; this.comparer = comparer; }
/// <summary> /// All-details constructor. /// </summary> #pragma warning disable IDE0060 // Remove unused parameter public OfflineSorter(IComparer <BytesRef> comparer, BufferSize ramBufferSize, DirectoryInfo tempDirectory, int maxTempfiles) #pragma warning restore IDE0060 // Remove unused parameter { buffer = new BytesRefArray(bufferBytesUsed); if (ramBufferSize.bytes < ABSOLUTE_MIN_SORT_BUFFER_SIZE) { throw new ArgumentException(MIN_BUFFER_SIZE_MSG + ": " + ramBufferSize.bytes); } if (maxTempfiles < 2) { throw new ArgumentException("maxTempFiles must be >= 2"); } this.ramBufferSize = ramBufferSize; this.maxTempFiles = maxTempfiles; this.comparer = comparer; }
internal static MessageStatus WorkAroundFsCtlGetReparsePointStatus(BufferSize bufferSize, ReparseTag openFileReparseTag, MessageStatus returnedStatus, ITestSite site) { if (openFileReparseTag == ReparseTag.EMPTY) { return(returnedStatus); } else if ((openFileReparseTag != ReparseTag.NON_MICROSOFT_RANGE_TAG) && (BufferSize.LessThanREPARSE_DATA_BUFFER == bufferSize)) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1080, MessageStatus.BUFFER_TOO_SMALL, returnedStatus, site); } else if ((openFileReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG) && (BufferSize.LessThanREPARSE_GUID_DATA_BUFFER == bufferSize)) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1083, MessageStatus.BUFFER_TOO_SMALL, returnedStatus, site); } else if (returnedStatus == MessageStatus.NOT_A_REPARSE_POINT && (bufferSize == BufferSize.BufferSizeSuccess || (bufferSize == BufferSize.LessThanREPARSE_DATA_BUFFER && openFileReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG))) { // If the open file is not a reparse point, SMB server will return STATUS_NOT_A_REPARSE_POINT // This is acceptable in model and expect as STATUS_SUCCESS. returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(2853, MessageStatus.SUCCESS, returnedStatus, site); } return(returnedStatus); }
public long GetBufferSize(ImageType imageType, BufferSize bufferSize) { return _currentConfiguration.DotsOneSide * (bufferSize == BufferSize.Scanned ? _linesCount : _currentConfiguration.MaxLines) / (imageType == ImageType.Binary ? DOTS_PER_BYTE_BINARY : DOTS_PER_BYTE_HALFTONE); }
/// <summary> /// Downloads the next portion of a FastTransfer stream. /// </summary> /// <param name="serverId">A 32-bit signed integer represent the Identity of server.</param> /// <param name="downloadHandleIndex">A fast transfer stream object handle index. </param> /// <param name="bufferSize">Specifies the maximum amount of data to be output in the TransferBuffer.</param> /// <param name="transferBufferIndex">The index of data get from the fast transfer stream.</param> /// <param name="abstractFastTransferStream">Fast transfer stream.</param> /// <param name="transferDataSmallOrEqualToBufferSize">Variable to not if the transferData is small or equal to bufferSize</param> /// <returns>Indicate the result of this ROP operation.</returns> public RopResult FastTransferSourceGetBuffer(int serverId, int downloadHandleIndex, BufferSize bufferSize, out int transferBufferIndex, out AbstractFastTransferStream abstractFastTransferStream, out bool transferDataSmallOrEqualToBufferSize) { // Initialize ROP data. SyntacticalBase.AllPropList = null; RopResult returnValue = RopResult.InvalidParameter; this.totalTransferBufferList.Clear(); transferBufferIndex = -1; abstractFastTransferStream = new AbstractFastTransferStream(); transferDataSmallOrEqualToBufferSize = false; if (downloadHandleIndex < 0) { return returnValue; } if (bufferSize == BufferSize.Greater && !Common.IsRequirementEnabled(2625, this.Site)) { returnValue = RopResult.BufferTooSmall; return returnValue; } RopFastTransferSourceGetBufferResponse response = new RopFastTransferSourceGetBufferResponse(); uint sourceHandle = this.handleContainer[downloadHandleIndex]; uint downloadContextHandle = sourceHandle; // Construct ROP request. RopFastTransferSourceGetBufferRequest fastTransferSourceGetBufferRequest; fastTransferSourceGetBufferRequest.RopId = 0x4e; fastTransferSourceGetBufferRequest.LogonId = 0x00; fastTransferSourceGetBufferRequest.InputHandleIndex = 0x00; fastTransferSourceGetBufferRequest.BufferSize = (ushort)bufferSize; if (bufferSize != BufferSize.Normal) { fastTransferSourceGetBufferRequest.MaximumBufferSize = null; } else { fastTransferSourceGetBufferRequest.MaximumBufferSize = (ushort)bufferSize; } bool isRunIntoPartial = false; bool isRunIntoNoRoom = false; do { IDeserializable tempRopResponse = null; if ((tempRopResponse = this.Process(serverId, fastTransferSourceGetBufferRequest, downloadContextHandle)) != null) { // Send request and get response. response = (RopFastTransferSourceGetBufferResponse)tempRopResponse; byte[] transferBuffer = new byte[(int)response.TransferBufferSize]; if (response.ReturnValue == 0) { if (bufferSize != BufferSize.Normal) { transferDataSmallOrEqualToBufferSize = transferBuffer.Length <= (int)bufferSize; } for (int i = 0; i < (int)response.TransferBufferSize; i++) { transferBuffer[i] = response.TransferBuffer[i]; } this.totalTransferBufferList.Add(transferBuffer); if (response.TransferStatus == (ushort)TransferStatus.Partial) { isRunIntoPartial = true; } if (response.TransferStatus == (ushort)TransferStatus.NoRoom) { isRunIntoNoRoom = true; } } } else { break; } } while (response.TransferStatus != (ushort)TransferStatus.Done && (RopResult)response.ReturnValue == RopResult.Success); if (response.TransferBuffer == null) { returnValue = (RopResult)this.ropResult; } else { returnValue = (RopResult)response.ReturnValue; } bool isReachedBufferTooSmall = (bufferSize == BufferSize.Greater) && (returnValue == RopResult.BufferTooSmall); this.VerifyTransferStatus(isRunIntoPartial, isRunIntoNoRoom, isReachedBufferTooSmall); if (isReachedBufferTooSmall) { this.previousGetBufferResult = RopResult.BufferTooSmall; } if (response.TransferStatus == (ushort)TransferStatus.Done) { returnValue = RopResult.Success; int bufferlength = 0; foreach (byte[] blengt in this.totalTransferBufferList) { bufferlength += blengt.Length; } byte[] totalTransferBuffer = new byte[bufferlength]; int index = 0; foreach (byte[] buffer in this.totalTransferBufferList) { Array.Copy(buffer, 0, totalTransferBuffer, index, buffer.Length); index += buffer.Length; } byte[] requiredTransferBuffer = this.ProcessFXSourceGetBuffer(totalTransferBuffer); using (FastTransferStream fs = new FastTransferStream(requiredTransferBuffer, true)) { // Verify FastTransfer Stream this.VerifyFastTransferStream(fs, this.streamType); } abstractFastTransferStream = this.GenerateAbstractFastTransferStream(serverId, requiredTransferBuffer); if (bufferSize == BufferSize.Greater) { transferBufferIndex = -1; } else { transferBufferIndex = AdapterHelper.GetStreamBufferIndex(); } int k = this.streamBufferContainer.Count; foreach (byte[] subBuffer in this.totalTransferBufferList) { this.streamBufferContainer.Add(++k, subBuffer); } } if (response.RopId != 0x00) { // Verify ROP FastTransferSourceGetBuffer this.VerifyRopFastTransferSourceGetBuffer(response); } return returnValue; }
internal static bool WorkaroundFsCtlGetReparsePoint(BufferSize bufferSize, ReparseTag openFileReparseTag, bool isBytesReturnedSet, ref MessageStatus returnedStatus, ITestSite site) { if ((bufferSize == BufferSize.BufferSizeSuccess && openFileReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG) || (bufferSize == BufferSize.LessThanREPARSE_DATA_BUFFER && openFileReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG) || (bufferSize == BufferSize.BufferSizeSuccess && openFileReparseTag == ReparseTag.IO_REPARSE_TAG_RESERVED_ZERO)) { isBytesReturnedSet = FsaUtility.TransferExpectedResult<bool>(1091, true, isBytesReturnedSet, site); if (returnedStatus == MessageStatus.NOT_A_REPARSE_POINT) { // If the open file is not a reparse point, SMB2 server will return STATUS_NOT_A_REPARSE_POINT // This is acceptable in model and expect as STATUS_SUCCESS. returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(2853, MessageStatus.SUCCESS, returnedStatus, site); } } else if (openFileReparseTag == ReparseTag.EMPTY) { return isBytesReturnedSet; } else if (((openFileReparseTag != ReparseTag.NON_MICROSOFT_RANGE_TAG) && (BufferSize.LessThanREPARSE_DATA_BUFFER == bufferSize)) || ((openFileReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG) && (BufferSize.LessThanREPARSE_GUID_DATA_BUFFER == bufferSize))) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(1083, MessageStatus.BUFFER_TOO_SMALL, returnedStatus, site); } else if (bufferSize == BufferSize.LessThanREPARSE_GUID_DATA_BUFFER && openFileReparseTag == ReparseTag.IO_REPARSE_TAG_RESERVED_ZERO) { isBytesReturnedSet = FsaUtility.TransferExpectedResult<bool>(1091, true, isBytesReturnedSet, site); } return isBytesReturnedSet; }
internal static MessageStatus WorkaroundFsCtlQueryAllocatedRanges(BufferSize bufferSize, MessageStatus returnedStatus, ref bool isBytesReturnedSet, ITestSite site) { if (bufferSize == BufferSize.OutLessThanFILE_ALLOCATED_RANGE_BUFFER) { isBytesReturnedSet = FsaUtility.TransferExpectedResult<bool>(3778, false, isBytesReturnedSet, site); returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(3778, MessageStatus.BUFFER_TOO_SMALL, returnedStatus, site); } return returnedStatus; }
internal static MessageStatus WorkaroundFsCtlReadFileUSNData(BufferSize bufferSize, MessageStatus returnedStatus, ITestSite site) { if (bufferSize == BufferSize.LessThanRecordLength) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(3873, MessageStatus.INFO_LENGTH_MISMATCH, returnedStatus, site); } return returnedStatus; }
internal static MessageStatus WorkaroundFsCtlSetZeroData(BufferSize bufferSize, InputBuffer_FSCTL_SET_ZERO_DATA inputBuffer, bool isIsDeletedTrue, bool isConflictDetected, MessageStatus returnedStatus, ITestSite site) { if (isIsDeletedTrue && bufferSize == BufferSize.BufferSizeSuccess && (inputBuffer == InputBuffer_FSCTL_SET_ZERO_DATA.BufferSuccess || inputBuffer == InputBuffer_FSCTL_SET_ZERO_DATA.FileOffsetGreatThanBeyondFinalZero) ) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(1309, MessageStatus.FILE_DELETED, returnedStatus, site); } else if (isConflictDetected && bufferSize == BufferSize.BufferSizeSuccess && (inputBuffer == InputBuffer_FSCTL_SET_ZERO_DATA.BufferSuccess || inputBuffer == InputBuffer_FSCTL_SET_ZERO_DATA.FileOffsetGreatThanBeyondFinalZero)) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(1316, MessageStatus.FILE_LOCK_CONFLICT, returnedStatus, site); } return returnedStatus; }
public static MessageStatus FsCtlSetEncryption( bool isIsCompressedTrue, EncryptionOperation encryptionOpteration, BufferSize bufferSize ) { Condition.IsTrue(bufferSize == BufferSize.LessThanENCRYPTION_BUFFER || bufferSize == BufferSize.BufferSizeSuccess); if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(3891, @"[In FSCTL_SET_ENCRYPTION]If the object store does not implement encryption, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<41>"); return MessageStatus.INVALID_DEVICE_REQUEST; } // If InputBufferSize is smaller than BlockAlign( sizeof( ENCRYPTION_BUFFER ), 4 ), if (bufferSize == BufferSize.LessThanENCRYPTION_BUFFER) { Helper.CaptureRequirement(3899, @"[In FSCTL_SET_ENCRYPTION]If InputBufferSize is smaller than BlockAlign ( sizeof( ENCRYPTION_BUFFER ), 4 ), the operation MUST be failed with STATUS_BUFFER_TOO_SMALL."); return MessageStatus.BUFFER_TOO_SMALL; } // If InputBuffer.EncryptionOperation is not one of the predefined values in [MS-FSCC] section 2.3.47 if (encryptionOpteration == EncryptionOperation.NOT_VALID_IN_FSCC) { Helper.CaptureRequirement(3900, @"[In FSCTL_SET_ENCRYPTION]The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:If InputBuffer.EncryptionOperation is not one of the predefined values in [MS-FSCC] section 2.3.47."); return MessageStatus.INVALID_PARAMETER; } // If InputBuffer.EncryptionOperation == STREAM_SET_ENCRYPTION and Open.Stream.IsCompressed is true. if ((encryptionOpteration == EncryptionOperation.STREAM_SET_ENCRYPTION) && isIsCompressedTrue) { Helper.CaptureRequirement(3901, @"[In FSCTL_SET_ENCRYPTION]The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:If InputBuffer.EncryptionOperation == STREAM_SET_ENCRYPTION and Open.Stream.IsCompressed is TRUE."); return MessageStatus.INVALID_PARAMETER; } Helper.CaptureRequirement(3896, @"[In FSCTL_SET_ENCRYPTION]On completion, the object store MUST return:[Status]."); Helper.CaptureRequirement(3919, @"[In FSCTL_SET_ENCRYPTION]Upon successful completion of this operation, the object store MUST return:Status set to STATUS_SUCCESS."); return MessageStatus.SUCCESS; }
public static MessageStatus FsCtlSetCompression( BufferSize bufferSize, InputBufferCompressionState compressionState, bool isCompressionSupportEnabled ) { Condition.IsTrue(bufferSize == BufferSize.LessThanTwoBytes || bufferSize == BufferSize.BufferSizeSuccess); if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(7732, @"[ In FSCTL_SET_COMPRESSION]On completion, the object store MUST return:[Status]."); return MessageStatus.INVALID_DEVICE_REQUEST; } if (bufferSize == BufferSize.LessThanTwoBytes) { Helper.CaptureRequirement(1142, @"[ In FSCTL_SET_COMPRESSION]The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:InputBufferSize is less than sizeof( USHORT ) (2 bytes)."); return MessageStatus.INVALID_PARAMETER; } if (compressionState == InputBufferCompressionState.NotPrefinedValue) { Helper.CaptureRequirement(1143, @"[ In FSCTL_SET_COMPRESSION]The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:InputBuffer.CompressionState is not one of the predefined values in [MS-FSCC] section 2.3.45."); return MessageStatus.INVALID_PARAMETER; } if (compressionState != InputBufferCompressionState.COMPRESSION_FORMAT_NONE && !isCompressionSupportEnabled) { Helper.CaptureRequirement(1144, @"[ In FSCTL_SET_COMPRESSION]Pseudocode for the operation is as follows: If InputBuffer.CompressionState != COMPRESSION_FORMAT_NONE:If compression support is disabled in the object store<39>, the operation MUST be failed with STATUS_COMPRESSION_DISABLED."); return MessageStatus.COMPRESSION_DISABLED; } Helper.CaptureRequirement(1266, @"[ In FSCTL_SET_COMPRESSION]On completion, the object store MUST return:[Status]."); Helper.CaptureRequirement(1724, @"[ In FSCTL_SET_COMPRESSION]If (InputBuffer.CompressionState == COMPRESSION_FORMAT_NONE and Open.Stream.IsCompressed is FALSE),the operation MUST immediately return STATUS_SUCCESS."); Helper.CaptureRequirement(1725, @"[ In FSCTL_SET_COMPRESSION]If (InputBuffer.CompressionState != COMPRESSION_FORMAT_NONE and Open.Stream.IsCompressed is TRUE), the operation MUST immediately return STATUS_SUCCESS."); Helper.CaptureRequirement(1169, @"[ In FSCTL_SET_COMPRESSION]Upon successful completion of the operation, the object store MUST return:[ Status set to STATUS_SUCCESS]."); return MessageStatus.SUCCESS; }
public static MessageStatus FsCtlSetDefectManagement( BufferSize bufferSize, bool isOpenListContainMoreThanOneOpen ) { Condition.IsTrue(bufferSize == BufferSize.LessThanOneBytes || bufferSize == BufferSize.BufferSizeSuccess); if (isObjectImplementedFunctionality) { Helper.CaptureRequirement(4147, @"[ In FSCTL_SET_DEFECT_MANAGEMENT] If the object store does not implement this functionality or the target media is not a software defect-managed media, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<40>"); return MessageStatus.INVALID_DEVICE_REQUEST; } if (bufferSize == BufferSize.LessThanOneBytes) { Helper.CaptureRequirement(1178, @"[ In FSCTL_SET_DEFECT_MANAGEMENT, Pseudocode for the operation is as follows] If InputBufferSize is less than sizeof( Boolean ) (1 byte), the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } Helper.CaptureRequirement(1182, @"[ In FSCTL_SET_DEFECT_MANAGEMENT]Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); Helper.CaptureRequirement(1176, @"[ In FSCTL_SET_DEFECT_MANAGEMENT]On completion, the object store MUST return:Status: An NTSTATUS code that specifies the result."); return MessageStatus.SUCCESS; }
public static MessageStatus FsCtlReadFileUSNData( BufferSize bufferSize, out bool isBytesReturnedSet ) { Condition.IsTrue(bufferSize == BufferSize.LessThanUSN_RECORD || bufferSize == BufferSize.LessThanRecordLength || bufferSize == BufferSize.BufferSizeSuccess); isBytesReturnedSet = false; if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(7936, @"[In FSCTL_READ_FILE_USN_DATA] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST. <36>"); return MessageStatus.INVALID_DEVICE_REQUEST; } // If OutputBufferSize is less than the size of USN_RECORD in bytes if (bufferSize == BufferSize.LessThanUSN_RECORD) { Helper.CaptureRequirement(3866, @"[In FSCTL_READ_FILE_USN_DATA] Pseudocode for the operation is as follows: If OutputBufferSize is less than sizeof( USN_RECORD ), the operation MUST be failed with STATUS_BUFFER_TOO_SMALL."); return MessageStatus.BUFFER_TOO_SMALL; } if (bufferSize == BufferSize.LessThanRecordLength) { Helper.CaptureRequirement(3873, @"[In FSCTL_READ_FILE_USN_DATA]If OutputBufferSize is less than RecordLength, the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return MessageStatus.INFO_LENGTH_MISMATCH; } isBytesReturnedSet = true; Helper.CaptureRequirement(3888, @"[In FSCTL_READ_FILE_USN_DATA]Upon successful completion of the operation, the object store MUST return:BytesReturned set to RecordLength."); Helper.CaptureRequirement(3860, @"[In FSCTL_READ_FILE_USN_DATA]On completion, the object store MUST return: [Status ,OutputBuffer ,BytesReturned]."); Helper.CaptureRequirement(3889, @"[In FSCTL_READ_FILE_USN_DATA]Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); return MessageStatus.SUCCESS; }
// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (AsJob.Expression != null) { targetCommand.AddParameter("AsJob", AsJob.Get(context)); } if (DcomAuthentication.Expression != null) { targetCommand.AddParameter("DcomAuthentication", DcomAuthentication.Get(context)); } if (WsmanAuthentication.Expression != null) { targetCommand.AddParameter("WsmanAuthentication", WsmanAuthentication.Get(context)); } if (Protocol.Expression != null) { targetCommand.AddParameter("Protocol", Protocol.Get(context)); } if (BufferSize.Expression != null) { targetCommand.AddParameter("BufferSize", BufferSize.Get(context)); } if (ComputerName.Expression != null) { targetCommand.AddParameter("ComputerName", ComputerName.Get(context)); } if (Count.Expression != null) { targetCommand.AddParameter("Count", Count.Get(context)); } if (Credential.Expression != null) { targetCommand.AddParameter("Credential", Credential.Get(context)); } if (Source.Expression != null) { targetCommand.AddParameter("Source", Source.Get(context)); } if (Impersonation.Expression != null) { targetCommand.AddParameter("Impersonation", Impersonation.Get(context)); } if (ThrottleLimit.Expression != null) { targetCommand.AddParameter("ThrottleLimit", ThrottleLimit.Get(context)); } if (TimeToLive.Expression != null) { targetCommand.AddParameter("TimeToLive", TimeToLive.Get(context)); } if (Delay.Expression != null) { targetCommand.AddParameter("Delay", Delay.Get(context)); } if (Quiet.Expression != null) { targetCommand.AddParameter("Quiet", Quiet.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }
private void Update(EvaluationContext context) { var text = Text.GetValue(context); var bufferSize = BufferSize.GetValue(context); var wrapText = WrapText.GetValue(context); var textOffset = TextOffset.GetValue(context); var columns = bufferSize.Width; var rows = bufferSize.Height; if (columns <= 0 || rows <= 0) { return; } if (string.IsNullOrEmpty(text)) { return; } var textCycle = (int)textOffset.X + (int)(textOffset.Y) * columns; var size = rows * columns; if (_bufferContent == null || _bufferContent.Length != size) { _bufferContent = new BufferLayout[size]; } var index = 0; char c; var highlightChars = HighlightCharacters.GetValue(context); for (var rowIndex = 0; rowIndex < rows; rowIndex++) { for (var columnIndex = 0; columnIndex < columns; columnIndex++) { if (wrapText) { var i = (index + textCycle) % text.Length; if (i < 0) { i += text.Length; } c = text[i]; } else { var i = index + textCycle; var indexIsValid = i >= 0 && i < text.Length; c = indexIsValid ? text[i] : ' '; } var highlight = highlightChars.IndexOf(c) > -1 ? 1f : 0; // oh, that's slow! _bufferContent[index] = new BufferLayout( pos: new Vector2((float)columnIndex / columns, 1 - (float)rowIndex / rows), uv: new Vector2(c % 16, (c >> 4)), highlight: highlight); index++; } } ResourceManager.Instance().SetupStructuredBuffer(_bufferContent, ref Buffer.Value); Buffer.Value.DebugName = nameof(TypoGridBuffer); VertexCount.Value = size * 6; }
/// <summary> /// Defaults constructor. /// </summary> /// <seealso cref="DefaultTempDir()"/> /// <seealso cref="BufferSize.Automatic()"/> public OfflineSorter() : this(DEFAULT_COMPARER, BufferSize.Automatic(), DefaultTempDir(), MAX_TEMPFILES) { }
internal static MessageStatus WorkaroundFsCtlForEasyRequest(FileSystem fileSystem, FsControlRequestType requestType, BufferSize bufferSize, bool fileVolReadOnly, bool fileVolUsnAct, ref bool isBytesReturnedSet, ref bool isOutputBufferSizeReturn, MessageStatus returnedStatus, ITestSite site) { if (requestType == FsControlRequestType.RECALL_FILE) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1136, MessageStatus.SUCCESS, returnedStatus, site); } else if (requestType == FsControlRequestType.FSCTL_SET_SHORT_NAME_BEHAVIOR) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1274, MessageStatus.INVALID_DEVICE_REQUEST, returnedStatus, site); } else if (requestType == FsControlRequestType.WRITE_USN_CLOSE_RECORD && bufferSize == BufferSize.LessThanTwoBytes && !fileVolReadOnly && fileVolUsnAct) { isBytesReturnedSet = FsaUtility.TransferExpectedResult <bool>(3966, true, isBytesReturnedSet, site); } else if (requestType == FsControlRequestType.SET_ZERO_ON_DEALLOCATION && bufferSize == BufferSize.LessThanSizeofUsn) { isBytesReturnedSet = FsaUtility.TransferExpectedResult <bool>(1388, false, isBytesReturnedSet, site); } else if (requestType == FsControlRequestType.SET_OBJECT_ID && bufferSize == BufferSize.LessThan0x24 && !fileVolReadOnly && !fileVolUsnAct) { isBytesReturnedSet = FsaUtility.TransferExpectedResult <bool>(1068, true, isBytesReturnedSet, site); } else if (requestType == FsControlRequestType.QUERY_FAT_BPB && bufferSize == BufferSize.LessThanTotalSizeOfStatistics) { isBytesReturnedSet = FsaUtility.TransferExpectedResult <bool>(1121, true, isBytesReturnedSet, site); } else if (requestType == FsControlRequestType.QUERY_ON_DISK_VOLUME_INFO && bufferSize == BufferSize.LessThanFILE_QUERY_SPARING_BUFFER && fileVolReadOnly && fileVolUsnAct) { isBytesReturnedSet = FsaUtility.TransferExpectedResult <bool>(5522, true, isBytesReturnedSet, site); } else if (requestType == FsControlRequestType.WRITE_USN_CLOSE_RECORD && returnedStatus == MessageStatus.JOURNAL_NOT_ACTIVE && fileSystem == FileSystem.NTFS) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1274, MessageStatus.SUCCESS, returnedStatus, site); isBytesReturnedSet = FsaUtility.TransferExpectedResult <bool>(3966, true, isBytesReturnedSet, site); isOutputBufferSizeReturn = FsaUtility.TransferExpectedResult <bool>(3966, true, isOutputBufferSizeReturn, site); } else if (fileSystem != FileSystem.NTFS && requestType == FsControlRequestType.SET_ZERO_ON_DEALLOCATION) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(4721, MessageStatus.INVALID_DEVICE_REQUEST, returnedStatus, site); isBytesReturnedSet = FsaUtility.TransferExpectedResult <bool>(4721, false, isBytesReturnedSet, site); isOutputBufferSizeReturn = FsaUtility.TransferExpectedResult <bool>(4721, false, isOutputBufferSizeReturn, site); } else if (fileSystem == FileSystem.FAT32 && requestType == FsControlRequestType.FSCTL_FILESYSTEM_GET_STATISTICS) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(5803, MessageStatus.INVALID_DEVICE_REQUEST, returnedStatus, site); isBytesReturnedSet = FsaUtility.TransferExpectedResult <bool>(5803, false, isBytesReturnedSet, site); isOutputBufferSizeReturn = FsaUtility.TransferExpectedResult <bool>(5803, false, isOutputBufferSizeReturn, site); } return(returnedStatus); }
public static MessageStatus FsCtlSetObjID( FsControlRequestType requestType, BufferSize bufferSize ) { Condition.IsTrue(bufferSize == BufferSize.NotEqualFILE_OBJECTID_BUFFER || bufferSize == BufferSize.NotEqual48Bytes || bufferSize == BufferSize.BufferSizeSuccess); Condition.IsTrue(requestType == FsControlRequestType.SET_OBJECT_ID || requestType == FsControlRequestType.SET_OBJECT_ID_EXTENDED); switch (requestType) { case FsControlRequestType.SET_OBJECT_ID: { #region 23 if (!IsImplement_FSCTL_SET_OBJECT_ID) { Helper.CaptureRequirement(4326, @"[ In FSCTL_SET_OBJECT_ID] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<42>"); return MessageStatus.INVALID_DEVICE_REQUEST; } if (bufferSize == BufferSize.NotEqualFILE_OBJECTID_BUFFER || bufferSize == BufferSize.NotEqual48Bytes) { Helper.CaptureRequirement(1188, @"[ In FSCTL_SET_OBJECT_ID]Pseudocode for the operation is as follows: If InputBufferSize is not equal to sizeof( FILE_OBJECTID_BUFFER ), the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } if (!gisObjectIDsSupported) { Helper.CaptureRequirement(4327, @"[ In FSCTL_SET_OBJECT_ID,Pseudocode for the operation is as follows:] If Open.File.Volume.IsObjectIDsSupported is FALSE, the operation MUST be failed with STATUS_VOLUME_NOT_UPGRADED."); return MessageStatus.STATUS_VOLUME_NOT_UPGRADED; } if (!isHasRestoreAccess) { Helper.CaptureRequirement(1190, @"[ In FSCTL_SET_OBJECT_ID,Pseudocode for the operation is as follows:] If Open.HasRestoreAccess is FALSE, the operation MUST be failed with STATUS_ACCESS_DENIED."); return MessageStatus.ACCESS_DENIED; } Helper.CaptureRequirement(1200, @"[ In FSCTL_SET_OBJECT_ID]Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); Helper.CaptureRequirement(1187, @"[ In FSCTL_SET_OBJECT_ID]On completion, the object store MUST return: Status ¨C An NTSTATUS code that specifies the result."); return MessageStatus.SUCCESS; #endregion } case FsControlRequestType.SET_OBJECT_ID_EXTENDED: { #region 24 if (!IsImplement_FSCTL_SET_OBJECT_ID) { Helper.CaptureRequirement(4329, @"[ In FSCTL_SET_OBJECT_ID_EXTENDED] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<44>"); return MessageStatus.INVALID_DEVICE_REQUEST; } if (bufferSize == BufferSize.NotEqual48Bytes) { Helper.CaptureRequirement(1207, @"[ In FSCTL_SET_OBJECT_ID_EXTENDED]Pseudocode for the operation is as follows: If InputBufferSize is not equal to sizeof( ObjectId.ExtendedInfo ) (48 bytes), the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } if (!gisObjectIDsSupported) { Helper.CaptureRequirement(4327, @"[ In FSCTL_SET_OBJECT_ID,Pseudocode for the operation is as follows:] If Open.File.Volume.IsObjectIDsSupported is FALSE, the operation MUST be failed with STATUS_VOLUME_NOT_UPGRADED."); return MessageStatus.STATUS_VOLUME_NOT_UPGRADED; } if (!isHasRestoreAccess) { Helper.CaptureRequirement(1190, @"[ In FSCTL_SET_OBJECT_ID,Pseudocode for the operation is as follows:] If Open.HasRestoreAccess is FALSE, the operation MUST be failed with STATUS_ACCESS_DENIED."); return MessageStatus.ACCESS_DENIED; } Helper.CaptureRequirement(1217, @"[ In FSCTL_SET_OBJECT_ID_EXTENDED]Upon successful completion of this operation, the object store MUST return:Status set to STATUS_SUCCESS."); Helper.CaptureRequirement(1206, @"[ In FSCTL_SET_OBJECT_ID_EXTENDED]On completion, the object store MUST return: Status ¨C An NTSTATUS code that specifies the result."); return MessageStatus.SUCCESS; #endregion } default: return MessageStatus.SUCCESS; } }
internal static MessageStatus WorkaroundFsctlSisCopy(BufferSize bufferSize, InputBufferFSCTL_SIS_COPYFILE inputBuffer, bool isCOPYFILE_SIS_LINKTrue, bool isIsEncryptedTrue, MessageStatus returnedStatus, ITestSite site) { if (bufferSize == BufferSize.BufferSizeSuccess && inputBuffer == InputBufferFSCTL_SIS_COPYFILE.Initial && isCOPYFILE_SIS_LINKTrue == false && isIsEncryptedTrue == false) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(4773, MessageStatus.SUCCESS, returnedStatus, site); } else if ((bufferSize == BufferSize.LessThanSI_COPYFILE) || (inputBuffer == InputBufferFSCTL_SIS_COPYFILE.FlagsNotContainCOPYFILE_SIS_LINKAndCOPYFILE_SIS_REPLACE) || (inputBuffer == InputBufferFSCTL_SIS_COPYFILE.DestinationFileNameLengthLessThanZero) || (inputBuffer == InputBufferFSCTL_SIS_COPYFILE.DestinationFileNameLengthLargeThanMAXUSHORT) || (inputBuffer == InputBufferFSCTL_SIS_COPYFILE.InputBufferSizeLessThanOtherPlus)) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(4734, MessageStatus.INVALID_PARAMETER, returnedStatus, site); } else if (isCOPYFILE_SIS_LINKTrue || isIsEncryptedTrue) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(4755, MessageStatus.OBJECT_TYPE_MISMATCH, returnedStatus, site); } return returnedStatus; }
internal static MessageStatus WorkaroundFsCtlSetObjID(FsControlRequestType requestType, BufferSize bufferSize, MessageStatus returnedStatus, ITestSite site) { if (returnedStatus != MessageStatus.INVALID_DEVICE_REQUEST) { if (requestType == FsControlRequestType.SET_OBJECT_ID_EXTENDED && bufferSize == BufferSize.NotEqualFILE_OBJECTID_BUFFER) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1206, MessageStatus.SUCCESS, returnedStatus, site); } else if ((requestType == FsControlRequestType.SET_OBJECT_ID || requestType == FsControlRequestType.SET_OBJECT_ID_EXTENDED) && bufferSize == BufferSize.BufferSizeSuccess) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1187, MessageStatus.SUCCESS, returnedStatus, site); } } return(returnedStatus); }
public long GetBufferSize(ImageType imageType, BufferSize bufferSize) { return _scanner.GetBufferSize(imageType, bufferSize); }
internal static MessageStatus WorkaroundFsCtlSetEncrypion(bool isIsCompressedTrue, EncryptionOperation encryptionOpteration, BufferSize bufferSize, MessageStatus returnedStatus, ITestSite site) { if (bufferSize == BufferSize.LessThanENCRYPTION_BUFFER) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(3899, MessageStatus.BUFFER_TOO_SMALL, returnedStatus, site); } else if ((encryptionOpteration == EncryptionOperation.NOT_VALID_IN_FSCC) || ((encryptionOpteration == EncryptionOperation.STREAM_SET_ENCRYPTION) && isIsCompressedTrue)) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(3900, MessageStatus.INVALID_PARAMETER, returnedStatus, site); } else if (!isIsCompressedTrue && encryptionOpteration == EncryptionOperation.STREAM_SET_ENCRYPTION && bufferSize == BufferSize.BufferSizeSuccess) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(3919, MessageStatus.SUCCESS, returnedStatus, site); } return returnedStatus; }
internal static MessageStatus WorkaroundFsCtlSetReparsePoint(ReparseTag inputReparseTag, BufferSize bufferSize, bool isReparseGUIDNotEqual, bool isFileReparseTagNotEqualInputBufferReparseTag, MessageStatus returnedStatus, ITestSite site) { if ((inputReparseTag == ReparseTag.SYMLINK)) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(1231, MessageStatus.ACCESS_DENIED, returnedStatus, site); } else if (returnedStatus == MessageStatus.INVALID_PARAMETER) { if (inputReparseTag != ReparseTag.EMPTY) { if (isFileReparseTagNotEqualInputBufferReparseTag) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(1237, MessageStatus.IO_REPARSE_TAG_MISMATCH, returnedStatus, site); } else if ((inputReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG) && (!isReparseGUIDNotEqual)) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(1238, MessageStatus.REPARSE_ATTRIBUTE_CONFLICT, returnedStatus, site); } } else { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(1246, MessageStatus.SUCCESS, returnedStatus, site); } } return returnedStatus; }
internal static MessageStatus WorkaroundFsCtlSetReparsePoint(FileSystem fileSystem, ReparseTag inputReparseTag, BufferSize bufferSize, bool isReparseGUIDNotEqual, bool isFileReparseTagNotEqualInputBufferReparseTag, MessageStatus returnedStatus, ITestSite site) { if (fileSystem != FileSystem.NTFS && fileSystem != FileSystem.REFS) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(4331, MessageStatus.INVALID_DEVICE_REQUEST, returnedStatus, site); } else if ((inputReparseTag == ReparseTag.SYMLINK)) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1231, MessageStatus.ACCESS_DENIED, returnedStatus, site); } else if (returnedStatus == MessageStatus.INVALID_PARAMETER) { if (inputReparseTag != ReparseTag.EMPTY) { if (isFileReparseTagNotEqualInputBufferReparseTag) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1237, MessageStatus.IO_REPARSE_TAG_MISMATCH, returnedStatus, site); } else if ((inputReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG) && (!isReparseGUIDNotEqual)) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1238, MessageStatus.REPARSE_ATTRIBUTE_CONFLICT, returnedStatus, site); } } else { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(1246, MessageStatus.SUCCESS, returnedStatus, site); } } return(returnedStatus); }
public static MessageStatus FsctlSisCopyFile( BufferSize bufferSize, InputBufferFSCTL_SIS_COPYFILE inputBuffer, bool isCOPYFILE_SIS_LINKTrue, bool isIsEncryptedTrue ) { Condition.IsTrue(bufferSize == BufferSize.LessThanSI_COPYFILE || bufferSize == BufferSize.BufferSizeSuccess); if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(4732, @"[In FSCTL_SIS_COPYFILE] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST."); return MessageStatus.INVALID_DEVICE_REQUEST; } if (!isIsAdministratorTrue) { Helper.CaptureRequirement(4733, @"[In FSCTL_SIS_COPYFILE] Pseudocode for the operation is as follows: If Open.IsAdministrator is FALSE, the operation MUST be failed with STATUS_ACCESS_DEFINED"); return MessageStatus.ACCESS_DENIED; } if (isCOPYFILE_SIS_LINKTrue) { Helper.CaptureRequirement(4755, @"In FSCTL_SIS_COPYFILE,Pseudocode for the operation is as follows: The operation MUST be failed with STATUS_OBJECT_TYPE_MISMATCH under any of the following conditions:] If SourceOpen.File.ReparseTag is empty and InputBuffer.Flags.COPYFILE_SIS_LINK is TRUE."); return MessageStatus.OBJECT_TYPE_MISMATCH; } if (bufferSize == BufferSize.LessThanSI_COPYFILE) { Helper.CaptureRequirement(4734, @"[In FSCTL_SIS_COPYFILE,Pseudocode for the operation is as follows:] If InputBufferSizes is less than sizeof( SI_COPYFILE ), the operation MUST be failed with STATUS_INVALID_PARAMETER_1."); return MessageStatus.INVALID_PARAMETER; } if (inputBuffer == InputBufferFSCTL_SIS_COPYFILE.FlagsNotContainCOPYFILE_SIS_LINKAndCOPYFILE_SIS_REPLACE) { Helper.CaptureRequirement(4735, @"[In FSCTL_SIS_COPYFILE,Pseudocode for the operation is as follows:] If InputBuffer.Flags contains any flags besides COPYFILE_SIS_LINK and COPYFILE_SIS_REPLACE, the operation MUST be failed with STATUS_INVALID_PARAMETER_2."); return MessageStatus.INVALID_PARAMETER; } if (inputBuffer == InputBufferFSCTL_SIS_COPYFILE.DestinationFileNameLengthLessThanZero) { Helper.CaptureRequirement(4737, @"[In FSCTL_SIS_COPYFILE,Pseudocode for the operation is as follows:] If InputBuffer.DestinationFileNameLength is <= zero, the operation MUST be failed with STATUS_INVALID_PARAMETER_3."); return MessageStatus.INVALID_PARAMETER; } if (inputBuffer == InputBufferFSCTL_SIS_COPYFILE.DestinationFileNameLengthLargeThanMAXUSHORT) { Helper.CaptureRequirement(4739, @"[In FSCTL_SIS_COPYFILE,Pseudocode for the operation is as follows:] If InputBuffer.DestinationFileNameLength is > MAXUSHORT (0xffff), the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } if (inputBuffer == InputBufferFSCTL_SIS_COPYFILE.InputBufferSizeLessThanOtherPlus) { Helper.CaptureRequirement(4740, @"[In FSCTL_SIS_COPYFILE,Pseudocode for the operation is as follows:] If FieldOffset( InputBuffer.SourceFileName ) + InputBuffer.SourceFileNameLength + InputBuffer.DestinationFileNameLength is > InputBufferSize, the operation MUST be failed with STATUS_INVALID_PARAMETER_4."); return MessageStatus.INVALID_PARAMETER; } if (isIsEncryptedTrue) { return MessageStatus.OBJECT_TYPE_MISMATCH; } Helper.CaptureRequirement(4726, @"[In FSCTL_SIS_COPYFILE] On completion, the object store MUST return:Status: An NTSTATUS code that specifies the result."); Helper.CaptureRequirement(4752, @"[In FSCTL_SIS_COPYFILE,Pseudocode for the operation is as follows:] If the request fails, this operation MUST be failed with the returned STATUS."); Helper.CaptureRequirement(4769, @"[In FSCTL_SIS_COPYFILE,Pseudocode for the operation is as follows:] If the request fails, this operation MUST be failed with the returned STATUS."); Helper.CaptureRequirement(4773, @"[In FSCTL_SIS_COPYFILE,Pseudocode for the operation is as follows: The operation MUST be failed with STATUS_OBJECT_TYPE_MISMATCH under any of the following conditions:] If SourceOpen.Stream.IsEncrypted is TRUE."); return MessageStatus.SUCCESS; }
internal static MessageStatus WorkaroundFsCtlGetRetrivalPoints(BufferSize bufferSize, bool isStartingVcnNegative, bool isStartingVcnGreatThanAllocationSize, bool isElementsNotAllCopied, ref bool isBytesReturnedSet, MessageStatus returnedStatus, ITestSite site) { if (bufferSize == BufferSize.LessThanSTARTING_VCN_INPUT_BUFFER || (isStartingVcnNegative && !isStartingVcnGreatThanAllocationSize)) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(1103, MessageStatus.INVALID_PARAMETER, returnedStatus, site); } else if (bufferSize == BufferSize.BufferSizeSuccess && !isStartingVcnNegative && !isStartingVcnGreatThanAllocationSize && !isElementsNotAllCopied) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(5041, MessageStatus.SUCCESS, returnedStatus, site); isBytesReturnedSet = FsaUtility.TransferExpectedResult<bool>(1112, true, isBytesReturnedSet, site); } return returnedStatus; }
public static MessageStatus FsCtlCreateOrGetObjId( BufferSize bufferSize, out bool isBytesReturnedSet ) { Condition.IsTrue(bufferSize == BufferSize.LessThanFILE_OBJECTID_BUFFER || bufferSize == BufferSize.BufferSizeSuccess); isBytesReturnedSet = false; if (!IsImplement_FSCTL_CREATE_OR_GET_OBJECT_ID) { Helper.CaptureRequirement(951, @"[In FSCTL_CREATE_OR_GET_OBJECT_ID,Pseudocode for the operation is as follows: ] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<16>"); return MessageStatus.INVALID_DEVICE_REQUEST; } if (!gisObjectIDsSupported) { Helper.CaptureRequirement(4993, @"[In FSCTL_CREATE_OR_GET_OBJECT_ID ] Pseudocode for the operation is as follows: If Open.File.Volume.IsObjectIDsSupported is FALSE, the operation MUST be failed with STATUS_VOLUME_NOT_UPGRADED."); return MessageStatus.STATUS_VOLUME_NOT_UPGRADED; } // If OutputBufferSize is less than the size of FILE_OBJECTID_BUFFER if (bufferSize == BufferSize.LessThanFILE_OBJECTID_BUFFER) { Helper.CaptureRequirement(4994, @"[In FSCTL_CREATE_OR_GET_OBJECT_ID,Pseudocode for the operation is as follows:] If OutputBufferSize is less than sizeof( FILE_OBJECTID_BUFFER ), the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } Helper.CaptureRequirement(947, @"[In FSCTL_CREATE_OR_GET_OBJECT_ID ]On completion, the object store MUST return: [Status,OutputBuffer,BytesReturned]."); Helper.CaptureRequirement(965, @"[In FSCTL_CREATE_OR_GET_OBJECT_ID,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); Helper.CaptureRequirement(964, @"[In FSCTL_CREATE_OR_GET_OBJECT_ID,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:BytesReturned set to sizeof( FILE_OBJECTID_BUFFER )."); isBytesReturnedSet = true; return MessageStatus.SUCCESS; }
internal static MessageStatus WorkaroundFsCtlSetEncrypion(FileSystem fileSystem, bool isIsCompressedTrue, EncryptionOperation encryptionOpteration, BufferSize bufferSize, MessageStatus returnedStatus, ITestSite site) { if (fileSystem == FileSystem.FAT32) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(3891, MessageStatus.INVALID_DEVICE_REQUEST, returnedStatus, site); } else if (bufferSize == BufferSize.LessThanENCRYPTION_BUFFER) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(3899, MessageStatus.BUFFER_TOO_SMALL, returnedStatus, site); } else if ((encryptionOpteration == EncryptionOperation.NOT_VALID_IN_FSCC) || ((encryptionOpteration == EncryptionOperation.STREAM_SET_ENCRYPTION) && isIsCompressedTrue)) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(3900, MessageStatus.INVALID_PARAMETER, returnedStatus, site); } else if (!isIsCompressedTrue && encryptionOpteration == EncryptionOperation.STREAM_SET_ENCRYPTION && bufferSize == BufferSize.BufferSizeSuccess) { returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(3919, MessageStatus.SUCCESS, returnedStatus, site); } return(returnedStatus); }
public static MessageStatus FsCtlFindFilesBySID( bool openFileVolQuoInfoEmpty, BufferSize bufferSize, bool linkOwnerSidEqualSID, bool outPutBufLessLinkSize, bool isOutputBufferOffset, out bool isBytesReturnedSet ) { Condition.IsTrue(bufferSize == BufferSize.LessThanFILE_NAME_INFORMATION || bufferSize == BufferSize.BufferSizeSuccess); isBytesReturnedSet = false; if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(5005, @"[In FSCTL_FIND_FILES_BY_SID] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<25> "); return MessageStatus.INVALID_DEVICE_REQUEST; } // If Open.HasManageVolumePrivilege is FALSE and Open.HasBackupPrivilege is FALSE if (!openHasManageVolPrivilege && !openHasBackupPrivage) { Helper.CaptureRequirement(1022, @"[In FSCTL_FIND_FILES_BY_SID,Pseudocode for the operation is as follows:] If Open.HasManageVolumeAccess is FALSE and Open.HasBackupAccess is FALSE, the operation MUST be failed with STATUS_ACCESS_DENIED."); return MessageStatus.ACCESS_DENIED; } // If Open.File.Volume.QuotaInformation is empty if (openFileVolQuoInfoEmpty) { Helper.CaptureRequirement(1023, @"[In FSCTL_FIND_FILES_BY_SID,Pseudocode for the operation is as follows:] If Open.File.Volume.QuotaInformation is empty, the operation MUST be failed with STATUS_NO_QUOTAS_FOR_ACCOUNT."); return MessageStatus.NO_QUOTAS_FOR_ACCOUNT; } // If OutputBufferSize is less than the size of FILE_NAME_INFORMATION if (bufferSize == BufferSize.LessThanFILE_NAME_INFORMATION) { Helper.CaptureRequirement(1024, @"[In FSCTL_FIND_FILES_BY_SID,Pseudocode for the operation is as follows:] If OutputBufferSize is less than sizeof( FILE_NAME_INFORMATION ), the operation MUST be failed with STATUS_INVALID_USER_BUFFER."); return MessageStatus.INVALID_USER_BUFFER; } // For each Link in Open.File.DirectoryList, starting at Open.FindBySidRestartIndex //If Link.File.SecurityDescriptor.OwnerSid is equal to FindBySidData.SID if (linkOwnerSidEqualSID) { //If (OutputBufferLength ?OutputBufferOffset) is less than the size of //(Link.Name + 2 bytes) aligned to 4 bytes: if (outPutBufLessLinkSize) { if (!isOutputBufferOffset) { Helper.CaptureRequirement(1027, @"[In FSCTL_FIND_FILES_BY_SID,For each Link in Open.File.DirectoryList, starting at Open.FindBySidRestartIndex:If Link.File.SecurityDescriptor.OwnerSid is equal to FindBySidData.SID: If (OutputBufferLength ¨C OutputBufferOffset) is less than the size of (Link.Name + 2 bytes) aligned to 4 bytes:] If OutputBufferOffset is not 0:The operation returns with STATUS_SUCCESS."); isBytesReturnedSet = true; Helper.CaptureRequirement(1034, @"[In FSCTL_FIND_FILES_BY_SID,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:BytesReturned set to OutputBufferOffset."); return MessageStatus.SUCCESS; } else { Helper.CaptureRequirement(1028, @"[In FSCTL_FIND_FILES_BY_SID,Pseudocode for the operation is as follows: For each Link in Open.File.DirectoryList, starting at Open.FindBySidRestartIndex:If Link.File.SecurityDescriptor. OwnerSid is equal to FindBySidData.SID:If (OutputBufferLength ¨C OutputBufferOffset) is less than the size of (Link.Name + 2 bytes) aligned to 4 bytes:]Else[If OutputBufferOffset is 0:] The operation MUST be failed with STATUS_BUFFER_TOO_SMALL."); return MessageStatus.BUFFER_TOO_SMALL; } } } Helper.CaptureRequirement(1014, @"[In FSCTL_FIND_FILES_BY_SID]On completion, the object store MUST return: [Status,OutputBuffer,BytesReturned ]."); Helper.CaptureRequirement(1035, @"[In FSCTL_FIND_FILES_BY_SID,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); return MessageStatus.SUCCESS; }
public static MessageStatus FsCtlForEasyRequest( FsControlRequestType requestType, BufferSize bufferSize, out bool isBytesReturnedSet, out bool isOutputBufferSizeReturn ) { Condition.IsTrue((requestType == FsControlRequestType.FSCTL_FILESYSTEM_GET_STATISTICS && (bufferSize == BufferSize.LessThanSizeOf_FILESYSTEM_STATISTICS || bufferSize == BufferSize.BufferSizeSuccess)) || (requestType == FsControlRequestType.FSCTL_GET_COMPRESSION && (bufferSize == BufferSize.LessThanTwoBytes || bufferSize == BufferSize.BufferSizeSuccess)) || (requestType == FsControlRequestType.GET_NTFS_VOLUME_DATA && (bufferSize == BufferSize.LessThanNTFS_VOLUME_DATA_BUFFER || bufferSize == BufferSize.BufferSizeSuccess)) || (requestType == FsControlRequestType.QUERY_FAT_BPB && (bufferSize == BufferSize.LessThan0x24 || bufferSize == BufferSize.BufferSizeSuccess)) || (requestType == FsControlRequestType.QUERY_ON_DISK_VOLUME_INFO && (bufferSize == BufferSize.LessThanFILE_QUERY_ON_DISK_VOL_INFO_BUFFER || bufferSize == BufferSize.BufferSizeSuccess)) || (requestType == FsControlRequestType.QUERY_SPARING_INFO && (bufferSize == BufferSize.LessThanFILE_QUERY_SPARING_BUFFER || bufferSize == BufferSize.BufferSizeSuccess)) || (requestType == FsControlRequestType.RECALL_FILE && bufferSize == BufferSize.BufferSizeSuccess) || (requestType == FsControlRequestType.FSCTL_SET_SHORT_NAME_BEHAVIOR && bufferSize == BufferSize.BufferSizeSuccess) || (requestType == FsControlRequestType.SET_ZERO_ON_DEALLOCATION && bufferSize == BufferSize.BufferSizeSuccess) || (requestType == FsControlRequestType.WRITE_USN_CLOSE_RECORD && (bufferSize == BufferSize.LessThanSizeofUsn || bufferSize == BufferSize.BufferSizeSuccess)) ); isBytesReturnedSet = false; isOutputBufferSizeReturn = false; switch (requestType) { #region 3.1.5.9.4 FSCTL_FILESYSTEM_GET_STATISTICS case FsControlRequestType.FSCTL_FILESYSTEM_GET_STATISTICS: { if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(5803, @"[In FSCTL_FILESYSTEM_GET_STATISTICS] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST. <23>"); return MessageStatus.INVALID_DEVICE_REQUEST; } if (bufferSize == BufferSize.LessThanSizeOf_FILESYSTEM_STATISTICS) { Requirement.Capture(@"[2.1.5.9.6 FSCTL_FILESYSTEM_GET_STATISTICS] Pseudocode for the operation is as follows: If OutputBufferSize is less than sizeof(FILESYSTEM_STATISTICS), the operation is failed with STATUS_BUFFER_TOO_SMALL."); return MessageStatus.BUFFER_TOO_SMALL; } // If OutputBufferSize is less than the total size of statistics information if (bufferSize == BufferSize.LessThanTotalSizeOfStatistics) { isOutputBufferSizeReturn = true; Helper.CaptureRequirement(1258, @"[In FSCTL_FILESYSTEM_GET_STATISTICS,Pseudocode for the operation is as follows:] If OutputBufferSize is less than the total size of statistics information, then only OutputBufferSize bytes will be returned."); Helper.CaptureRequirement(1259, @"[In FSCTL_FILESYSTEM_GET_STATISTICS,Pseudocode for the operation is as follows: If OutputBufferSize is less than the total size of statistics information]the operation MUST succeed but return with STATUS_BUFFER_OVERFLOW."); Helper.CaptureRequirement(4038, @"[In FSCTL_FILESYSTEM_GET_STATISTICS,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_BUFFER_OVERFLOW."); return MessageStatus.BUFFER_OVERFLOW; } Helper.CaptureRequirement(1009, @"[In FSCTL_FILESYSTEM_GET_STATISTICS,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS or STATUS_BUFFER_OVERFLOW."); Helper.CaptureRequirement(999, @"[In FSCTL_FILESYSTEM_GET_STATISTICS]On completion, the object store MUST return:[Status,OutputBuffer,BytesReturned ]."); isBytesReturnedSet = true; isOutputBufferSizeReturn = true; Helper.CaptureRequirement(1008, @"[In FSCTL_FILESYSTEM_GET_STATISTICS,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:BytesReturned set to the number of total number of bytes of statistical information returned."); return MessageStatus.SUCCESS; } #endregion #region 3.1.5.9.6 FSCTL_GET_COMPRESSION case FsControlRequestType.FSCTL_GET_COMPRESSION: { if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(1043, @"[In FSCTL_GET_COMPRESSION] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<26>"); return MessageStatus.INVALID_DEVICE_REQUEST; } if (bufferSize == BufferSize.LessThanTwoBytes) { Helper.CaptureRequirement(5008, @"[In FSCTL_GET_COMPRESSION]Pseudocode for the operation is as follows: If OutputBufferSize is less than sizeof( USHORT ) (2 bytes), the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } Helper.CaptureRequirement(1051, @"[In FSCTL_GET_COMPRESSION]Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); Helper.CaptureRequirement(1039, @"[In FSCTL_GET_COMPRESSION]On completion, the object store MUST return:[Status,OutputBuffer ,BytesReturned]."); Helper.CaptureRequirement(4037, @"[In FSCTL_GET_COMPRESSION,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); isBytesReturnedSet = true; isOutputBufferSizeReturn = true; Helper.CaptureRequirement(1050, @"[In FSCTL_GET_COMPRESSION,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:BytesReturned set to sizeof( USHORT ) (2 bytes)."); return MessageStatus.SUCCESS; } #endregion #region 3.1.5.9.7 FSCTL_GET_NTFS_VOLUME_DATA case FsControlRequestType.GET_NTFS_VOLUME_DATA: { if (!IsImplement_FSCTL_GET_NTFS_VOLUME_DATA) { Helper.CaptureRequirement(5017, @"[In FSCTL_GET_NTFS_VOLUME_DATA] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<27> "); return MessageStatus.INVALID_DEVICE_REQUEST; } if (bufferSize == BufferSize.LessThanNTFS_VOLUME_DATA_BUFFER) { Helper.CaptureRequirement(5018, @"[In FSCTL_GET_NTFS_VOLUME_DATA] Pseudocode for the operation is as follows: If OutputBufferSize is less than sizeof( NTFS_VOLUME_DATA_BUFFER ), the operation MUST be failed with STATUS_BUFFER_TOO_SMALL."); return MessageStatus.BUFFER_TOO_SMALL; } isBytesReturnedSet = true; isOutputBufferSizeReturn = true; Helper.CaptureRequirement(5033, @"[In FSCTL_GET_NTFS_VOLUME_DATA,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:BytesReturned set to sizeof( NTFS_VOLUME_DATA_BUFFER )."); Helper.CaptureRequirement(5012, @"[In FSCTL_GET_NTFS_VOLUME_DATA] On completion, the object store MUST return: [Status,OutputBuffer,BytesReturned]."); Helper.CaptureRequirement(5034, @"[In FSCTL_GET_NTFS_VOLUME_DATA,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); return MessageStatus.SUCCESS; } #endregion #region 3.1.5.9.8 SET_OBJECT_ID //3.1.5.9.8 SET_OBJECT_ID case FsControlRequestType.SET_OBJECT_ID: { if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(5036, @"[In FSCTL_GET_OBJECT_ID]If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<29>"); return MessageStatus.INVALID_DEVICE_REQUEST; } if (!isObjectIDsSupportedTrue) { Helper.CaptureRequirement(5037, @"[In FSCTL_GET_OBJECT_ID]Pseudocode for the operation is as follows: If Open.File.Volume.IsObjectIDsSupported is FALSE, the operation MUST be failed with STATUS_VOLUME_NOT_UPGRADED."); return MessageStatus.STATUS_VOLUME_NOT_UPGRADED; } if (bufferSize == BufferSize.LessThanFILE_OBJECTID_BUFFER) { Helper.CaptureRequirement(1061, @"[In FSCTL_GET_OBJECT_ID,Pseudocode for the operation is as follows:] If OutputBufferSize is less than sizeof( FILE_OBJECTID_BUFFER ), the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } Helper.CaptureRequirement(1069, @"[In FSCTL_GET_OBJECT_ID,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); isBytesReturnedSet = true; Helper.CaptureRequirement(1057, @"[In FSCTL_GET_OBJECT_ID]On completion, the object store MUST return: [Status, OutputBuffer,BytesReturned]."); Helper.CaptureRequirement(1068, @"[In FSCTL_GET_OBJECT_ID,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return: BytesReturned set to sizeof ( FILE_OBJECTID_BUFFER )."); return MessageStatus.SUCCESS; } #endregion #region 3.1.5.9.14 FSCTL_QUERY_FAT_BPB case FsControlRequestType.QUERY_FAT_BPB: { if (!IsImplement_FSCTL_QUERY_FAT_BPB) { Helper.CaptureRequirement(1117, @"[ In FSCTL_QUERY_FAT_BPB]If this operation is not supported, this operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<31>"); Helper.CaptureRequirement(5944, @"[ In FSCTL_QUERY_FAT_BPB]implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<32>"); return MessageStatus.INVALID_DEVICE_REQUEST; } if (bufferSize == BufferSize.LessThan0x24) { Helper.CaptureRequirement(1124, @"[ In FSCTL_QUERY_FAT_BPB]Pseudocode for the operation is as follows: If OutputBufferSize is less than 0x24, the operation MUST be failed with STATUS_BUFFER_TOO_SMALL."); return MessageStatus.BUFFER_TOO_SMALL; } isBytesReturnedSet = true; Helper.CaptureRequirement(1126, @"[ In FSCTL_QUERY_FAT_BPB,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:BytesReturned set to 0x24."); Helper.CaptureRequirement(5043, @"[ In FSCTL_QUERY_FAT_BPB,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:The operation returns STATUS_SUCCESS."); Helper.CaptureRequirement(1121, @"[ In FSCTL_QUERY_FAT_BPB]On completion, the object store MUST return: [Status,OutputBuffer,BytesReturned ]."); return MessageStatus.SUCCESS; } #endregion #region 3.1.5.9.16 QUERY_ON_DISK_VOLUME_INFO case FsControlRequestType.QUERY_ON_DISK_VOLUME_INFO: { if (!IsImplement_FSCTL_QUERY_ON_DISK_VOLUME_INFO) { Helper.CaptureRequirement(5508, @"[In FSCTL_QUERY_ON_DISK_VOLUME_INFO]If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<34>"); return MessageStatus.INVALID_DEVICE_REQUEST; } if (bufferSize == BufferSize.LessThanFILE_QUERY_ON_DISK_VOL_INFO_BUFFER) { Helper.CaptureRequirement(5509, @"[In FSCTL_QUERY_ON_DISK_VOLUME_INFO]Pseudocode for the operation is as follows: If OutputBufferSize is less than sizeof( FILE_QUERY_ON_DISK_VOL_INFO_BUFFER ), the operation MUST be failed with STATUS_BUFFER_TOO_SMALL."); return MessageStatus.BUFFER_TOO_SMALL; } isBytesReturnedSet = true; Helper.CaptureRequirement(5521, @"[In FSCTL_QUERY_ON_DISK_VOLUME_INFO,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:BytesReturned set to sizeof( FILE_QUERY_ON_DISK_VOL_INFO_BUFFER )."); Helper.CaptureRequirement(5503, @"[In FSCTL_QUERY_ON_DISK_VOLUME_INFO]On completion, the object store MUST return: [Status,OutputBuffer,BytesReturned]."); Helper.CaptureRequirement(5522, @"[In FSCTL_QUERY_ON_DISK_VOLUME_INFO,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); return MessageStatus.SUCCESS; } #endregion #region 3.1.5.9.17 FSCTL_QUERY_SPARING_INFO case FsControlRequestType.QUERY_SPARING_INFO: { if (!IsImplement_FSCTL_QUERY_SPARING_INFO) { Helper.CaptureRequirement(7850, @"[In FSCTL_QUERY_SPARING_INFO]If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<35>"); return MessageStatus.INVALID_DEVICE_REQUEST; } if (bufferSize == BufferSize.LessThanFILE_QUERY_SPARING_BUFFER) { Helper.CaptureRequirement(3851, @"[In FSCTL_QUERY_SPARING_INFO]Pseudocode for the operation is as follows: If OutputBufferSize is less than sizeof( FILE_QUERY_SPARING_BUFFER ), the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } isBytesReturnedSet = true; Helper.CaptureRequirement(7934, @"[In FSCTL_QUERY_SPARING_INFO,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return: BytesReturned set to sizeof(: FILE_QUERY_SPARING_BUFFER )."); Helper.CaptureRequirement(3847, @"[In FSCTL_QUERY_SPARING_INFO]On completion, the object store MUST return:[Status,OutputBuffer]."); Helper.CaptureRequirement(3856, @"[In FSCTL_QUERY_SPARING_INFO,Pseudocode for the operation is as follows: Upon successful completion of the operation, the object store MUST return:] Status set to STATUS_SUCCESS."); return MessageStatus.SUCCESS; } #endregion #region 3.1.5.9.19 FSCTL_RECALL_FILE case FsControlRequestType.RECALL_FILE: { if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(1132, @"[ In FSCTL_RECALL_FILE] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<37>"); return MessageStatus.INVALID_DEVICE_REQUEST; } Helper.CaptureRequirement(1263, @"[ In FSCTL_RECALL_FILE]On completion, the object store MUST return:[Status]."); Helper.CaptureRequirement(1136, @"[ In FSCTL_RECALL_FILE,If Open.File.FileAttributes.FILE_ATTRIBUTE_OFFLINE is set] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); return MessageStatus.SUCCESS; } #endregion #region 3.1.5.9.27 FSCTL_SET_SHORT_NAME_BEHAVIOR case FsControlRequestType.FSCTL_SET_SHORT_NAME_BEHAVIOR: { Requirement.Capture(@"[2.1.5.9.34 FSCTL_SET_SHORT_NAME_BEHAVIOR] This control code is reserved for the WinPE <95> environment; the object store MUST return STATUS_INVALID_DEVICE_REQUEST."); return MessageStatus.INVALID_DEVICE_REQUEST; } #endregion #region 3.1.5.9.29 FSCTL_SET_ZERO_ON_DEALLOCATION case FsControlRequestType.SET_ZERO_ON_DEALLOCATION: { if (!IsImplement_SET_ZERO_ON_DEALLOCATION) { Helper.CaptureRequirement(4721, @"[In FSCTL_SET_ZERO_ON_DEALLOCATION] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<51>"); return MessageStatus.INVALID_DEVICE_REQUEST; } isBytesReturnedSet = true; isOutputBufferSizeReturn = true; Helper.CaptureRequirement(1394, @"[In FSCTL_SET_ZERO_ON_DEALLOCATION,Pseudocode for the operation is as follows:] TUpon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); Helper.CaptureRequirement(1388, @"[In FSCTL_SET_ZERO_ON_DEALLOCATION]On completion the object store MUST return:[Status]."); return MessageStatus.SUCCESS; } #endregion #region 3.1.5.9.31 FSCTL_WRITE_USN_CLOSE_RECORD case FsControlRequestType.WRITE_USN_CLOSE_RECORD: { if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(3959, @"[In FSCTL_WRITE_USN_CLOSE_RECORD] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<56>"); return MessageStatus.INVALID_DEVICE_REQUEST; } // If Open.File.Volume.IsReadOnly is true if (isFileVolumeReadOnly) { Helper.CaptureRequirement(3960, @"[In FSCTL_WRITE_USN_CLOSE_RECORD]Pseudocode for the operation is as follows: If Open.File.Volume.IsReadOnly is TRUE, the operation MUST be failed with STATUS_MEDIA_WRITE_PROTECTED."); return MessageStatus.MEDIA_WRITE_PROTECTED; } if (bufferSize == BufferSize.LessThanSizeofUsn) { Helper.CaptureRequirement(3961, @"[In FSCTL_WRITE_USN_CLOSE_RECORD,Pseudocode for the operation is as follows:] If OutputBufferSize is less than sizeof( Usn ), the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } // If Open.File.Volume.IsUsnActive is FALSE if (!isFileVolumeUsnJournalActive) { Helper.CaptureRequirement(3962, @"[In FSCTL_WRITE_USN_CLOSE_RECORD,Pseudocode for the operation is as follows:] If Open.File.Volume.IsUsnJournalActive is FALSE, the operation MUST be failed with STATUS_JOURNAL_NOT_ACTIVE."); return MessageStatus.JOURNAL_NOT_ACTIVE; } isBytesReturnedSet = true; isOutputBufferSizeReturn = true; Helper.CaptureRequirement(3965, @"[In FSCTL_WRITE_USN_CLOSE_RECORD,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:BytesReturned set to sizeof( Usn )."); Helper.CaptureRequirement(3955, @"[In FSCTL_WRITE_USN_CLOSE_RECORD]On completion, the object store MUST return: [Status,OutputBuffer,BytesReturned]."); Helper.CaptureRequirement(3966, @"[In FSCTL_WRITE_USN_CLOSE_RECORD,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); return MessageStatus.SUCCESS; } #endregion default: return MessageStatus.SUCCESS; } }
public static MessageStatus FsCtlGetReparsePoint( BufferSize bufferSize, ReparseTag openFileReparseTag, out bool isBytesReturnedSet ) { Condition.IsTrue(bufferSize == BufferSize.LessThanREPARSE_DATA_BUFFER || bufferSize == BufferSize.LessThanREPARSE_GUID_DATA_BUFFER || bufferSize == BufferSize.BufferSizeSuccess); Condition.IsTrue(openFileReparseTag == ReparseTag.EMPTY || openFileReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG || openFileReparseTag == ReparseTag.Initialize); isBytesReturnedSet = false; if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(5039, @"[In FSCTL_GET_REPARSE_POINT] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<30>"); return MessageStatus.INVALID_DEVICE_REQUEST; } if (!isReparsePointsSupportedTrue) { Helper.CaptureRequirement(5040, @"[In FSCTL_GET_REPARSE_POINT] Pseudocode for the operation is as follows: If Open.File.Volume.IsReparsePointsSupported is FALSE, the operation MUST be failed with STATUS_VOLUME_NOT_UPGRADED."); return MessageStatus.STATUS_VOLUME_NOT_UPGRADED; } // If Open.File.ReparseTag is empty if (openFileReparseTag == ReparseTag.EMPTY) { Helper.CaptureRequirement(1077, @"[In FSCTL_GET_REPARSE_POINT,Pseudocode for the operation is as follows: Phase 1 : Check whether there is a reparse point on the File]If Open.File.ReparseTag is empty, the operation MUST be failed with STATUS_NOT_A_REPARSE_POINT."); return MessageStatus.NOT_A_REPARSE_POINT; } //Verify that OutputBufferSize is large enough to contain the reparse point data header //If Open.File.ReparseTag is a Microsoft reparse tag as defined in [MS-FSCC] section 2.1.2.1 //If OutputBufferSize is small than the size of REPARSE_DATA_BUFFER if ((openFileReparseTag != ReparseTag.NON_MICROSOFT_RANGE_TAG) && (BufferSize.LessThanREPARSE_DATA_BUFFER == bufferSize)) { Helper.CaptureRequirement(1080, @"[In FSCTL_GET_REPARSE_POINT,Pseudocode for the operation is as follows: Phase 2 - Verify that OutputBufferSize is large enough to contain the reparse point data header.] If it[ Open.File.ReparseTag] is not, the operation MUST be failed with STATUS_BUFFER_TOO_SMALL."); return MessageStatus.BUFFER_TOO_SMALL; } //If Open.File.ReparseTag is a non-Microsoft reparse tag //If OutputBufferSize is small than the size of REPARSE_GUID_DATA_BUFFER if ((openFileReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG) && (BufferSize.LessThanREPARSE_GUID_DATA_BUFFER == bufferSize)) { Helper.CaptureRequirement(1083, @"[In FSCTL_GET_REPARSE_POINT,Pseudocode for the operation is as follows: Phase 2 : Verify that OutputBufferSize is large enough to contain the reparse point data header.] If it[Open.File.ReparseTag] is not, the operation MUST be failed with STATUS_BUFFER TOO_SMALL."); return MessageStatus.BUFFER_TOO_SMALL; } isBytesReturnedSet = true; Helper.CaptureRequirement(1090, @"[In FSCTL_GET_REPARSE_POINT,Pseudocode for the operation is as follows: Phase 3 : Return the reparse data]Upon successful completion of the operation, the object store MUST return:BytesReturned set to the number of bytes written to OutputBuffer."); Helper.CaptureRequirement(1073, @"[In FSCTL_GET_REPARSE_POINT]On completion, the object store MUST return:[OutputBuffer ,BytesCopied,Status ]."); Helper.CaptureRequirement(1091, @"[In FSCTL_GET_REPARSE_POINT,Pseudocode for the operation is as follows:Phase 3 : Return the reparse data]Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); return MessageStatus.SUCCESS; }
public unsafe bool SaveBuffer(string fileName, ImageType imageType, ScannedSide side, BufferSize bufferSize) { try { if (/*WhiteCoeff > 0 && */imageType == ImageType.Halftone) { IntPtr wcPtr = _whiteCoeffU.ToPointer(); int shift = (side == 0 ? 0 : _currentConfiguration.DotsOneSide); if ((_currentConfiguration.Options & HardwareOptions.RightToLeftHalftone) > 0) { if ((_currentConfiguration.Options & HardwareOptions.OneSide) == 0) { if ((side == ScannedSide.Top || side == ScannedSide.Undefined) && !_halftoneFlipped[(int)ScannedSide.Top]) { IntPtr p0 = HalfToneBuffer0.ToPointer(); FlipBufferVertically((byte*)p0.ToPointer(), _currentConfiguration.DotsOneSide, _linesCount); _halftoneFlipped[(int)ScannedSide.Top] = true; } } if ((side == ScannedSide.Bottom || side == ScannedSide.Undefined) && !_halftoneFlipped[(int)ScannedSide.Bottom]) { IntPtr p1 = HalfToneBuffer1.ToPointer(); FlipBufferVertically((byte*)p1.ToPointer(), _currentConfiguration.DotsOneSide, _linesCount); _halftoneFlipped[(int)ScannedSide.Bottom] = true; } } if ((_currentConfiguration.Options & HardwareOptions.OneSide) == 0) { if ((side == ScannedSide.Top || side == ScannedSide.Undefined) && !WhiteCoeffApplyed[(int)ScannedSide.Top]) { IntPtr p0 = HalfToneBuffer0.ToPointer(); applyWhiteCoeffs( (byte*)p0.ToPointer(), (byte*)p0.ToPointer(), (byte*)wcPtr.ToPointer() + shift, _currentConfiguration.DotsOneSide, _linesCount); WhiteCoeffApplyed[(int)ScannedSide.Top] = true; } } if ((side == ScannedSide.Bottom || side == ScannedSide.Undefined) && !WhiteCoeffApplyed[(int)ScannedSide.Bottom]) { IntPtr p1 = HalfToneBuffer1.ToPointer(); applyWhiteCoeffs( (byte*)p1.ToPointer(), (byte*)p1.ToPointer(), (byte*)wcPtr.ToPointer() + shift, _currentConfiguration.DotsOneSide, _linesCount); WhiteCoeffApplyed[(int)ScannedSide.Bottom] = true; } } if (side == ScannedSide.Top || side == ScannedSide.Undefined) { TiffImageHelper.SaveToFile(fileName + "_0.tif", imageType, imageType == ImageType.Binary ? WorkBufferTop : HalfToneBuffer0, _currentConfiguration.DotsOneSide, bufferSize == BufferSize.Scanned ? _linesCount : _currentConfiguration.MaxLines); } if (side == ScannedSide.Bottom || side == ScannedSide.Undefined) { TiffImageHelper.SaveToFile(fileName + "_1.tif", imageType, imageType == ImageType.Binary ? WorkBufferBottom : HalfToneBuffer1, _currentConfiguration.DotsOneSide, bufferSize == BufferSize.Scanned ? _linesCount : _currentConfiguration.MaxLines); } return true; } catch { return false; } }
public static MessageStatus FsCtlGetRetrivalPoints( BufferSize bufferSize, bool isStartingVcnNegative, bool isStartingVcnGreatThanAllocationSize, bool isElementsNotAllCopied, out bool isBytesReturnedSet ) { Condition.IsTrue(bufferSize == BufferSize.LessThanSTARTING_VCN_INPUT_BUFFER || bufferSize == BufferSize.LessThanRETRIEVAL_POINTERS_BUFFER || bufferSize == BufferSize.BufferSizeSuccess); isBytesReturnedSet = false; // If the size of StartingVcnBuffer is less than the size of a STARTING_VCN_INPUT_BUFFER in bytes if (bufferSize == BufferSize.LessThanSTARTING_VCN_INPUT_BUFFER) { Helper.CaptureRequirement(1100, @"[In FSCTL_GET_RETRIEVAL_POINTERS,Pseudocode for the operation is as follows: Phase 1 - Verify Parameters]If the size of StartingVcnBuffer is less than sizeof ( STARTING_VCN_INPUT_BUFFER ), the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } //If OutputBufferSize is smaller than the size of RETRIEVAL_POINTERS_BUFFER if (bufferSize == BufferSize.LessThanRETRIEVAL_POINTERS_BUFFER) { Helper.CaptureRequirement(1101, @"[In FSCTL_GET_RETRIEVAL_POINTERS,Pseudocode for the operation is as follows: Phase 1 - Verify Parameters]If OutputBufferSize is smaller than sizeof( RETRIEVAL_POINTERS_BUFFER ), the operation MUST be failed with STATUS_BUFFER_TOO_SMALL."); return MessageStatus.BUFFER_TOO_SMALL; } //If StartingVcnBuffer.StartingVcn is negative if (isStartingVcnNegative) { if (!isStartingVcnGreatThanAllocationSize) { Helper.CaptureRequirement(1103, @"[In FSCTL_GET_RETRIEVAL_POINTERS,Pseudocode for the operation is as follows: Phase 1 - Verify Parameters]If StartingVcnBuffer.StartingVcn is negative, the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } } //If StartingVcnBuffer.StartingVcn is greater than or equal to Open.Stream.AllocationSize divided by Open.File.Volume.ClusterSize if (isStartingVcnGreatThanAllocationSize) { Helper.CaptureRequirement(1104, @"[In FSCTL_GET_RETRIEVAL_POINTERS,Pseudocode for the operation is as follows: Phase 1 - Verify Parameters]If StartingVcnBuffer.StartingVcn is greater than or equal to Open.Stream.AllocationSize divided by Open.File.Volume.ClusterSize, the operation MUST be failed with STATUS_END_OF_FILE."); return MessageStatus.END_OF_FILE; } //If not all of the elements in Open.Stream.ExtentList were copied into OutputBuffer.Extents if (isElementsNotAllCopied) { return MessageStatus.BUFFER_OVERFLOW; } isBytesReturnedSet = true; Helper.CaptureRequirement(1112, @"Locate and copy the extents into OutputBuffer.]Upon successful completion of the operation, the object store MUST return: BytesReturned set to the number of bytes written to OutputBuffer."); Helper.CaptureRequirement(1096, @"[In FSCTL_GET_RETRIEVAL_POINTERS]On completion, the object store MUST return: [OutputBuffer,BytesCopied,Status]."); Helper.CaptureRequirement(5041, @"[In FSCTL_GET_RETRIEVAL_POINTERS,Pseudocode for the operation is as follows: Phase 2 - Locate and copy the extents into OutputBuffer.]Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS or STATUS_BUFFER_OVERFLOW."); return MessageStatus.SUCCESS; }
public void Test( [ValueSource(nameof(Cases))] TestCase testCase, [ValueSource(nameof(BufferSizes))] BufferSize bufferSize, [ValueSource(nameof(EnginesCount))] int enginesCount, [ValueSource(nameof(MaxThreadsCount))] int maxThreadsCount) { const string inputPath = "ZZZZZzzzzZzZZzzzZZZzzz", groupsPath = "WWwwwWWwwwWWWwwwwwwwww"; var groupsFileLength = testCase.Lines .Sum(o => o.Length + Consts.EndLineBytesCount); byte[] groupsFileContent = new byte[groupsFileLength]; var inputSource = testCase.Lines .SelectMany(line => new[] { line.Select(c => (byte)c), Consts.EndLineBytes }) .Aggregate(Enumerable.Concat) .ToArray(); var ioServiceMock = new Mock <IIoService>(); var configMock = new Mock <IConfig>(); ioServiceMock .Setup(o => o.SizeOfFile(inputPath)) .Returns(groupsFileLength); ioServiceMock .Setup(o => o.OpenRead(inputPath, It.IsAny <long>())) .Returns((string _, long position) => { var inputStream = new MemoryStream(inputSource); var inputReaderMock = new Mock <IFileReader>(); inputReaderMock .SetupGet(o => o.Length) .Returns(() => inputStream.Length); inputReaderMock .SetupGet(o => o.Position) .Returns(() => inputStream.Position); inputReaderMock .SetupSet(o => o.Position = It.IsAny <long>()) .Callback((long value) => inputStream.Position = value); inputReaderMock .Setup(o => o.ReadByte()) .Returns(() => inputStream.ReadByte()); inputReaderMock .Setup(o => o.Read(It.IsAny <byte[]>(), It.IsAny <int>(), It.IsAny <int>())) .Returns((byte[] buff, int offset, int count) => inputStream.Read(buff, offset, count)); inputReaderMock .Setup(o => o.Dispose()) .Callback(() => inputStream.Dispose()); inputReaderMock.Object.Position = position; return(inputReaderMock.Object); }); ioServiceMock .Setup(o => o.OpenWrite(groupsPath, It.IsAny <long>(), false)) .Returns((string _, long position, bool __) => { var groupsStream = new MemoryStream(groupsFileContent); var writerMock = new Mock <IFileWriter>(); writerMock .SetupGet(o => o.Position) .Returns(() => groupsStream.Position); writerMock .SetupSet(o => o.Position = It.IsAny <long>()) .Callback((long value) => groupsStream.Position = value); writerMock .SetupGet(o => o.Length) .Returns(() => groupsStream.Length); writerMock .Setup(o => o.Write(It.IsAny <byte[]>(), It.IsAny <int>(), It.IsAny <int>())) .Callback((byte[] buff, int offset, int count) => groupsStream.Write(buff, offset, count)); writerMock .Setup(o => o.Dispose()) .Callback(() => groupsStream.Close()); return(writerMock.Object); }); var maxLineLength = testCase.Lines .Max(line => line.Length + Consts.EndLineBytesCount); int buffSize = new Dictionary <BufferSize, int> { { BufferSize.Min, maxLineLength + 1 }, { BufferSize.Small, maxLineLength + 2 }, { BufferSize.Medium, groupsFileLength + 1 }, { BufferSize.Large, groupsFileLength * 2 } }[bufferSize]; configMock .SetupGet(o => o.PhysicalBufferLength) .Returns(buffSize + sizeof(ulong)); configMock .SetupGet(o => o.UsingBufferLength) .Returns(buffSize); configMock .SetupGet(o => o.MaxRunningTasksCount) .Returns(maxThreadsCount); configMock .SetupGet(o => o.GrouperEnginesCount) .Returns(enginesCount); configMock .SetupGet(o => o.InputFilePath) .Returns(inputPath); configMock .SetupGet(o => o.GroupsFilePath) .Returns(groupsPath); IGroupsInfoMarger groupsSummaryInfoMarger = new GroupsInfoMarger(); ITasksQueue tasksQueue = new TasksQueue(configMock.Object); IBuffersPool buffersPool = new BuffersPool(configMock.Object); IInputReaderFactory inputReaderMaker = new InputReaderFactory( ioServiceMock.Object, tasksQueue, buffersPool, configMock.Object); IGroupsLinesOutputFactory linesWriterFactory = new GroupsLinesOutputFactory( ioServiceMock.Object, tasksQueue, buffersPool, configMock.Object); IGrouperIOs grouperIOs = new GrouperIOs( inputReaderMaker, linesWriterFactory, ioServiceMock.Object, configMock.Object); var grouper = new Grouper( groupsSummaryInfoMarger, grouperIOs, tasksQueue, configMock.Object); var trivialGrouper = new TrivialGrouper(); var expectedGroups = trivialGrouper .SplitToGroups(testCase.Lines); var groupsInfo = grouper.SeparateInputToGroups(); var resultGroups = ExtractGroups(groupsInfo, groupsFileContent); Assert.IsTrue(resultGroups.Select(Group.IsValid).All(o => o)); CollectionAssert.AreEqual( expectedGroups, resultGroups); }
public static MessageStatus FsCtlQueryAllocatedRanges( BufferSize bufferSize, BufferLength inputBuffer, out bool isBytesReturnedSet ) { Condition.IsTrue(bufferSize == BufferSize.LessThanFILE_ALLOCATED_RANGE_BUFFER || bufferSize == BufferSize.OutLessThanFILE_ALLOCATED_RANGE_BUFFER || bufferSize == BufferSize.BufferSizeSuccess); isBytesReturnedSet = false; if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(5045, @"[In FSCTL_QUERY_ALLOCATED_RANGES]If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<33>"); return MessageStatus.INVALID_DEVICE_REQUEST; } // If OutputBufferSize < sizeof( FILE_ALLOCATED_RANGE_BUFFER ) if (bufferSize == BufferSize.OutLessThanFILE_ALLOCATED_RANGE_BUFFER) { Helper.CaptureRequirement(3778, @"[In FSCTL_QUERY_ALLOCATED_RANGES,Pseudocode for the operation is as follows:] If OutputBufferSize < sizeof( FILE_ALLOCATED_RANGE_BUFFER ), the operation MUST be failed with STATUS_BUFFER_TOO_SMALL."); return MessageStatus.BUFFER_TOO_SMALL; } // If InputBufferSize is less than the size of FILE_ALLOCATED_RANGE_BUFFER if (bufferSize == BufferSize.LessThanFILE_ALLOCATED_RANGE_BUFFER) { Helper.CaptureRequirement(3771, @"[In FSCTL_QUERY_ALLOCATED_RANGES,Pseudocode for the operation is as follows:] If InputBufferSize is less than sizeof( FILE_ALLOCATED_RANGE_BUFFER ), the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } switch (inputBuffer) { case BufferLength.EqualZero: { Helper.CaptureRequirement(3777, @"[In FSCTL_QUERY_ALLOCATED_RANGES,Pseudocode for the operation is as follows:] If InputBuffer.Length is 0:Return STATUS_SUCCESS."); break; } case BufferLength.LessThanZero: { Helper.CaptureRequirement(3774, @"[In FSCTL_QUERY_ALLOCATED_RANGES,Pseudocode for the operation is as follows:] If (InputBuffer.Length < 0), the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } case BufferLength.MoreThanMAXLONGLONG: { Helper.CaptureRequirement(3775, @"[In FSCTL_QUERY_ALLOCATED_RANGES,Pseudocode for the operation is as follows:] If (InputBuffer.Length > MAXLONGLONG - InputBuffer.FileOffset), the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } case BufferLength.FileOffsetLessThanZero: { Helper.CaptureRequirement(3773, @"[In FSCTL_QUERY_ALLOCATED_RANGES,Pseudocode for the operation is as follows:] If (InputBuffer.FileOffset < 0) , the operation MUST be failed with STATUS_INVALID_PARAMETER."); return MessageStatus.INVALID_PARAMETER; } } isBytesReturnedSet = true; Helper.CaptureRequirement(3765, @"[In FSCTL_QUERY_ALLOCATED_RANGES]On completion, the object store MUST return: [Status ,OutputBuffer,BytesReturned ]."); Helper.CaptureRequirement(3782, @"[In FSCTL_QUERY_ALLOCATED_RANGES,Pseudocode for the operation is as follows: If Open.Stream.IsSparse is FALSE:]Return STATUS_SUCCESS."); Helper.CaptureRequirement(5047, @"[In FSCTL_QUERY_ALLOCATED_RANGES,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); return MessageStatus.SUCCESS; }
/// <summary> /// Defaults constructor with a custom comparer. /// </summary> /// <seealso cref="DefaultTempDir()"/> /// <seealso cref="BufferSize.Automatic()"/> public OfflineSorter(IComparer <BytesRef> comparer) : this(comparer, BufferSize.Automatic(), DefaultTempDir(), MAX_TEMPFILES) { }
internal static MessageStatus WorkaroundFsCtlSetObjID(FsControlRequestType requestType, BufferSize bufferSize, MessageStatus returnedStatus, ITestSite site) { if (returnedStatus != MessageStatus.INVALID_DEVICE_REQUEST) { if (requestType == FsControlRequestType.SET_OBJECT_ID_EXTENDED && bufferSize == BufferSize.NotEqualFILE_OBJECTID_BUFFER) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(1206, MessageStatus.SUCCESS, returnedStatus, site); } else if ((requestType == FsControlRequestType.SET_OBJECT_ID || requestType == FsControlRequestType.SET_OBJECT_ID_EXTENDED) && bufferSize == BufferSize.BufferSizeSuccess) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(1187, MessageStatus.SUCCESS, returnedStatus, site); } } return returnedStatus; }
public static MessageStatus FsCtlSetReparsePoint( ReparseTag inputReparseTag, BufferSize bufferSize, bool isReparseGUIDNotEqual, bool isFileReparseTagNotEqualInputBufferReparseTag ) { Condition.IsTrue(bufferSize == BufferSize.LessThan8Bytes || bufferSize == BufferSize.NotEqualReparseDataLengthPlus24 || bufferSize == BufferSize.NotEqualReparseDataLengthPlus8 || bufferSize == BufferSize.BufferSizeSuccess); Condition.IsTrue(inputReparseTag == ReparseTag.MOUNT_POINT || inputReparseTag == ReparseTag.SYMLINK || inputReparseTag == ReparseTag.IO_REPARSE_TAG_RESERVED_ZERO || inputReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG || inputReparseTag == ReparseTag.EMPTY); if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(4331, @"[ In FSCTL_SET_REPARSE_POINT] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<46>"); return MessageStatus.INVALID_DEVICE_REQUEST; } if (!isReparsePointsSupportedTrue) { Helper.CaptureRequirement(4332, @"[ In FSCTL_SET_REPARSE_POINT,Pseudocode for the operation is as follows:] If Open.File.Volume.IsReparsePointsSupported is FALSE, the operation MUST be failed with STATUS_VOLUME_NOT_UPGRADED."); return MessageStatus.STATUS_VOLUME_NOT_UPGRADED; } if (bufferSize == BufferSize.LessThan8Bytes) { Helper.CaptureRequirement(1226, @"[ In FSCTL_SET_REPARSE_POINT,Pseudocode for the operation is as follows:] If InputBufferSize is smaller than 8 bytes, the operation MUST be failed with STATUS_IO_REPARSE_DATA_INVALID."); return MessageStatus.IO_REPARSE_DATA_INVALID; } if (bufferSize == BufferSize.NotEqualReparseDataLengthPlus8 && bufferSize == BufferSize.NotEqualReparseDataLengthPlus24) { Helper.CaptureRequirement(1229, @"[ In FSCTL_SET_REPARSE_POINT,Pseudocode for the operation is as follows:] If (InputBufferSize != InputBuffer.ReparseDataLength + 8) && (InputBufferSize != InputBuffer.ReparseDataLength + 24), the operation MUST be failed with STATUS_IO_REPARSE_DATA_INVALID."); return MessageStatus.IO_REPARSE_DATA_INVALID; } //If InputBuffer.ReparseTag == IO_REPARSE_TAG_SYMLINK and Open.HasCreateSymLinkPrivilege //is FALSE if ((inputReparseTag == ReparseTag.SYMLINK) && (!isHasCreateSymbolicLinkAccessTrue)) { Helper.CaptureRequirement(1231, @"[ In FSCTL_SET_REPARSE_POINT,Pseudocode for the operation is as follows:] If InputBuffer.ReparseTag == IO_REPARSE_TAG_SYMLINK and Open.HasCreateSymbolicLinkAccess is FALSE, the operation MUST be failed with STATUS_ACCESS_DENIED."); return MessageStatus.ACCESS_DENIED; } //If Open.File.ReparseTag is not empty (indicating that a reparse point is already assigned) if (inputReparseTag != ReparseTag.EMPTY) { //If Open.File.ReparseTag != InputBuffer.ReparseTag if (isFileReparseTagNotEqualInputBufferReparseTag) { Helper.CaptureRequirement(1237, @"[ In FSCTL_SET_REPARSE_POINT,Pseudocode for the operation is as follows: Phase 2 -- Update the File]If Open.File.ReparseTag is not empty (indicating that a reparse point is already assigned): If Open.File.ReparseTag != InputBuffer.ReparseTag, the operation MUST be failed with STATUS_IO_REPARSE_TAG_MISMATCH."); return MessageStatus.IO_REPARSE_TAG_MISMATCH; } //If Open.File.ReparseTag is a non-Microsoft tag && Open.File.ReparseGUID is not equal //to InputBuffer.ReparseGUID if ((inputReparseTag == ReparseTag.NON_MICROSOFT_RANGE_TAG) && (!isReparseGUIDNotEqual)) { Helper.CaptureRequirement(1238, @"[ In FSCTL_SET_REPARSE_POINT,Pseudocode for the operation is as follows: Phase 2 -- Update the File]If Open.File.ReparseTag is not empty (indicating that a reparse point is already assigned) If Open.File.ReparseTag is a non-Microsoft tag and Open.File.ReparseGUID is not equal to InputBuffer.ReparseGUID, the operation MUST be failed with STATUS_REPARSE_ATTRIBUTE_CONFLICT."); return MessageStatus.REPARSE_ATTRIBUTE_CONFLICT; } } Helper.CaptureRequirement(1222, @"[ In FSCTL_SET_REPARSE_POINT]On completion, the object store MUST return:Status: An NTSTATUS code that specifies the result."); Helper.CaptureRequirement(1246, @"[In FSCTL_SET_SHORT_NAME_BEHAVIOR]the object store MUST return STATUS_INVALID_DEVICE_REQUEST."); return MessageStatus.SUCCESS; }
internal static MessageStatus WorkaroundFsCtlForEasyRequest(FileSystem fileSystem, FsControlRequestType requestType, BufferSize bufferSize, bool fileVolReadOnly, bool fileVolUsnAct, ref bool isBytesReturnedSet, ref bool isOutputBufferSizeReturn, MessageStatus returnedStatus, ITestSite site) { if (requestType == FsControlRequestType.RECALL_FILE) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(1136, MessageStatus.SUCCESS, returnedStatus, site); } else if (requestType == FsControlRequestType.FSCTL_SET_SHORT_NAME_BEHAVIOR) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(1274, MessageStatus.INVALID_DEVICE_REQUEST, returnedStatus, site); } else if (requestType == FsControlRequestType.WRITE_USN_CLOSE_RECORD && bufferSize == BufferSize.LessThanTwoBytes && !fileVolReadOnly && fileVolUsnAct) { isBytesReturnedSet = FsaUtility.TransferExpectedResult<bool>(3966, true, isBytesReturnedSet, site); } else if (requestType == FsControlRequestType.SET_ZERO_ON_DEALLOCATION && bufferSize == BufferSize.LessThanSizeofUsn) { isBytesReturnedSet = FsaUtility.TransferExpectedResult<bool>(1388, false, isBytesReturnedSet, site); } else if (requestType == FsControlRequestType.SET_OBJECT_ID && bufferSize == BufferSize.LessThan0x24 && !fileVolReadOnly && !fileVolUsnAct) { isBytesReturnedSet = FsaUtility.TransferExpectedResult<bool>(1068, true, isBytesReturnedSet, site); } else if (requestType == FsControlRequestType.QUERY_FAT_BPB && bufferSize == BufferSize.LessThanTotalSizeOfStatistics) { isBytesReturnedSet = FsaUtility.TransferExpectedResult<bool>(1121, true, isBytesReturnedSet, site); } else if (requestType == FsControlRequestType.QUERY_ON_DISK_VOLUME_INFO && bufferSize == BufferSize.LessThanFILE_QUERY_SPARING_BUFFER && fileVolReadOnly && fileVolUsnAct) { isBytesReturnedSet = FsaUtility.TransferExpectedResult<bool>(5522, true, isBytesReturnedSet, site); } else if (requestType == FsControlRequestType.WRITE_USN_CLOSE_RECORD && returnedStatus == MessageStatus.JOURNAL_NOT_ACTIVE && fileSystem == FileSystem.NTFS) { returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(1274, MessageStatus.SUCCESS, returnedStatus, site); isBytesReturnedSet = FsaUtility.TransferExpectedResult<bool>(3966, true, isBytesReturnedSet, site); isOutputBufferSizeReturn = FsaUtility.TransferExpectedResult<bool>(3966, true, isOutputBufferSizeReturn, site); } return returnedStatus; }
public void SaveBuffer(string filePath, ImageType imageType, ScannedSide side, BufferSize bufferSize) { var res = _scanner.SaveBuffer(filePath, imageType, side, bufferSize); if (res) // OK Logger.LogVerbose(Message.ScannerManagerBufferSaved, imageType, bufferSize, side, filePath); else // Error Logger.LogError(Message.ScannerManagerBufferSaveError, imageType, bufferSize, side, filePath, res); }
public static MessageStatus FsCtlSetZeroData( BufferSize bufferSize, InputBuffer_FSCTL_SET_ZERO_DATA inputBuffer, bool isIsDeletedTrue, bool isConflictDetected ) { Condition.IsTrue(bufferSize == BufferSize.LessThanFILE_ZERO_DATA_INFORMATION || bufferSize == BufferSize.BufferSizeSuccess); if (!isObjectImplementedFunctionality) { Helper.CaptureRequirement(4335, @"[In FSCTL_SET_ZERO_DATA] If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<50>"); return MessageStatus.INVALID_DEVICE_REQUEST; } if (bufferSize == BufferSize.LessThanFILE_ZERO_DATA_INFORMATION) { Helper.CaptureRequirement(1302, @"[In FSCTL_SET_ZERO_DATA]The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:InputBufferSize is less than sizeof( FILE_ZERO_DATA_INFORMATION )."); return MessageStatus.INVALID_PARAMETER; } if (inputBuffer == InputBuffer_FSCTL_SET_ZERO_DATA.FileOffsetLessThanZero) { Helper.CaptureRequirement(1303, @"[In FSCTL_SET_ZERO_DATA]The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:InputBuffer.FileOffset is less than 0."); return MessageStatus.INVALID_PARAMETER; } if (inputBuffer == InputBuffer_FSCTL_SET_ZERO_DATA.BeyondFinalZeroLessThanZero) { Helper.CaptureRequirement(1304, @"[In FSCTL_SET_ZERO_DATA]The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:InputBuffer.BeyondFinalZero is less than 0."); return MessageStatus.INVALID_PARAMETER; } if (isFileVolumeReadOnly) { Helper.CaptureRequirement(1307, @"[In FSCTL_SET_ZERO_DATA]Pseudocode for the operation is as follows: If Open.File.Volume.IsReadOnly is TRUE, the operation MUST be failed with STATUS_MEDIA_WRITE_PROTECTED."); return MessageStatus.MEDIA_WRITE_PROTECTED; } if (isIsDeletedTrue) { Helper.CaptureRequirement(1309, @"[In FSCTL_SET_ZERO_DATA,Pseudocode for the operation is as follows:]While TRUE : If Open.Stream.IsDeleted is TRUE, the operation MUST be failed with STATUS_FILE_DELETED."); return MessageStatus.FILE_DELETED; } if (isConflictDetected) { Helper.CaptureRequirement(1316, @"[In FSCTL_SET_ZERO_DATA,Pseudocode for the operation is as follows:While TRUE :] If a conflict is detected the operation MUST be failed with STATUS_FILE_LOCK_CONFLICT."); return MessageStatus.FILE_LOCK_CONFLICT; } Helper.CaptureRequirement(1365, @"[In FSCTL_SET_ZERO_DATA,Pseudocode for the operation is as follows:] Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS."); Helper.CaptureRequirement(1569, @"[In FSCTL_SET_ZERO_DATA]On completion, the object store MUST return[Status]."); return MessageStatus.SUCCESS; }