/// <summary> /// Verify the message syntax in FSCTL_SET_ENCRYPTION Reply /// </summary> /// <param name="statusCode">The status code returned directly by the function that processes this FSCTL.</param> /// <param name="messageStatus">Message status code returned from the server.</param> /// <param name="isDirectoryNotSupportEncryption">A variable that means directory does not support encryption.</param> /// <param name="isFileSysContainSpecFile">A variable that means the file system of the volume containing the specified file.</param> public void VerifyMessageSyntaxFsctlSetEncryptionReply( FsctlSetEncryptionReplyStatus statusCode, MessageStatus messageStatus, bool isFileSysContainSpecFile, bool isDirectoryNotSupportEncryption) { Site.DefaultProtocolDocShortName = "MS-FSCC"; //Check If the file system of the volume containing the specified file or directory does not support encryption if (isFileSysContainSpecFile || isDirectoryNotSupportEncryption) { // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R837"); // // Verify MS-FSCC requirement: MS-FSCC_R837 // // If the message status is not equal with SUCCESS,then means the request will not succeed Site.CaptureRequirementIfAreNotEqual<MessageStatus>( MessageStatus.Success, messageStatus, 837, @"[In FSCTL_SET_ENCRYPTION Reply]If the file system of the volume containing the specified file or directory does not support encryption, the request MUST NOT succeed."); } List<Enum> statusList = new List<Enum>(); statusList.Add(FsctlSetEncryptionReplyStatus.STATUS_BUFFER_TOO_SMALL); statusList.Add(FsctlSetEncryptionReplyStatus.STATUS_FILE_CORRUPT_ERROR); statusList.Add(FsctlSetEncryptionReplyStatus.STATUS_INVALID_DEVICE_REQUEST); statusList.Add(FsctlSetEncryptionReplyStatus.STATUS_INVALID_PARAMETER); statusList.Add(FsctlSetEncryptionReplyStatus.STATUS_INVALID_USER_BUFFER); statusList.Add(FsctlSetEncryptionReplyStatus.STATUS_MEDIA_WRITE_PROTECTED); statusList.Add(FsctlSetEncryptionReplyStatus.STATUS_SUCCESS); statusList.Add(FsctlSetEncryptionReplyStatus.STATUS_VOLUME_DISMOUNTED); statusList.Add(FsctlSetEncryptionReplyStatus.STATUS_VOLUME_NOT_UPGRADED); // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R840,the value of statusCode is {0}", statusCode); // // Verify MS-FSCC requirement: MS-FSCC_R840 // Site.CaptureRequirementIfIsTrue( statusList.Contains(statusCode), 840, @"[In FSCTL_SET_ENCRYPTION Reply]The status code returned directly by the function that processes this FSCTL MUST be STATUS_SUCCESS or the following:[STATUS_MEDIA_WRITE_PROTECTED 0xC00000A2, STATUS_INVALID_PARAMETER 0xC000000D, STATUS_BUFFER_TOO_SMALL 0xC0000023, STATUS_VOLUME_NOT_UPGRADED 0xC000029C, STATUS_INVALID_DEVICE_REQUEST 0xC0000010, STATUS_FILE_CORRUPT_ERROR 0xC0000102, STATUS_VOLUME_DISMOUNTED 0xC000026E, STATUS_INVALID_USER_BUFFER 0xC00000E8]."); // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R839,the value of statusCode is {0}", statusCode); // // Verify MS-FSCC requirement: MS-FSCC_R839 // Site.CaptureRequirementIfIsTrue( statusList.Contains(statusCode), 839, @"The only data item this message[FSCTL_SET_ENCRYPTION Reply] returns is a status code, as specified in [MS-ERREF] section 2.3."); Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"]; }
/// <summary> /// Verify the FSCTL_SET_ENCRYPTION Reply /// </summary> /// <param name="expectedNTFSMajorVersion">the NTFS Major Version</param> /// <param name="ReturnedStatusCode">the status code returned in response, as specified in [MS-ERREF] /// section 2.3</param> /// <param name="isEncyptDrvLoadedorClearEncryptRequested">check if the NTFS encryption driver is not /// loaded or the FILE_CLEAR_ENCRYPTION operation was requested</param> /// <param name="isINDEX_ROOTattributeFound">check if the $INDEX_ROOT attribute of the directory that was /// trying to be encrypted, is found</param> public void VerifyMessageSyntaxFsctlSetEncryptionReply(ushort expectedNTFSMajorVersion, FsctlSetEncryptionReplyStatus ReturnedStatusCode, bool isEncyptDrvLoadedorClearEncryptRequested, bool isINDEX_ROOTattributeFound) { Site.DefaultProtocolDocShortName = "MS-FSCC"; if (bool.Parse(Site.Properties["IsWindows"])) { // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1898."); // // Verify MS-FSCC requirement: MS-FSCC_R1898 // bool isVerifyR1898 = (expectedNTFSMajorVersion >= 2); Site.CaptureRequirementIfIsTrue( isVerifyR1898, 1898, @"<36> Section 2.3.52: On Windows, encryption requires NTFS major version 2 or greater."); if (isEncyptDrvLoadedorClearEncryptRequested) { // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1899"); // // Verify MS-FSCC requirement: MS-FSCC_R1899 // // STATUS_INVALID_DEVICE_REQUEST 0xC0000010 Site.CaptureRequirementIfAreEqual<uint>( (uint)FsctlSetEncryptionReplyStatus.STATUS_INVALID_DEVICE_REQUEST, (uint)ReturnedStatusCode, 1899, @"<37> Section 2.3.52: Windows returns this error code[STATUS_INVALID_DEVICE_REQUEST 0xC0000010] if the NTFS encryption driver is not loaded or the FILE_CLEAR_ENCRYPTION operation was requested on a file containing a stream that is still marked as encrypted."); } if (!isINDEX_ROOTattributeFound) { // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1900"); // // Verify MS-FSCC requirement: MS-FSCC_R1900 // //STATUS_FILE_CORRUPT_ERROR 0xC0000102 Site.CaptureRequirementIfAreEqual<uint>( (uint)FsctlSetEncryptionReplyStatus.STATUS_FILE_CORRUPT_ERROR, (uint)ReturnedStatusCode, 1900, @"<38> Section 2.3.52: Windows returns this error code[STATUS_FILE_CORRUPT_ERROR 0xC0000102] if the $INDEX_ROOT attribute of the directory that was trying to be encrypted, could not be found."); } } Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"]; }