diff --git a/SMBLibrary/Enums/FileInformation/FileInformationClass.cs b/SMBLibrary/Enums/FileInformation/FileInformationClass.cs
index c53f847..b58e639 100644
--- a/SMBLibrary/Enums/FileInformation/FileInformationClass.cs
+++ b/SMBLibrary/Enums/FileInformation/FileInformationClass.cs
@@ -13,6 +13,8 @@ namespace SMBLibrary
FileStandardInformation = 0x05, // Uses: Query
FileInternalInformation = 0x06, // Uses: Query
FileEaInformation = 0x07, // Uses: Query
+ FileAccessInformation = 0x08, // Uses: Query
+ FileNameInformation = 0x09, // Uses: LOCAL
FileRenameInformation = 0x0A, // Uses: Set
FileLinkInformation = 0x0B, // Uses: Set
FileNamesInformation = 0x0C, // Uses: Query
diff --git a/SMBLibrary/SMBLibrary.csproj b/SMBLibrary/SMBLibrary.csproj
index 4b3b0a4..16c2865 100644
--- a/SMBLibrary/SMBLibrary.csproj
+++ b/SMBLibrary/SMBLibrary.csproj
@@ -489,11 +489,18 @@
+
+
+
+
+
+
+
diff --git a/SMBLibrary/Structures/FileInformation/FileInformation.cs b/SMBLibrary/Structures/FileInformation/FileInformation.cs
index a0488f4..b841527 100644
--- a/SMBLibrary/Structures/FileInformation/FileInformation.cs
+++ b/SMBLibrary/Structures/FileInformation/FileInformation.cs
@@ -43,6 +43,8 @@ namespace SMBLibrary
return new FileInternalInformation(buffer, offset);
case FileInformationClass.FileEaInformation:
return new FileEaInformation(buffer, offset);
+ case FileInformationClass.FileAccessInformation:
+ return new FileAccessInformation(buffer, offset);
case FileInformationClass.FileRenameInformation:
return new FileRenameInformationType2(buffer, offset);
case FileInformationClass.FileLinkInformation:
@@ -52,23 +54,23 @@ namespace SMBLibrary
case FileInformationClass.FileDispositionInformation:
return new FileDispositionInformation(buffer, offset);
case FileInformationClass.FilePositionInformation:
- throw new NotImplementedException();
+ return new FilePositionInformation(buffer, offset);
case FileInformationClass.FileFullEaInformation:
return new FileFullEAInformation(buffer, offset);
case FileInformationClass.FileModeInformation:
return new FileModeInformation(buffer, offset);
case FileInformationClass.FileAlignmentInformation:
- throw new NotImplementedException();
+ return new FileAlignmentInformation(buffer, offset);
case FileInformationClass.FileAllInformation:
- throw new NotImplementedException();
+ return new FileAllInformation(buffer, offset);
case FileInformationClass.FileAllocationInformation:
return new FileAllocationInformation(buffer, offset);
case FileInformationClass.FileEndOfFileInformation:
return new FileEndOfFileInformation(buffer, offset);
case FileInformationClass.FileAlternateNameInformation:
- throw new NotImplementedException();
+ return new FileAlternateNameInformation(buffer, offset);
case FileInformationClass.FileStreamInformation:
- throw new NotImplementedException();
+ return new FileStreamInformation(buffer, offset);
case FileInformationClass.FilePipeInformation:
throw new NotImplementedException();
case FileInformationClass.FilePipeLocalInformation:
@@ -76,7 +78,7 @@ namespace SMBLibrary
case FileInformationClass.FilePipeRemoteInformation:
throw new NotImplementedException();
case FileInformationClass.FileCompressionInformation:
- throw new NotImplementedException();
+ return new FileCompressionInformation(buffer, offset);
case FileInformationClass.FileNetworkOpenInformation:
return new FileNetworkOpenInformation(buffer, offset);
case FileInformationClass.FileAttributeTagInformation:
diff --git a/SMBLibrary/Structures/FileInformation/Query/FileAccessInformation.cs b/SMBLibrary/Structures/FileInformation/Query/FileAccessInformation.cs
new file mode 100644
index 0000000..5f1095e
--- /dev/null
+++ b/SMBLibrary/Structures/FileInformation/Query/FileAccessInformation.cs
@@ -0,0 +1,52 @@
+/* Copyright (C) 2017 Tal Aloni . 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
+{
+ ///
+ /// [MS-FSCC] 2.4.1 - FileAccessInformation
+ ///
+ public class FileAccessInformation : FileInformation
+ {
+ public const int FixedLength = 4;
+
+ public AccessMask AccessFlags;
+
+ public FileAccessInformation()
+ {
+ }
+
+ public FileAccessInformation(byte[] buffer, int offset)
+ {
+ AccessFlags = (AccessMask)LittleEndianConverter.ToUInt32(buffer, offset + 0);
+ }
+
+ public override void WriteBytes(byte[] buffer, int offset)
+ {
+ LittleEndianWriter.WriteUInt32(buffer, offset + 0, (uint)AccessFlags);
+ }
+
+ public override FileInformationClass FileInformationClass
+ {
+ get
+ {
+ return FileInformationClass.FileAccessInformation;
+ }
+ }
+
+ public override int Length
+ {
+ get
+ {
+ return FixedLength;
+ }
+ }
+ }
+}
diff --git a/SMBLibrary/Structures/FileInformation/Query/FileAlignmentInformation.cs b/SMBLibrary/Structures/FileInformation/Query/FileAlignmentInformation.cs
new file mode 100644
index 0000000..4fd7ef9
--- /dev/null
+++ b/SMBLibrary/Structures/FileInformation/Query/FileAlignmentInformation.cs
@@ -0,0 +1,52 @@
+/* Copyright (C) 2017 Tal Aloni . 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
+{
+ ///
+ /// [MS-FSCC] 2.4.3 - FileAlignmentInformation
+ ///
+ public class FileAlignmentInformation : FileInformation
+ {
+ public const int FixedLength = 4;
+
+ public uint AlignmentRequirement;
+
+ public FileAlignmentInformation()
+ {
+ }
+
+ public FileAlignmentInformation(byte[] buffer, int offset)
+ {
+ AlignmentRequirement = LittleEndianConverter.ToUInt32(buffer, offset + 0);
+ }
+
+ public override void WriteBytes(byte[] buffer, int offset)
+ {
+ LittleEndianWriter.WriteUInt32(buffer, offset + 0, AlignmentRequirement);
+ }
+
+ public override FileInformationClass FileInformationClass
+ {
+ get
+ {
+ return FileInformationClass.FileAlignmentInformation;
+ }
+ }
+
+ public override int Length
+ {
+ get
+ {
+ return FixedLength;
+ }
+ }
+ }
+}
diff --git a/SMBLibrary/Structures/FileInformation/Query/FileAllInformation.cs b/SMBLibrary/Structures/FileInformation/Query/FileAllInformation.cs
new file mode 100644
index 0000000..50b336d
--- /dev/null
+++ b/SMBLibrary/Structures/FileInformation/Query/FileAllInformation.cs
@@ -0,0 +1,74 @@
+/* Copyright (C) 2017 Tal Aloni . 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
+{
+ ///
+ /// [MS-FSCC] 2.4.2 - FileAllInformation
+ ///
+ public class FileAllInformation : FileInformation
+ {
+ public FileBasicInformation BasicInformation;
+ public FileStandardInformation StandardInformation;
+ public FileInternalInformation InternalInformation;
+ public FileEaInformation EaInformation;
+ public FileAccessInformation AccessInformation;
+ public FilePositionInformation PositionInformation;
+ public FileModeInformation ModeInformation;
+ public FileAlignmentInformation AlignmentInformation;
+ public FileNameInformation NameInformation;
+
+ public FileAllInformation()
+ {
+ }
+
+ public FileAllInformation(byte[] buffer, int offset)
+ {
+ BasicInformation = new FileBasicInformation(buffer, offset + 0);
+ StandardInformation = new FileStandardInformation(buffer, offset + 40);
+ InternalInformation = new FileInternalInformation(buffer, offset + 64);
+ EaInformation = new FileEaInformation(buffer, offset + 72);
+ AccessInformation = new FileAccessInformation(buffer, offset + 76);
+ PositionInformation = new FilePositionInformation(buffer, offset + 80);
+ ModeInformation = new FileModeInformation(buffer, offset + 88);
+ AlignmentInformation = new FileAlignmentInformation(buffer, offset + 92);
+ NameInformation = new FileNameInformation(buffer, offset + 96);
+ }
+
+ public override void WriteBytes(byte[] buffer, int offset)
+ {
+ BasicInformation.WriteBytes(buffer, offset + 0);
+ StandardInformation.WriteBytes(buffer, offset + 40);
+ InternalInformation.WriteBytes(buffer, offset + 64);
+ EaInformation.WriteBytes(buffer, offset + 72);
+ AccessInformation.WriteBytes(buffer, offset + 76);
+ PositionInformation.WriteBytes(buffer, offset + 80);
+ ModeInformation.WriteBytes(buffer, offset + 88);
+ AlignmentInformation.WriteBytes(buffer, offset + 92);
+ NameInformation.WriteBytes(buffer, offset + 96);
+ }
+
+ public override FileInformationClass FileInformationClass
+ {
+ get
+ {
+ return FileInformationClass.FileAllInformation;
+ }
+ }
+
+ public override int Length
+ {
+ get
+ {
+ return 96 + NameInformation.Length;
+ }
+ }
+ }
+}
diff --git a/SMBLibrary/Structures/FileInformation/Query/FileAlternateNameInformation.cs b/SMBLibrary/Structures/FileInformation/Query/FileAlternateNameInformation.cs
new file mode 100644
index 0000000..1007c2c
--- /dev/null
+++ b/SMBLibrary/Structures/FileInformation/Query/FileAlternateNameInformation.cs
@@ -0,0 +1,34 @@
+/* Copyright (C) 2017 Tal Aloni . 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
+{
+ ///
+ /// [MS-FSCC] 2.4.5 - FileAlternateNameInformation
+ ///
+ public class FileAlternateNameInformation : FileNameInformation
+ {
+ public FileAlternateNameInformation() : base()
+ {
+ }
+
+ public FileAlternateNameInformation(byte[] buffer, int offset) : base(buffer, offset)
+ {
+ }
+
+ public override FileInformationClass FileInformationClass
+ {
+ get
+ {
+ return FileInformationClass.FileAlternateNameInformation;
+ }
+ }
+ }
+}
diff --git a/SMBLibrary/Structures/FileInformation/Query/FileCompressionInformation.cs b/SMBLibrary/Structures/FileInformation/Query/FileCompressionInformation.cs
new file mode 100644
index 0000000..d64ec5c
--- /dev/null
+++ b/SMBLibrary/Structures/FileInformation/Query/FileCompressionInformation.cs
@@ -0,0 +1,67 @@
+/* Copyright (C) 2017 Tal Aloni . 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
+{
+ ///
+ /// [MS-FSCC] 2.4.9 - FileCompressionInformation
+ ///
+ public class FileCompressionInformation : FileInformation
+ {
+ public const int FixedLength = 16;
+
+ public ulong CompressedFileSize;
+ public CompressionFormat CompressionFormat;
+ public byte CompressionUnitShift;
+ public byte ChunkShift;
+ public byte ClusterShift;
+ public byte[] Reserved; // 3 bytes
+
+ public FileCompressionInformation()
+ {
+ }
+
+ public FileCompressionInformation(byte[] buffer, int offset)
+ {
+ CompressedFileSize = LittleEndianConverter.ToUInt64(buffer, offset + 0);
+ CompressionFormat = (CompressionFormat)LittleEndianConverter.ToUInt16(buffer, offset + 8);
+ CompressionUnitShift = ByteReader.ReadByte(buffer, offset + 10);
+ ChunkShift = ByteReader.ReadByte(buffer, offset + 11);
+ ClusterShift = ByteReader.ReadByte(buffer, offset + 12);
+ Reserved = ByteReader.ReadBytes(buffer, offset + 13, 3);
+ }
+
+ public override void WriteBytes(byte[] buffer, int offset)
+ {
+ LittleEndianWriter.WriteUInt64(buffer, offset + 0, CompressedFileSize);
+ LittleEndianWriter.WriteUInt16(buffer, offset + 8, (ushort)CompressionFormat);
+ ByteWriter.WriteByte(buffer, offset + 10, CompressionUnitShift);
+ ByteWriter.WriteByte(buffer, offset + 11, ChunkShift);
+ ByteWriter.WriteByte(buffer, offset + 12, ClusterShift);
+ ByteWriter.WriteBytes(buffer, offset + 13, Reserved, 3);
+ }
+
+ public override FileInformationClass FileInformationClass
+ {
+ get
+ {
+ return FileInformationClass.FileCompressionInformation;
+ }
+ }
+
+ public override int Length
+ {
+ get
+ {
+ return FixedLength;
+ }
+ }
+ }
+}
diff --git a/SMBLibrary/Structures/FileInformation/Query/FileNameInformation.cs b/SMBLibrary/Structures/FileInformation/Query/FileNameInformation.cs
new file mode 100644
index 0000000..ee0db00
--- /dev/null
+++ b/SMBLibrary/Structures/FileInformation/Query/FileNameInformation.cs
@@ -0,0 +1,57 @@
+/* Copyright (C) 2017 Tal Aloni . 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
+{
+ ///
+ /// [MS-FSCC] 2.1.7 - FILE_NAME_INFORMATION
+ /// [MS-FSCC] 2.4.25 - FileNameInformation
+ ///
+ public class FileNameInformation : FileInformation
+ {
+ public const int FixedLength = 4;
+
+ private uint FileNameLength;
+ public string FileName = String.Empty;
+
+ public FileNameInformation()
+ {
+ }
+
+ public FileNameInformation(byte[] buffer, int offset)
+ {
+ FileNameLength = LittleEndianConverter.ToUInt32(buffer, offset + 0);
+ FileName = ByteReader.ReadUTF16String(buffer, offset + 4, (int)FileNameLength / 2);
+ }
+
+ public override void WriteBytes(byte[] buffer, int offset)
+ {
+ FileNameLength = (uint)(FileName.Length * 2);
+ LittleEndianWriter.WriteUInt32(buffer, offset + 0, FileNameLength);
+ ByteWriter.WriteUTF16String(buffer, offset + 4, FileName);
+ }
+
+ public override FileInformationClass FileInformationClass
+ {
+ get
+ {
+ return FileInformationClass.FileNameInformation;
+ }
+ }
+
+ public override int Length
+ {
+ get
+ {
+ return FixedLength + FileName.Length * 2;
+ }
+ }
+ }
+}
diff --git a/SMBLibrary/Structures/FileInformation/Query/FilePositionInformation.cs b/SMBLibrary/Structures/FileInformation/Query/FilePositionInformation.cs
new file mode 100644
index 0000000..e36ab41
--- /dev/null
+++ b/SMBLibrary/Structures/FileInformation/Query/FilePositionInformation.cs
@@ -0,0 +1,52 @@
+/* Copyright (C) 2017 Tal Aloni . 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
+{
+ ///
+ /// [MS-FSCC] 2.4.32 - FilePositionInformation
+ ///
+ public class FilePositionInformation : FileInformation
+ {
+ public const int FixedLength = 8;
+
+ public long CurrentByteOffset;
+
+ public FilePositionInformation()
+ {
+ }
+
+ public FilePositionInformation(byte[] buffer, int offset)
+ {
+ CurrentByteOffset = LittleEndianConverter.ToInt64(buffer, offset + 0);
+ }
+
+ public override void WriteBytes(byte[] buffer, int offset)
+ {
+ LittleEndianWriter.WriteInt64(buffer, offset + 0, CurrentByteOffset);
+ }
+
+ public override FileInformationClass FileInformationClass
+ {
+ get
+ {
+ return FileInformationClass.FilePositionInformation;
+ }
+ }
+
+ public override int Length
+ {
+ get
+ {
+ return FixedLength;
+ }
+ }
+ }
+}