private void AlternateDataStream_FsCtl_Set_ZeroData(FileType fileType) { //Prerequisites: Create streams on a newly created file //Step 1: FSCTL request with FSCTL_SET_ZERO_DATA FSCTL_SET_ZERO_DATA_Request setZeroDataRequest = new FSCTL_SET_ZERO_DATA_Request(); setZeroDataRequest.FileOffset = 0; setZeroDataRequest.BeyondFinalZero = 0; uint inputBufferSize = (uint)TypeMarshal.ToBytes <FSCTL_SET_ZERO_DATA_Request>(setZeroDataRequest).Length; BaseTestSite.Log.Add(LogEntryKind.TestStep, "{0}. FSCTL request with FSCTL_SET_ZERO_DATA", ++testStep); status = this.fsaAdapter.FsCtlSetZeroData(setZeroDataRequest, inputBufferSize); //Step 2: Verify test result BaseTestSite.Log.Add(LogEntryKind.TestStep, "{0}. Verify returned NTSTATUS code.", ++testStep); if (this.fsaAdapter.IsSetZeroDataSupported == false) { this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_DEVICE_REQUEST, status, "If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST."); } else { this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status, "FSCTL_SET_ZERO_DATA is supported, status set to STATUS_SUCCESS."); } }
private void FsCtl_Set_ZeroData_IsZeroDataSupported(FileType fileType) { BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:"); MessageStatus status; //Step 1: Create file BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString()); status = this.fsaAdapter.CreateFile(fileType); //Step 2: FSCTL request with FSCTL_SET_ZERO_DATA FSCTL_SET_ZERO_DATA_Request setZeroDataRequest = new FSCTL_SET_ZERO_DATA_Request(); setZeroDataRequest.FileOffset = 0; setZeroDataRequest.BeyondFinalZero = 0; uint inputBufferSize = (uint)TypeMarshal.ToBytes <FSCTL_SET_ZERO_DATA_Request>(setZeroDataRequest).Length; BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. FSCTL request with FSCTL_SET_ZERO_DATA"); status = this.fsaAdapter.FsCtlSetZeroData(setZeroDataRequest, inputBufferSize); //Step 3: Verify test result BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify returned NTSTATUS code."); if (this.fsaAdapter.IsSetZeroDataSupported == false) { this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_DEVICE_REQUEST, status, "If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST."); } else { if (fileType == FileType.DataFile) { this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status, "FSCTL_SET_ZERO_DATA is supported, status set to STATUS_SUCCESS."); } else { if (this.fsaAdapter.FileSystem == FileSystem.CSVFS) { this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.STATUS_NOT_IMPLEMENTED, status, "If the Open is a directory on a Cluster Shared Volume File System (CSVFS), the operation MUST be failed with STATUS_NOT_IMPLEMENTED."); } else { this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_PARAMETER, status, "The operation MUST be failed with STATUS_INVALID_PARAMETER if Open.Stream.StreamType is not DataStream."); } } } }