in TestSuites/FileServer/src/FSAModel/Model/IOCTL/IoCtlRequestModel.cs [505:862]
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;
}
}