Moved and renamed ExtendedAttributeFlags

This commit is contained in:
Tal Aloni 2017-09-01 10:42:26 +03:00
parent cd048bfbf7
commit b56f96d557
5 changed files with 16 additions and 14 deletions

View file

@ -0,0 +1,10 @@
using System;
namespace SMBLibrary
{
[Flags]
public enum ExtendedAttributeFlags : byte
{
FILE_NEED_EA = 0x80,
}
}

View file

@ -19,7 +19,7 @@ namespace SMBLibrary
public const int FixedLength = 8; public const int FixedLength = 8;
public uint NextEntryOffset; public uint NextEntryOffset;
public byte Flags; public ExtendedAttributeFlags Flags;
private byte EaNameLength; private byte EaNameLength;
private ushort EaValueLength; private ushort EaValueLength;
public string EaName; // 8-bit ASCII followed by a single terminating null character byte public string EaName; // 8-bit ASCII followed by a single terminating null character byte
@ -32,7 +32,7 @@ namespace SMBLibrary
public FileFullEAEntry(byte[] buffer, int offset) public FileFullEAEntry(byte[] buffer, int offset)
{ {
NextEntryOffset = LittleEndianReader.ReadUInt32(buffer, ref offset); NextEntryOffset = LittleEndianReader.ReadUInt32(buffer, ref offset);
Flags = ByteReader.ReadByte(buffer, ref offset); Flags = (ExtendedAttributeFlags)ByteReader.ReadByte(buffer, ref offset);
EaNameLength = ByteReader.ReadByte(buffer, ref offset); EaNameLength = ByteReader.ReadByte(buffer, ref offset);
EaValueLength = LittleEndianReader.ReadUInt16(buffer, ref offset); EaValueLength = LittleEndianReader.ReadUInt16(buffer, ref offset);
EaName = ByteReader.ReadAnsiString(buffer, ref offset, EaNameLength); EaName = ByteReader.ReadAnsiString(buffer, ref offset, EaNameLength);
@ -45,7 +45,7 @@ namespace SMBLibrary
EaNameLength = (byte)EaName.Length; EaNameLength = (byte)EaName.Length;
EaValueLength = (ushort)EaValue.Length; EaValueLength = (ushort)EaValue.Length;
LittleEndianWriter.WriteUInt32(buffer, ref offset, NextEntryOffset); LittleEndianWriter.WriteUInt32(buffer, ref offset, NextEntryOffset);
ByteWriter.WriteByte(buffer, ref offset, Flags); ByteWriter.WriteByte(buffer, ref offset, (byte)Flags);
ByteWriter.WriteByte(buffer, ref offset, EaNameLength); ByteWriter.WriteByte(buffer, ref offset, EaNameLength);
LittleEndianWriter.WriteUInt16(buffer, ref offset, EaValueLength); LittleEndianWriter.WriteUInt16(buffer, ref offset, EaValueLength);
ByteWriter.WriteAnsiString(buffer, ref offset, EaName); ByteWriter.WriteAnsiString(buffer, ref offset, EaName);

View file

@ -1,8 +0,0 @@
namespace SMBLibrary.SMB1
{
public enum ExtendedAttributeFlag : byte
{
FILE_NEED_EA = 0x80,
}
}

View file

@ -16,7 +16,7 @@ namespace SMBLibrary.SMB1
/// </summary> /// </summary>
public class FullExtendedAttribute public class FullExtendedAttribute
{ {
public ExtendedAttributeFlag ExtendedAttributeFlag; public ExtendedAttributeFlags ExtendedAttributeFlag;
private byte AttributeNameLengthInBytes; private byte AttributeNameLengthInBytes;
private ushort AttributeValueLengthInBytes; private ushort AttributeValueLengthInBytes;
public string AttributeName; // ANSI, AttributeNameLengthInBytes + 1 byte null termination public string AttributeName; // ANSI, AttributeNameLengthInBytes + 1 byte null termination
@ -28,7 +28,7 @@ namespace SMBLibrary.SMB1
public FullExtendedAttribute(byte[] buffer, int offset) public FullExtendedAttribute(byte[] buffer, int offset)
{ {
ExtendedAttributeFlag = (ExtendedAttributeFlag)ByteReader.ReadByte(buffer, offset); ExtendedAttributeFlag = (ExtendedAttributeFlags)ByteReader.ReadByte(buffer, offset);
AttributeNameLengthInBytes = ByteReader.ReadByte(buffer, offset + 1); AttributeNameLengthInBytes = ByteReader.ReadByte(buffer, offset + 1);
AttributeValueLengthInBytes = LittleEndianConverter.ToUInt16(buffer, offset + 2); AttributeValueLengthInBytes = LittleEndianConverter.ToUInt16(buffer, offset + 2);
AttributeName = ByteReader.ReadAnsiString(buffer, offset + 4, AttributeNameLengthInBytes); AttributeName = ByteReader.ReadAnsiString(buffer, offset + 4, AttributeNameLengthInBytes);

View file

@ -94,6 +94,7 @@
<Compile Include="NTFileStore\Adapter\NTFileSystemAdapter.QueryFileSystem.cs" /> <Compile Include="NTFileStore\Adapter\NTFileSystemAdapter.QueryFileSystem.cs" />
<Compile Include="NTFileStore\Adapter\NTFileSystemAdapter.Set.cs" /> <Compile Include="NTFileStore\Adapter\NTFileSystemAdapter.Set.cs" />
<Compile Include="NTFileStore\Enums\FileInformation\CompressionFormat.cs" /> <Compile Include="NTFileStore\Enums\FileInformation\CompressionFormat.cs" />
<Compile Include="NTFileStore\Enums\FileInformation\ExtendedAttributeFlags.cs" />
<Compile Include="NTFileStore\Enums\FileInformation\FileAttributes.cs" /> <Compile Include="NTFileStore\Enums\FileInformation\FileAttributes.cs" />
<Compile Include="NTFileStore\Enums\FileInformation\FileInformationClass.cs" /> <Compile Include="NTFileStore\Enums\FileInformation\FileInformationClass.cs" />
<Compile Include="NTFileStore\Enums\FileSystemInformation\DeviceCharacteristics.cs" /> <Compile Include="NTFileStore\Enums\FileSystemInformation\DeviceCharacteristics.cs" />
@ -458,7 +459,6 @@
<Compile Include="SMB1FileStore\Enums\QueryFSInformationLevel.cs" /> <Compile Include="SMB1FileStore\Enums\QueryFSInformationLevel.cs" />
<Compile Include="SMB1FileStore\Enums\QueryInformationLevel.cs" /> <Compile Include="SMB1FileStore\Enums\QueryInformationLevel.cs" />
<Compile Include="SMB1FileStore\Enums\SetInformationLevel.cs" /> <Compile Include="SMB1FileStore\Enums\SetInformationLevel.cs" />
<Compile Include="SMB1FileStore\Structures\ExtendedFileAttributes\Enums\ExtendedAttributeFlag.cs" />
<Compile Include="SMB1FileStore\Structures\ExtendedFileAttributes\ExtendedAttributeName.cs" /> <Compile Include="SMB1FileStore\Structures\ExtendedFileAttributes\ExtendedAttributeName.cs" />
<Compile Include="SMB1FileStore\Structures\ExtendedFileAttributes\ExtendedAttributeNameList.cs" /> <Compile Include="SMB1FileStore\Structures\ExtendedFileAttributes\ExtendedAttributeNameList.cs" />
<Compile Include="SMB1FileStore\Structures\ExtendedFileAttributes\FullExtendedAttribute.cs" /> <Compile Include="SMB1FileStore\Structures\ExtendedFileAttributes\FullExtendedAttribute.cs" />