public static MessageStatus QueryFileObjectIdInfo(
            FileNamePattern fileNamePattern,
            QueryDirectoryScanType queryDirectoryScanType,
            QueryDirectoryFileNameMatchType queryDirectoryFileNameMatchType,
            QueryDirectoryOutputBufferType queryDirectoryOutputBufferType)
        {
            Condition.IsTrue(fileNamePattern == FileNamePattern.NotEmpty_LengthIsNotAMultipleOf4 ||
                fileNamePattern == FileNamePattern.Empty ||
                fileNamePattern == FileNamePattern.NotEmpty);

            bool emptyPattern = false;

            if (!isImplementQueryFileObjectIdInformation)
            {
                Helper.CaptureRequirement(4817, @"[In FileObjectIdInformation ] 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 FileNamePattern is not empty and FileNamePattern.Length (0 is a valid length) 
            //is not a multiple of 4
            if (fileNamePattern == FileNamePattern.NotEmpty_LengthIsNotAMultipleOf4)
            {
                Helper.CaptureRequirement(819, @"[In FileObjectIdInformation,Pseudocode for the operation is as follows:] 
                    If FileNamePattern is not empty and FileNamePattern.Length (0 is a valid length) is not a multiple of 4, 
                    the operation MUST be failed with STATUS_INVALID_PARAMETER.");
                return MessageStatus.INVALID_PARAMETER;
            }

            // If FileNamePattern is empty, then the object store MUST set EmptyPattern to 
            // True; otherwise it MUST set EmptyPattern to FALSE.
            if (fileNamePattern == FileNamePattern.Empty)
            {
                emptyPattern = true;
            }
            else
            {
                emptyPattern = false;
            }

            // If RestartScan is FALSE and EmptyPattern is true and there is no match, 
            //the operation MUST be failed with STATUS_NO_MORE_FILES.
            if ((queryDirectoryScanType == QueryDirectoryScanType.NotRestartScan) && 
                (emptyPattern) &&
                (queryDirectoryFileNameMatchType == QueryDirectoryFileNameMatchType.FileNamePatternNotMatched) &&
                queryDirectoryOutputBufferType != QueryDirectoryOutputBufferType.OutputBufferIsNotEnough)
            {
                Helper.CaptureRequirement(826, @"[In FileObjectIdInformation,Pseudocode for the operation is as follows:]
                    If RestartScan is FALSE and EmptyPattern is TRUE and there is no match[Any comparison where the ObjectId chunk is greater than 
                    or equal to the FileNamePattern.Buffer chunk], the operation MUST be failed with STATUS_NO_MORE_FILES.");
                return MessageStatus.NO_MORE_FILES;
            }

            // EmptyPattern is FALSE and there is no match.
            if ((!emptyPattern) && (queryDirectoryFileNameMatchType == QueryDirectoryFileNameMatchType.FileNamePatternNotMatched) &&
                queryDirectoryOutputBufferType != QueryDirectoryOutputBufferType.OutputBufferIsNotEnough)
            {
                Helper.CaptureRequirement(828, @"[In FileObjectIdInformation,Pseudocode for the operation is as follows:]The operation MUST fail with 
                    STATUS_NO_SUCH_FILE under any of the following conditions:EmptyPattern is FALSE and there is no match
                    [the volume for Files having File.ObjectId matching FileNamePattern].");
                return MessageStatus.NO_SUCH_FILE;
            }

            // EmptyPattern is true and RestartScan is true and there is no match.
            if ((emptyPattern) && 
                (queryDirectoryScanType == QueryDirectoryScanType.RestartScan) &&
                (queryDirectoryFileNameMatchType == QueryDirectoryFileNameMatchType.FileNamePatternNotMatched) &&
                queryDirectoryOutputBufferType != QueryDirectoryOutputBufferType.OutputBufferIsNotEnough)
            {
                Helper.CaptureRequirement(829, @"[In FileObjectIdInformation,Pseudocode for the operation is as follows:]The operation MUST fail with 
                    STATUS_NO_SUCH_FILE under any of the following conditions:EmptyPattern is TRUE and RestartScan is TRUE 
                    and there is no match[the volume for Files having File.ObjectId matching FileNamePattern].");
                return MessageStatus.NO_SUCH_FILE;
            }

            //The operation MUST fail with STATUS_BUFFER_OVERFLOW if OutputBuffer is not large enough to hold the first matching entry.
            if (queryDirectoryOutputBufferType == QueryDirectoryOutputBufferType.OutputBufferIsNotEnough)
            {
                Helper.CaptureRequirement(830, @"[In FileObjectIdInformation,Pseudocode for the operation is as follows:]The operation MUST fail with 
                    STATUS_BUFFER_OVERFLOW if OutputBuffer is not large enough to hold the first matching entry.");
                return MessageStatus.INFO_LENGTH_MISMATCH;
            }
            
            Helper.CaptureRequirement(813, @"[In Server Requests Querying a Directory]On completion, the object store MUST return:
                [Status,OutputBuffer,BytesReturned ].");
            Helper.CaptureRequirement(833, @"[In FileObjectIdInformation, Pseudocode for the operation is as follows:
                If there is at least one match]The object store MUST return:Status set to STATUS_SUCCESS.");
            return MessageStatus.SUCCESS;
        }
Example #2
0
        public static MessageStatus QueryFileObjectIdInfo(
            FileNamePattern fileNamePattern,
            QueryDirectoryScanType queryDirectoryScanType,
            QueryDirectoryFileNameMatchType queryDirectoryFileNameMatchType,
            QueryDirectoryOutputBufferType queryDirectoryOutputBufferType)
        {
            Condition.IsTrue(fileNamePattern == FileNamePattern.NotEmpty_LengthIsNotAMultipleOf4 ||
                             fileNamePattern == FileNamePattern.Empty ||
                             fileNamePattern == FileNamePattern.NotEmpty);

            bool emptyPattern = false;

            if (!isImplementQueryFileObjectIdInformation)
            {
                Helper.CaptureRequirement(4817, @"[In FileObjectIdInformation ] 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 FileNamePattern is not empty and FileNamePattern.Length (0 is a valid length)
            //is not a multiple of 4
            if (fileNamePattern == FileNamePattern.NotEmpty_LengthIsNotAMultipleOf4)
            {
                Helper.CaptureRequirement(819, @"[In FileObjectIdInformation,Pseudocode for the operation is as follows:] 
                    If FileNamePattern is not empty and FileNamePattern.Length (0 is a valid length) is not a multiple of 4, 
                    the operation MUST be failed with STATUS_INVALID_PARAMETER.");
                return(MessageStatus.INVALID_PARAMETER);
            }

            // If FileNamePattern is empty, then the object store MUST set EmptyPattern to
            // True; otherwise it MUST set EmptyPattern to FALSE.
            if (fileNamePattern == FileNamePattern.Empty)
            {
                emptyPattern = true;
            }
            else
            {
                emptyPattern = false;
            }

            // If RestartScan is FALSE and EmptyPattern is true and there is no match,
            //the operation MUST be failed with STATUS_NO_MORE_FILES.
            if ((queryDirectoryScanType == QueryDirectoryScanType.NotRestartScan) &&
                (emptyPattern) &&
                (queryDirectoryFileNameMatchType == QueryDirectoryFileNameMatchType.FileNamePatternNotMatched) &&
                queryDirectoryOutputBufferType != QueryDirectoryOutputBufferType.OutputBufferIsNotEnough)
            {
                Helper.CaptureRequirement(826, @"[In FileObjectIdInformation,Pseudocode for the operation is as follows:]
                    If RestartScan is FALSE and EmptyPattern is TRUE and there is no match[Any comparison where the ObjectId chunk is greater than 
                    or equal to the FileNamePattern.Buffer chunk], the operation MUST be failed with STATUS_NO_MORE_FILES.");
                return(MessageStatus.NO_MORE_FILES);
            }

            // EmptyPattern is FALSE and there is no match.
            if ((!emptyPattern) && (queryDirectoryFileNameMatchType == QueryDirectoryFileNameMatchType.FileNamePatternNotMatched) &&
                queryDirectoryOutputBufferType != QueryDirectoryOutputBufferType.OutputBufferIsNotEnough)
            {
                Helper.CaptureRequirement(828, @"[In FileObjectIdInformation,Pseudocode for the operation is as follows:]The operation MUST fail with 
                    STATUS_NO_SUCH_FILE under any of the following conditions:EmptyPattern is FALSE and there is no match
                    [the volume for Files having File.ObjectId matching FileNamePattern].");
                return(MessageStatus.NO_SUCH_FILE);
            }

            // EmptyPattern is true and RestartScan is true and there is no match.
            if ((emptyPattern) &&
                (queryDirectoryScanType == QueryDirectoryScanType.RestartScan) &&
                (queryDirectoryFileNameMatchType == QueryDirectoryFileNameMatchType.FileNamePatternNotMatched) &&
                queryDirectoryOutputBufferType != QueryDirectoryOutputBufferType.OutputBufferIsNotEnough)
            {
                Helper.CaptureRequirement(829, @"[In FileObjectIdInformation,Pseudocode for the operation is as follows:]The operation MUST fail with 
                    STATUS_NO_SUCH_FILE under any of the following conditions:EmptyPattern is TRUE and RestartScan is TRUE 
                    and there is no match[the volume for Files having File.ObjectId matching FileNamePattern].");
                return(MessageStatus.NO_SUCH_FILE);
            }

            //The operation MUST fail with STATUS_BUFFER_OVERFLOW if OutputBuffer is not large enough to hold the first matching entry.
            if (queryDirectoryOutputBufferType == QueryDirectoryOutputBufferType.OutputBufferIsNotEnough)
            {
                Helper.CaptureRequirement(830, @"[In FileObjectIdInformation,Pseudocode for the operation is as follows:]The operation MUST fail with 
                    STATUS_BUFFER_OVERFLOW if OutputBuffer is not large enough to hold the first matching entry.");
                return(MessageStatus.INFO_LENGTH_MISMATCH);
            }

            Helper.CaptureRequirement(813, @"[In Server Requests Querying a Directory]On completion, the object store MUST return:
                [Status,OutputBuffer,BytesReturned ].");
            Helper.CaptureRequirement(833, @"[In FileObjectIdInformation, Pseudocode for the operation is as follows:
                If there is at least one match]The object store MUST return:Status set to STATUS_SUCCESS.");
            return(MessageStatus.SUCCESS);
        }
        public static MessageStatus QueryFileReparsePointInformation(
            FileNamePattern fileNamePattern,
            QueryDirectoryScanType queryDirectoryScanType,
            QueryDirectoryFileNameMatchType queryDirectoryFileNameMatchType,
            QueryDirectoryOutputBufferType queryDirectoryOutputBufferType)
        {
            bool EmptyPattern = false;

            //If the object store does not implement this functionality, 
            //the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST
            if (!isImplementQueryFileReparsePointInformation)
            {
                Helper.CaptureRequirement(6276, @"[In FileReparsePointInformation]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 (fileNamePattern == FileNamePattern.NotEmpty_LengthIsNotAMultipleOf4)
            {
                Helper.CaptureRequirement(6280, @"[In FileReparsePointInformation]Pseudocode for the operation is as follows:
                    If FileNamePattern is not empty and FileNamePattern.Length (0 is a valid length) is not a multiple of 4, the operation 
                    MUST be failed with STATUS_INVALID_PARAMETER.");
                return MessageStatus.INVALID_PARAMETER;
            }

            if (fileNamePattern == FileNamePattern.Empty)
            {
                EmptyPattern = true;
            }
            else
            {
                EmptyPattern = false;
            }

            if ((queryDirectoryScanType == QueryDirectoryScanType.NotRestartScan) && 
                EmptyPattern &&
                (queryDirectoryFileNameMatchType == QueryDirectoryFileNameMatchType.FileNamePatternNotMatched))
            {
                Helper.CaptureRequirement(6286, @"[In FileReparsePointInformation]If RestartScan is FALSE and EmptyPattern is TRUE 
                    and there is no match, the operation MUST be failed with STATUS_NO_MORE_FILES.");
                return MessageStatus.NO_MORE_FILES;
            }

            if (!EmptyPattern 
                && (queryDirectoryFileNameMatchType == QueryDirectoryFileNameMatchType.FileNamePatternNotMatched))
            {
                Helper.CaptureRequirement(6287, @"[In FileReparsePointInformation]The operation MUST fail with STATUS_NO_SUCH_FILE under 
                    any of the following conditions:EmptyPattern is FALSE and there is no match.");
                return MessageStatus.NO_SUCH_FILE;
            }

            if (EmptyPattern && (queryDirectoryScanType == QueryDirectoryScanType.RestartScan) && 
                (queryDirectoryFileNameMatchType == QueryDirectoryFileNameMatchType.FileNamePatternNotMatched))
            {
                Helper.CaptureRequirement(6288, @"[In FileReparsePointInformation]The operation MUST fail with STATUS_NO_SUCH_FILE 
                    under any of the following conditions:EmptyPattern is TRUE and RestartScan is TRUE and there is no match.");
                return MessageStatus.NO_SUCH_FILE;
            }

            //If OutputBuffer is not large enough to hold the first matching entry
            if (queryDirectoryOutputBufferType == QueryDirectoryOutputBufferType.OutputBufferIsNotEnough)
            {
                Helper.CaptureRequirement(6289, @"[In FileReparsePointInformation]The operation MUST fail with STATUS_BUFFER_OVERFLOW 
                    if OutputBuffer is not large enough to hold the first matching entry.");
                return MessageStatus.INFO_LENGTH_MISMATCH;
            }

            //If there is at least one match, the operation is considered successful
            if (queryDirectoryFileNameMatchType == QueryDirectoryFileNameMatchType.FileNamePatternMatched)
            {
                Helper.CaptureRequirement(6290, @"[In FileReparsePointInformation]If there is at least one match, the operation is considered successful. 
                    The object store MUST return:[Status, OutputBuffer,ByteCount].");
                Helper.CaptureRequirement(6291, @"[In FileReparsePointInformation]Status set to STATUS_SUCCESS.");

                return MessageStatus.SUCCESS;
            }

            Helper.CaptureRequirement(6290, @"[In FileReparsePointInformation]If there is at least one match, the operation is considered successful. 
                The object store MUST return:[Status, OutputBuffer,ByteCount].");
            Helper.CaptureRequirement(6291, @"[In FileReparsePointInformation]Status set to STATUS_SUCCESS.");
            return MessageStatus.SUCCESS;
        }
Example #4
0
        public static MessageStatus QueryFileReparsePointInformation(
            FileNamePattern fileNamePattern,
            QueryDirectoryScanType queryDirectoryScanType,
            QueryDirectoryFileNameMatchType queryDirectoryFileNameMatchType,
            QueryDirectoryOutputBufferType queryDirectoryOutputBufferType)
        {
            bool EmptyPattern = false;

            //If the object store does not implement this functionality,
            //the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST
            if (!isImplementQueryFileReparsePointInformation)
            {
                Helper.CaptureRequirement(6276, @"[In FileReparsePointInformation]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 (fileNamePattern == FileNamePattern.NotEmpty_LengthIsNotAMultipleOf4)
            {
                Helper.CaptureRequirement(6280, @"[In FileReparsePointInformation]Pseudocode for the operation is as follows:
                    If FileNamePattern is not empty and FileNamePattern.Length (0 is a valid length) is not a multiple of 4, the operation 
                    MUST be failed with STATUS_INVALID_PARAMETER.");
                return(MessageStatus.INVALID_PARAMETER);
            }

            if (fileNamePattern == FileNamePattern.Empty)
            {
                EmptyPattern = true;
            }
            else
            {
                EmptyPattern = false;
            }

            if ((queryDirectoryScanType == QueryDirectoryScanType.NotRestartScan) &&
                EmptyPattern &&
                (queryDirectoryFileNameMatchType == QueryDirectoryFileNameMatchType.FileNamePatternNotMatched))
            {
                Helper.CaptureRequirement(6286, @"[In FileReparsePointInformation]If RestartScan is FALSE and EmptyPattern is TRUE 
                    and there is no match, the operation MUST be failed with STATUS_NO_MORE_FILES.");
                return(MessageStatus.NO_MORE_FILES);
            }

            if (!EmptyPattern &&
                (queryDirectoryFileNameMatchType == QueryDirectoryFileNameMatchType.FileNamePatternNotMatched))
            {
                Helper.CaptureRequirement(6287, @"[In FileReparsePointInformation]The operation MUST fail with STATUS_NO_SUCH_FILE under 
                    any of the following conditions:EmptyPattern is FALSE and there is no match.");
                return(MessageStatus.NO_SUCH_FILE);
            }

            if (EmptyPattern && (queryDirectoryScanType == QueryDirectoryScanType.RestartScan) &&
                (queryDirectoryFileNameMatchType == QueryDirectoryFileNameMatchType.FileNamePatternNotMatched))
            {
                Helper.CaptureRequirement(6288, @"[In FileReparsePointInformation]The operation MUST fail with STATUS_NO_SUCH_FILE 
                    under any of the following conditions:EmptyPattern is TRUE and RestartScan is TRUE and there is no match.");
                return(MessageStatus.NO_SUCH_FILE);
            }

            //If OutputBuffer is not large enough to hold the first matching entry
            if (queryDirectoryOutputBufferType == QueryDirectoryOutputBufferType.OutputBufferIsNotEnough)
            {
                Helper.CaptureRequirement(6289, @"[In FileReparsePointInformation]The operation MUST fail with STATUS_BUFFER_OVERFLOW 
                    if OutputBuffer is not large enough to hold the first matching entry.");
                return(MessageStatus.INFO_LENGTH_MISMATCH);
            }

            //If there is at least one match, the operation is considered successful
            if (queryDirectoryFileNameMatchType == QueryDirectoryFileNameMatchType.FileNamePatternMatched)
            {
                Helper.CaptureRequirement(6290, @"[In FileReparsePointInformation]If there is at least one match, the operation is considered successful. 
                    The object store MUST return:[Status, OutputBuffer,ByteCount].");
                Helper.CaptureRequirement(6291, @"[In FileReparsePointInformation]Status set to STATUS_SUCCESS.");

                return(MessageStatus.SUCCESS);
            }

            Helper.CaptureRequirement(6290, @"[In FileReparsePointInformation]If there is at least one match, the operation is considered successful. 
                The object store MUST return:[Status, OutputBuffer,ByteCount].");
            Helper.CaptureRequirement(6291, @"[In FileReparsePointInformation]Status set to STATUS_SUCCESS.");
            return(MessageStatus.SUCCESS);
        }