mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-05-29 16:59:50 +02:00
Added MS-FSCC enums and structures required for SMB2
This commit is contained in:
parent
cbe4160675
commit
d5b73a8f9d
37 changed files with 2184 additions and 4 deletions
|
@ -0,0 +1,66 @@
|
|||
/* Copyright (C) 2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
*
|
||||
* You can redistribute this program and/or modify it under the terms of
|
||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||
* either version 3 of the License, or (at your option) any later version.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Utilities;
|
||||
|
||||
namespace SMBLibrary
|
||||
{
|
||||
/// <summary>
|
||||
/// [MS-FSCC] 2.5.1 - FileFsAttributeInformation
|
||||
/// </summary>
|
||||
public class FileFsAttributeInformation : FileSystemInformation
|
||||
{
|
||||
public const int FixedLength = 12;
|
||||
|
||||
public FileSystemAttributes FileSystemAttributes;
|
||||
/// <summary>
|
||||
/// Maximum file name component length, in bytes, supported by the specified file system.
|
||||
/// The value of this field MUST be greater than zero and MUST be no more than 510.
|
||||
/// </summary>
|
||||
public uint MaximumComponentNameLength;
|
||||
private uint FileSystemNameLength;
|
||||
public string FileSystemName = String.Empty;
|
||||
|
||||
public FileFsAttributeInformation()
|
||||
{
|
||||
}
|
||||
|
||||
public FileFsAttributeInformation(byte[] buffer, int offset)
|
||||
{
|
||||
FileSystemAttributes = (FileSystemAttributes)LittleEndianConverter.ToUInt32(buffer, offset + 0);
|
||||
MaximumComponentNameLength = LittleEndianConverter.ToUInt32(buffer, offset + 4);
|
||||
FileSystemNameLength = LittleEndianConverter.ToUInt32(buffer, offset + 8);
|
||||
FileSystemName = ByteReader.ReadUTF16String(buffer, offset + 12, (int)FileSystemNameLength / 2);
|
||||
}
|
||||
|
||||
public override void WriteBytes(byte[] buffer, int offset)
|
||||
{
|
||||
FileSystemNameLength = (uint)(FileSystemName.Length * 2);
|
||||
LittleEndianWriter.WriteUInt32(buffer, offset + 0, (uint)FileSystemAttributes);
|
||||
LittleEndianWriter.WriteUInt32(buffer, offset + 4, MaximumComponentNameLength);
|
||||
LittleEndianWriter.WriteUInt32(buffer, offset + 8, FileSystemNameLength);
|
||||
ByteWriter.WriteUTF16String(buffer, offset + 12, FileSystemName);
|
||||
}
|
||||
|
||||
public override FileSystemInformationClass FileSystemInformationClass
|
||||
{
|
||||
get
|
||||
{
|
||||
return FileSystemInformationClass.FileFsAttributeInformation;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return FixedLength + FileSystemName.Length * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue