/// <summary> /// Verify SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO Structure. /// </summary> /// <param name="info">A SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO Structure.</param> private void VerifyMessageSyntaxSmbFindFileIdFullDirectoryInfo(FSCC.FileFullDirectoryInformation info) { // // The following statement code will be run only when debugging. // Site.Log.Add(LogEntryKind.Debug, @"Verify MS-SMB_R9469"); // // Verify MS-SMB requirement: MS-SMB_R9469. // Site.CaptureRequirementIfAreEqual<uint>( 0, info.FileIndex, 9469, @"[In SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO]FileIndex (4 bytes): This field MUST be set to zero when sending a response."); // // The following statement code will be run only when debugging. // Site.Log.Add(LogEntryKind.Debug, @"Verify MS-SMB_R9471"); // // Verify MS-SMB requirement: MS-SMB_R9471. // Site.CaptureRequirementIfAreEqual<long>( 0, info.EndOfFile, 9471, @"[In SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO]EndOfFile (8 bytes): This LARGE_INTEGER field MUST be set to zero when sending a response."); // // The following statement code will be run only when debugging. // Site.Log.Add(LogEntryKind.Debug, @"Verify MS-SMB_R9473"); // // Verify MS-SMB requirement: MS-SMB_R9473 // Site.CaptureRequirementIfAreEqual<long>( 0, info.AllocationSize, 9473, @"[In SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO]AllocationSize (8 bytes): This LARGE_INTEGER field MUST be set to zero when sending a response."); // // The following statement code will be run only when debugging. // Site.Log.Add(LogEntryKind.Debug, @"Verify MS-SMB_R9477"); // // Verify MS-SMB requirement: MS-SMB_R9477. // Site.CaptureRequirementIfAreEqual<uint>( 0, info.EaSize, 9477, @"[In SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO]EaSize (4 bytes): This field MUST be set to zero when sending a response."); // // The following statement code will be run only when debugging. // Site.Log.Add(LogEntryKind.Debug, @"Verify MS-SMB_R9475"); // // Verify MS-SMB requirement: MS-SMB_R9475. // Site.CaptureRequirementIfAreEqual<CIFS.SmbFileAttributes32>( CIFS.SmbFileAttributes32.FILE_ATTRIBUTE_DIRECTORY, (CIFS.SmbFileAttributes32)info.FileAttributes, 9475, @"[In SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO]ExtFileAttributes (4 bytes): Extended attributes for this file that MUST be marked as a DIRECTORY."); // // The following statement code will be run only when debugging. // Site.Log.Add(LogEntryKind.Debug, @"Verify MS-SMB_R9480"); // If the FileID isn't unique, it will throw exception and the case will stop and won't come here. // So this requirement has been verified by the protocol SDK. Site.CaptureRequirement( 9480, @"[In SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO]This number MUST be unique for each file on a given volume."); // // The following statement code will be run only when debugging. // Site.Log.Add(LogEntryKind.Debug, @"Verify MS-SMB_R9481"); // // Verify MS-SMB requirement: MS-SMB_R9481 // Site.CaptureRequirementIfAreEqual<uint>( 0, info.FileIndex, 9481, @"[In SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO]Fileindex (4 bytes): This field MUST be set to zero when sending a response."); }
/// <summary> /// Verify SMB_FIND_FILE_BOTH_DIRECTORY_INFO structure. /// </summary> /// <param name="info">A SMB_FIND_FILE_BOTH_DIRECTORY_INFO structure.</param> private void VerifyMessageSyntaxSmbFindFileBothDirectoryInfo(FSCC.FileBothDirectoryInformation info) { // The following statement code will be run only when debugging. // Site.Log.Add(LogEntryKind.Debug, @"Verify MS-SMB_R1755"); // // Verify MS-SMB requirement: MS-SMB_R1755. // Site.CaptureRequirementIfAreEqual<uint>( 0, info.FileIndex, 1755, @"[In SMB_FIND_FILE_BOTH_DIRECTORY_INFO Extensions]FileIndex (4 bytes): This field MUST be set to zero when sending a response."); // // The following statement code will be run only when debugging. // Site.Log.Add(LogEntryKind.Debug, @"Verify MS-SMB_R1757"); // // Verify MS-SMB requirement: MS-SMB_R1757. // Site.CaptureRequirementIfAreEqual<long>( 0, info.EndOfFile, 1757, @"[In SMB_FIND_FILE_BOTH_DIRECTORY_INFO Extensions]EndOfFile (8 bytes): This LARGE_INTEGER field MUST be set to zero when sending a response."); // // The following statement code will be run only when debugging. // Site.Log.Add(LogEntryKind.Debug, @"Verify MS-SMB_R1759"); // // Verify MS-SMB requirement: MS-SMB_R1759. // Site.CaptureRequirementIfAreEqual<long>( 0, info.AllocationSize, 1759, @"[In SMB_FIND_FILE_BOTH_DIRECTORY_INFO Extensions]AllocationSize (8 bytes): This LARGE_INTEGER field MUST be set to zero when sending a response."); // // The following statement code will be run only when debugging. // Site.Log.Add(LogEntryKind.Debug, @"Verify MS-SMB_R1776"); // // Verify MS-SMB requirement: MS-SMB_R1776. // Site.CaptureRequirementIfAreEqual<uint>( 0, info.EaSize, 1776, @"[In SMB_FIND_FILE_BOTH_DIRECTORY_INFO Extensions]EaSize (4 bytes): This field MUST be set to zero when sending a response ."); // // The following statement code will be run only when debugging. // Site.Log.Add(LogEntryKind.Debug, @"Verify MS-SMB_R1775"); // // Verify MS-SMB requirement: MS-SMB_R1775. // Site.CaptureRequirementIfAreEqual<CIFS.SmbFileAttributes32>( CIFS.SmbFileAttributes32.FILE_ATTRIBUTE_DIRECTORY, (CIFS.SmbFileAttributes32)info.FileAttributes, 1775, @"[In SMB_FIND_FILE_BOTH_DIRECTORY_INFO Extensions]ExtFileAttributes (4 bytes): Extended attributes for this file that MUST be marked as a DIRECTORY."); // // The following statement code will be run only when debugging. // Site.Log.Add(LogEntryKind.Debug, @"Verify MS-SMB_R3474"); // // Verify MS-SMB requirement: MS-SMB_R3474. // Site.CaptureRequirementIfAreEqual<byte>( 0x00, info.Reserved, 3474, @"[In SMB_FIND_FILE_BOTH_DIRECTORY_INFO Extensions]Reserved (1 byte): This field MUST be 0x00."); // // The following statement code will be run only when debugging. // Site.Log.Add(LogEntryKind.Debug, @"Verify MS-SMB_R3476"); // // Verify MS-SMB requirement: MS-SMB_R3476. // // ShortName is defined as short[], so here need to use info.ShortName.Length * // Marshal.SizeOf (info.ShortName[0]) to represents the byte-length of ShortName. Site.CaptureRequirementIfAreEqual<int>( 24, info.ShortName.Length * Marshal.SizeOf(info.ShortName[0]), 3476, @"[In SMB_FIND_FILE_BOTH_DIRECTORY_INFO Extensions]ShortName (24 bytes):The ShortName field MUST be formatted as an array of 16-bit Unicode characters"); bool nullTerminated = (info.ShortNameLength > 0) && (info.ShortName[info.ShortNameLength - 1] == 0) && (info.ShortName[info.ShortNameLength - 2] != 0); // // Verify MS-SMB requirement: MS-SMB_R103476. // Site.CaptureRequirementIfIsFalse( nullTerminated, 103476, @"[In SMB_FIND_FILE_BOTH_DIRECTORY_INFO Extensions]ShortName (24 bytes):The ShortName field MUST NOT be NULL terminated.<2>"); }