diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FullExtendedAttribute.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FullExtendedAttribute.cs
index 4da1c8e..fe5e3e8 100644
--- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FullExtendedAttribute.cs
+++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FullExtendedAttribute.cs
@@ -12,34 +12,38 @@ using Utilities;
namespace SMBLibrary.SMB1
{
///
- /// SMB_FEA
+ /// [MS-CIFS] 2.2.1.2.2 - SMB_FEA
///
public class FullExtendedAttribute
{
public ExtendedAttributeFlag ExtendedAttributeFlag;
- //byte AttributeNameLengthInBytes;
- //ushort AttributeValueLengthInBytes;
+ private byte AttributeNameLengthInBytes;
+ private ushort AttributeValueLengthInBytes;
public string AttributeName; // ANSI, AttributeNameLengthInBytes + 1 byte null termination
public string AttributeValue; // ANSI
+ public FullExtendedAttribute()
+ {
+ }
+
public FullExtendedAttribute(byte[] buffer, int offset)
{
ExtendedAttributeFlag = (ExtendedAttributeFlag)ByteReader.ReadByte(buffer, offset);
- byte attributeNameLengthInBytes = ByteReader.ReadByte(buffer, offset + 1);
- ushort attributeValueLengthInBytes = LittleEndianConverter.ToUInt16(buffer, offset + 2);
- AttributeName = ByteReader.ReadAnsiString(buffer, offset + 4, attributeNameLengthInBytes);
- AttributeValue = ByteReader.ReadAnsiString(buffer, offset + 4 + attributeNameLengthInBytes + 1, attributeValueLengthInBytes);
+ AttributeNameLengthInBytes = ByteReader.ReadByte(buffer, offset + 1);
+ AttributeValueLengthInBytes = LittleEndianConverter.ToUInt16(buffer, offset + 2);
+ AttributeName = ByteReader.ReadAnsiString(buffer, offset + 4, AttributeNameLengthInBytes);
+ AttributeValue = ByteReader.ReadAnsiString(buffer, offset + 4 + AttributeNameLengthInBytes + 1, AttributeValueLengthInBytes);
}
public void WriteBytes(byte[] buffer, int offset)
{
- byte attributeNameLengthInBytes = (byte)AttributeName.Length;
- ushort attributeValueLengthInBytes = (ushort)AttributeValue.Length;
+ AttributeNameLengthInBytes = (byte)AttributeName.Length;
+ AttributeValueLengthInBytes = (ushort)AttributeValue.Length;
ByteWriter.WriteByte(buffer, offset, (byte)ExtendedAttributeFlag);
- ByteWriter.WriteByte(buffer, offset + 1, attributeNameLengthInBytes);
- LittleEndianWriter.WriteUInt16(buffer, offset + 2, attributeValueLengthInBytes);
- ByteWriter.WriteAnsiString(buffer, offset + 4, AttributeName, AttributeValue.Length);
- ByteWriter.WriteAnsiString(buffer, offset + 4 + attributeNameLengthInBytes + 1, AttributeValue, AttributeValue.Length);
+ ByteWriter.WriteByte(buffer, offset + 1, AttributeNameLengthInBytes);
+ LittleEndianWriter.WriteUInt16(buffer, offset + 2, AttributeValueLengthInBytes);
+ ByteWriter.WriteAnsiString(buffer, offset + 4, AttributeName, AttributeName.Length);
+ ByteWriter.WriteAnsiString(buffer, offset + 4 + AttributeNameLengthInBytes + 1, AttributeValue, AttributeValue.Length);
}
public int Length
diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FullExtendedAttributeList.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FullExtendedAttributeList.cs
index ab8f1eb..57d678b 100644
--- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FullExtendedAttributeList.cs
+++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FullExtendedAttributeList.cs
@@ -12,7 +12,7 @@ using Utilities;
namespace SMBLibrary.SMB1
{
///
- /// SMB_FEA_LIST
+ /// [MS-CIFS] 2.2.1.2.2.1 - SMB_FEA_LIST
///
public class FullExtendedAttributeList : List
{
@@ -26,14 +26,14 @@ namespace SMBLibrary.SMB1
public FullExtendedAttributeList(byte[] buffer, ref int offset) : this(buffer, offset)
{
- // length MUST contain the total size of the FEAList field, plus the size of the SizeOfListInBytes field
- int length = (int)LittleEndianConverter.ToUInt32(buffer, offset);
+ // [MS-CIFS] length MUST contain the total size of the FEAList field, plus the size of the SizeOfListInBytes field
+ int length = (int)LittleEndianConverter.ToUInt32(buffer, offset + 0);
offset += length;
}
public FullExtendedAttributeList(byte[] buffer, int offset)
{
- // length MUST contain the total size of the FEAList field, plus the size of the SizeOfListInBytes field
+ // [MS-CIFS] length MUST contain the total size of the FEAList field, plus the size of the SizeOfListInBytes field
int length = (int)LittleEndianConverter.ToUInt32(buffer, offset);
int position = offset + 4;
int eof = offset + length;
@@ -60,6 +60,7 @@ namespace SMBLibrary.SMB1
public void WriteBytes(byte[] buffer, int offset)
{
+ LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)Length);
foreach (FullExtendedAttribute entry in this)
{
entry.WriteBytes(buffer, offset);
@@ -71,7 +72,7 @@ namespace SMBLibrary.SMB1
{
get
{
- int length = 0;
+ int length = 4;
foreach (FullExtendedAttribute entry in this)
{
length += entry.Length;