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);
 }
 internal static MessageStatus WorkAroundFsCtlSetEncryption(bool isIsCompressedTrue, EncryptionOperation encryptionOpteration, BufferSize bufferSize, MessageStatus returnedStatus, ITestSite site)
 {
     if (returnedStatus == MessageStatus.NOT_SUPPORTED)
     {
         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>(3901, MessageStatus.INVALID_PARAMETER, returnedStatus, site);
         }
         else
         {
             returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(3919, MessageStatus.SUCCESS, 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;
        }
 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;
 }