public static MessageStatus QueryDirectoryInfo( FileNamePattern fileNamePattern, bool restartScan, bool isNoRecordsReturned, bool isOutBufferSizeLess, OutBufferSmall outBufferSize) { MessageStatus returnStatus = MessageStatus.SUCCESS; //If OutputBufferSize is less than the size needed to return a single entry if (isOutBufferSizeLess) { switch (outBufferSize) { case OutBufferSmall.FileBothDirectoryInformation: { Helper.CaptureRequirement(4881, @"[In FileBothDirectoryInformation] Pseudocode for the operation is as follows: If OutputBufferSize is smaller than FieldOffset( FILE_BOTH_DIR_INFORMATION.FileName ), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return MessageStatus.INFO_LENGTH_MISMATCH; } case OutBufferSmall.FileDirectoryInformation: { Helper.CaptureRequirement(4904, @"[In FileDirectoryInformation] Pseudocode for the operation is as follows: If OutputBufferSize is smaller than FieldOffset( FILE_DIRECTORY_INFORMATION.FileName ), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return MessageStatus.INFO_LENGTH_MISMATCH; } case OutBufferSmall.FileFullDirectoryInformation: { Helper.CaptureRequirement(4920, @"[In FileFullDirectoryInformation] Pseudocode for the operation is as follows: If OutputBufferSize is smaller than FieldOffset( FILE_FULL_DIR_INFORMATION.FileName ), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return MessageStatus.INFO_LENGTH_MISMATCH; } case OutBufferSmall.FileIdBothDirectoryInformation: { Helper.CaptureRequirement(4939, @"[In FileIdBothDirectoryInformation] Pseudocode for the operation is as follows: If OutputBufferSize is smaller than FieldOffset( FILE_ID_BOTH_DIR_INFORMATION.FileName ), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return MessageStatus.INFO_LENGTH_MISMATCH; } case OutBufferSmall.FileIdFullDirectoryInformation: { return MessageStatus.INFO_LENGTH_MISMATCH; } case OutBufferSmall.FileNamesInformation: { Helper.CaptureRequirement(4983, @"[In FileNamesInformation] Pseudocode for the operation is as follows: If OutputBufferSize is smaller than FieldOffset( FILE_NAMES_INFORMATION.FileName ), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return MessageStatus.INFO_LENGTH_MISMATCH; } default: break; } Helper.CaptureRequirement(4836, @"[In Directory Information Queries] Pseudocode for the algorithm is as follows: If OutputBufferSize is less than the size needed to return a single entry, the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return MessageStatus.INFO_LENGTH_MISMATCH; } if (fileNamePattern == FileNamePattern.Empty) { fileNamePattern = FileNamePattern.IndicateAll; } else { //If FileNamePattern is not a valid filename component as described in [MS-FSCC] section 2.1.5, with the exceptions that wildcard characters described in section 3.1.4.3 are permitted and the strings "." and ".." are permitted if (fileNamePattern == FileNamePattern.NotValidFilenameComponent) { Helper.CaptureRequirement(849, @"[In Directory Information Queries ,Pseudocode for the algorithm is as follows: If Open.QueryPattern is empty] else [if FileNamePattern is not empty]If FileNamePattern is not a valid filename component as described in [MS-FSCC] section 2.1.5, with the exceptions that wildcard characters described in section 3.1.4.3 are permitted and the strings \"".\"" and \""..\"" are permitted, the operation MUST be failed with STATUS_OBJECT_NAME_INVALID."); return MessageStatus.OBJECT_NAME_INVALID; } } //If no records are being returned if (isNoRecordsReturned) { //If FirstQuery is true if (firstQuery) { firstQuery = false; Helper.CaptureRequirement(4875, @"[In Directory Information Queries,Pseudocode for the algorithm is as follows:] If no records are being returned:If FirstQuery is TRUE:Set StatusToReturn to STATUS_NO_SUCH_FILE, which means no files were found in this directory that match the given wildcard pattern."); returnStatus = MessageStatus.NO_SUCH_FILE; } else { Helper.CaptureRequirement(4876, @"[In Directory Information Queries,Pseudocode for the algorithm is as follows: If no records are being returned:] Else[If FirstQuery is FALSE]:Set StatusToReturn to STATUS_NO_MORE_FILES, which means no more files were found in this directory that match the given wildcard pattern."); returnStatus = MessageStatus.NO_MORE_FILES; } } Helper.CaptureRequirement(865, @"[In Directory Information Queries,Pseudocode for the algorithm is as follows:Add a context, if the operation succeeds ]The object store MUST return:Status set to StatusToReturn."); return returnStatus; }
public static MessageStatus QueryDirectoryInfo( FileNamePattern fileNamePattern, bool restartScan, bool isNoRecordsReturned, bool isOutBufferSizeLess, OutBufferSmall outBufferSize) { MessageStatus returnStatus = MessageStatus.SUCCESS; //If OutputBufferSize is less than the size needed to return a single entry if (isOutBufferSizeLess) { switch (outBufferSize) { case OutBufferSmall.FileBothDirectoryInformation: { Helper.CaptureRequirement(4881, @"[In FileBothDirectoryInformation] Pseudocode for the operation is as follows: If OutputBufferSize is smaller than FieldOffset( FILE_BOTH_DIR_INFORMATION.FileName ), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return(MessageStatus.INFO_LENGTH_MISMATCH); } case OutBufferSmall.FileDirectoryInformation: { Helper.CaptureRequirement(4904, @"[In FileDirectoryInformation] Pseudocode for the operation is as follows: If OutputBufferSize is smaller than FieldOffset( FILE_DIRECTORY_INFORMATION.FileName ), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return(MessageStatus.INFO_LENGTH_MISMATCH); } case OutBufferSmall.FileFullDirectoryInformation: { Helper.CaptureRequirement(4920, @"[In FileFullDirectoryInformation] Pseudocode for the operation is as follows: If OutputBufferSize is smaller than FieldOffset( FILE_FULL_DIR_INFORMATION.FileName ), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return(MessageStatus.INFO_LENGTH_MISMATCH); } case OutBufferSmall.FileIdBothDirectoryInformation: { Helper.CaptureRequirement(4939, @"[In FileIdBothDirectoryInformation] Pseudocode for the operation is as follows: If OutputBufferSize is smaller than FieldOffset( FILE_ID_BOTH_DIR_INFORMATION.FileName ), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return(MessageStatus.INFO_LENGTH_MISMATCH); } case OutBufferSmall.FileIdFullDirectoryInformation: { return(MessageStatus.INFO_LENGTH_MISMATCH); } case OutBufferSmall.FileNamesInformation: { Helper.CaptureRequirement(4983, @"[In FileNamesInformation] Pseudocode for the operation is as follows: If OutputBufferSize is smaller than FieldOffset( FILE_NAMES_INFORMATION.FileName ), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return(MessageStatus.INFO_LENGTH_MISMATCH); } default: break; } Helper.CaptureRequirement(4836, @"[In Directory Information Queries] Pseudocode for the algorithm is as follows: If OutputBufferSize is less than the size needed to return a single entry, the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH."); return(MessageStatus.INFO_LENGTH_MISMATCH); } if (fileNamePattern == FileNamePattern.Empty) { fileNamePattern = FileNamePattern.IndicateAll; } else { //If FileNamePattern is not a valid filename component as described in [MS-FSCC] section 2.1.5, with the exceptions that wildcard characters described in section 3.1.4.3 are permitted and the strings "." and ".." are permitted if (fileNamePattern == FileNamePattern.NotValidFilenameComponent) { Helper.CaptureRequirement(849, @"[In Directory Information Queries ,Pseudocode for the algorithm is as follows: If Open.QueryPattern is empty] else [if FileNamePattern is not empty]If FileNamePattern is not a valid filename component as described in [MS-FSCC] section 2.1.5, with the exceptions that wildcard characters described in section 3.1.4.3 are permitted and the strings \"".\"" and \""..\"" are permitted, the operation MUST be failed with STATUS_OBJECT_NAME_INVALID."); return(MessageStatus.OBJECT_NAME_INVALID); } } //If no records are being returned if (isNoRecordsReturned) { //If FirstQuery is true if (firstQuery) { firstQuery = false; Helper.CaptureRequirement(4875, @"[In Directory Information Queries,Pseudocode for the algorithm is as follows:] If no records are being returned:If FirstQuery is TRUE:Set StatusToReturn to STATUS_NO_SUCH_FILE, which means no files were found in this directory that match the given wildcard pattern."); returnStatus = MessageStatus.NO_SUCH_FILE; } else { Helper.CaptureRequirement(4876, @"[In Directory Information Queries,Pseudocode for the algorithm is as follows: If no records are being returned:] Else[If FirstQuery is FALSE]:Set StatusToReturn to STATUS_NO_MORE_FILES, which means no more files were found in this directory that match the given wildcard pattern."); returnStatus = MessageStatus.NO_MORE_FILES; } } Helper.CaptureRequirement(865, @"[In Directory Information Queries,Pseudocode for the algorithm is as follows:Add a context, if the operation succeeds ]The object store MUST return:Status set to StatusToReturn."); return(returnStatus); }