From b45cffe0997fdf19f83ec88a962690bc27b6c512 Mon Sep 17 00:00:00 2001 From: Tal Aloni Date: Tue, 10 Jan 2017 11:24:51 +0200 Subject: [PATCH] Renamed FileAttributes to SMBFileAttributes --- SMBLibrary/SMB1/Commands/DeleteRequest.cs | 4 ++-- SMBLibrary/SMB1/Commands/OpenAndXRequest.cs | 8 ++++---- SMBLibrary/SMB1/Commands/OpenAndXResponse.cs | 2 +- SMBLibrary/SMB1/Commands/OpenAndXResponseExtended.cs | 2 +- SMBLibrary/SMB1/Commands/QueryInformationResponse.cs | 4 ++-- SMBLibrary/SMB1/Commands/RenameRequest.cs | 4 ++-- SMBLibrary/SMB1/Commands/SetInformationRequest.cs | 4 ++-- .../{FileAttributes.cs => SMBFileAttributes.cs} | 2 +- .../FindInformation/FindInfoQueryEASize.cs | 4 ++-- .../FindInfoQueryExtendedAttributesFromList.cs | 4 ++-- .../Structures/FindInformation/FindInfoStandard.cs | 4 ++-- .../Structures/QueryInformation/QueryEASize.cs | 4 ++-- .../Structures/QueryInformation/QueryInfoStandard.cs | 4 ++-- .../Transaction2FindFirst2Request.cs | 4 ++-- .../Transaction2Open2Request.cs | 4 ++-- .../Transaction2Open2Response.cs | 4 ++-- SMBLibrary/SMBLibrary.csproj | 2 +- .../ResponseHelpers/FileSystemResponseHelper.cs | 10 +++++----- SMBLibrary/Server/ResponseHelpers/InfoHelper.cs | 12 ++++++------ SMBLibrary/Server/ResponseHelpers/OpenAndXHelper.cs | 10 +++++----- 20 files changed, 48 insertions(+), 48 deletions(-) rename SMBLibrary/SMB1/Enums/{FileAttributes.cs => SMBFileAttributes.cs} (92%) diff --git a/SMBLibrary/SMB1/Commands/DeleteRequest.cs b/SMBLibrary/SMB1/Commands/DeleteRequest.cs index a3eb7b4..108cc88 100644 --- a/SMBLibrary/SMB1/Commands/DeleteRequest.cs +++ b/SMBLibrary/SMB1/Commands/DeleteRequest.cs @@ -19,7 +19,7 @@ namespace SMBLibrary.SMB1 public const int SupportedBufferFormat = 0x04; public const int ParametersLength = 2; // Parameters; - public FileAttributes SearchAttributes; + public SMBFileAttributes SearchAttributes; // Data: public byte BufferFormat; public string FileName; // SMB_STRING @@ -31,7 +31,7 @@ namespace SMBLibrary.SMB1 public DeleteRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) { - SearchAttributes = (FileAttributes)LittleEndianConverter.ToUInt16(this.SMBParameters, 0); + SearchAttributes = (SMBFileAttributes)LittleEndianConverter.ToUInt16(this.SMBParameters, 0); BufferFormat = ByteReader.ReadByte(this.SMBData, 0); if (BufferFormat != SupportedBufferFormat) diff --git a/SMBLibrary/SMB1/Commands/OpenAndXRequest.cs b/SMBLibrary/SMB1/Commands/OpenAndXRequest.cs index 3599584..a683380 100644 --- a/SMBLibrary/SMB1/Commands/OpenAndXRequest.cs +++ b/SMBLibrary/SMB1/Commands/OpenAndXRequest.cs @@ -23,8 +23,8 @@ namespace SMBLibrary.SMB1 //ushort AndXOffset; public OpenFlags Flags; public AccessModeOptions AccessMode; - public FileAttributes SearchAttrs; - public FileAttributes FileAttrs; + public SMBFileAttributes SearchAttrs; + public SMBFileAttributes FileAttrs; public DateTime CreationTime; // UTime public OpenMode OpenMode; public uint AllocationSize; @@ -42,8 +42,8 @@ namespace SMBLibrary.SMB1 int parametersOffset = 4; Flags = (OpenFlags)LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset); AccessMode = AccessModeOptions.Read(this.SMBParameters, ref parametersOffset); - SearchAttrs = (FileAttributes)LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset); - FileAttrs = (FileAttributes)LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset); + SearchAttrs = (SMBFileAttributes)LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset); + FileAttrs = (SMBFileAttributes)LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset); CreationTime = SMB1Helper.ReadUTime(this.SMBParameters, ref parametersOffset); OpenMode = OpenMode.Read(this.SMBParameters, ref parametersOffset); AllocationSize = LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset); diff --git a/SMBLibrary/SMB1/Commands/OpenAndXResponse.cs b/SMBLibrary/SMB1/Commands/OpenAndXResponse.cs index 64883a4..4222a38 100644 --- a/SMBLibrary/SMB1/Commands/OpenAndXResponse.cs +++ b/SMBLibrary/SMB1/Commands/OpenAndXResponse.cs @@ -22,7 +22,7 @@ namespace SMBLibrary.SMB1 //byte AndXReserved; //ushort AndXOffset; public ushort FID; - public FileAttributes FileAttrs; + public SMBFileAttributes FileAttrs; public DateTime LastWriteTime; // UTime public uint FileDataSize; public AccessRights AccessRights; diff --git a/SMBLibrary/SMB1/Commands/OpenAndXResponseExtended.cs b/SMBLibrary/SMB1/Commands/OpenAndXResponseExtended.cs index 35e4a72..6a4baa0 100644 --- a/SMBLibrary/SMB1/Commands/OpenAndXResponseExtended.cs +++ b/SMBLibrary/SMB1/Commands/OpenAndXResponseExtended.cs @@ -22,7 +22,7 @@ namespace SMBLibrary.SMB1 //byte AndXReserved; //ushort AndXOffset; public ushort FID; - public FileAttributes FileAttrs; + public SMBFileAttributes FileAttrs; public DateTime LastWriteTime; // UTime public uint FileDataSize; public AccessRights AccessRights; diff --git a/SMBLibrary/SMB1/Commands/QueryInformationResponse.cs b/SMBLibrary/SMB1/Commands/QueryInformationResponse.cs index d26c469..e368d87 100644 --- a/SMBLibrary/SMB1/Commands/QueryInformationResponse.cs +++ b/SMBLibrary/SMB1/Commands/QueryInformationResponse.cs @@ -20,7 +20,7 @@ namespace SMBLibrary.SMB1 { public const int ParameterLength = 20; // Parameters: - public FileAttributes FileAttributes; + public SMBFileAttributes FileAttributes; public DateTime LastWriteTime; public uint FileSize; public byte[] Reserved; // 10 bytes @@ -32,7 +32,7 @@ namespace SMBLibrary.SMB1 public QueryInformationResponse(byte[] buffer, int offset) : base(buffer, offset, false) { - FileAttributes = (FileAttributes)LittleEndianConverter.ToUInt16(this.SMBParameters, 0); + FileAttributes = (SMBFileAttributes)LittleEndianConverter.ToUInt16(this.SMBParameters, 0); LastWriteTime = SMB1Helper.ReadSMBDateTime(this.SMBParameters, 2); FileSize = LittleEndianConverter.ToUInt32(this.SMBParameters, 6); Reserved = ByteReader.ReadBytes(this.SMBParameters, 10, 10); diff --git a/SMBLibrary/SMB1/Commands/RenameRequest.cs b/SMBLibrary/SMB1/Commands/RenameRequest.cs index d830214..b642963 100644 --- a/SMBLibrary/SMB1/Commands/RenameRequest.cs +++ b/SMBLibrary/SMB1/Commands/RenameRequest.cs @@ -19,7 +19,7 @@ namespace SMBLibrary.SMB1 public const int SupportedBufferFormat = 0x04; public const int ParametersLength = 2; // Parameters: - public FileAttributes SearchAttributes; + public SMBFileAttributes SearchAttributes; // Data: public byte BufferFormat1; public string OldFileName; // SMB_STRING (this field WILL be aligned to start on a 2-byte boundary from the start of the SMB header) @@ -34,7 +34,7 @@ namespace SMBLibrary.SMB1 public RenameRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) { - SearchAttributes = (FileAttributes)LittleEndianConverter.ToUInt16(this.SMBParameters, 0); + SearchAttributes = (SMBFileAttributes)LittleEndianConverter.ToUInt16(this.SMBParameters, 0); int dataOffset = 0; BufferFormat1 = ByteReader.ReadByte(this.SMBData, ref dataOffset); diff --git a/SMBLibrary/SMB1/Commands/SetInformationRequest.cs b/SMBLibrary/SMB1/Commands/SetInformationRequest.cs index 02742a3..0094bee 100644 --- a/SMBLibrary/SMB1/Commands/SetInformationRequest.cs +++ b/SMBLibrary/SMB1/Commands/SetInformationRequest.cs @@ -19,7 +19,7 @@ namespace SMBLibrary.SMB1 public const int ParametersLength = 16; public const int SupportedBufferFormat = 0x04; // Parameters: - public FileAttributes FileAttributes; + public SMBFileAttributes FileAttributes; public DateTime LastWriteTime; public byte[] Reserved; // 10 bytes // Data: @@ -34,7 +34,7 @@ namespace SMBLibrary.SMB1 public SetInformationRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) { - FileAttributes = (FileAttributes)LittleEndianConverter.ToUInt16(this.SMBParameters, 0); + FileAttributes = (SMBFileAttributes)LittleEndianConverter.ToUInt16(this.SMBParameters, 0); LastWriteTime = SMB1Helper.ReadUTime(this.SMBParameters, 2); Reserved = ByteReader.ReadBytes(this.SMBParameters, 6, 10); diff --git a/SMBLibrary/SMB1/Enums/FileAttributes.cs b/SMBLibrary/SMB1/Enums/SMBFileAttributes.cs similarity index 92% rename from SMBLibrary/SMB1/Enums/FileAttributes.cs rename to SMBLibrary/SMB1/Enums/SMBFileAttributes.cs index ddc3a49..436c83a 100644 --- a/SMBLibrary/SMB1/Enums/FileAttributes.cs +++ b/SMBLibrary/SMB1/Enums/SMBFileAttributes.cs @@ -6,7 +6,7 @@ namespace SMBLibrary.SMB1 /// SMB_FILE_ATTRIBUTES /// [Flags] - public enum FileAttributes : ushort + public enum SMBFileAttributes : ushort { Normal = 0x0000, // SMB_FILE_ATTRIBUTE_NORMAL ReadOnly = 0x0001, // SMB_FILE_ATTRIBUTE_READONLY diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryEASize.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryEASize.cs index 4ead1cf..ae1ae7a 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryEASize.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryEASize.cs @@ -22,7 +22,7 @@ namespace SMBLibrary.SMB1 public DateTime LastWriteDateTime; public uint FileDataSize; public uint AllocationSize; - public FileAttributes Attributes; + public SMBFileAttributes Attributes; public uint EASize; //byte FileNameLength; // In bytes, MUST exclude the null termination. public string FileName; // OEM / Unicode character array. MUST be written as SMB_STRING, and read as fixed length string. @@ -42,7 +42,7 @@ namespace SMBLibrary.SMB1 LastWriteDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); FileDataSize = LittleEndianReader.ReadUInt32(buffer, ref offset); AllocationSize = LittleEndianReader.ReadUInt32(buffer, ref offset); - Attributes = (FileAttributes)LittleEndianReader.ReadUInt16(buffer, ref offset); + Attributes = (SMBFileAttributes)LittleEndianReader.ReadUInt16(buffer, ref offset); EASize = LittleEndianReader.ReadUInt32(buffer, ref offset); byte fileNameLength = ByteReader.ReadByte(buffer, ref offset); FileName = SMB1Helper.ReadFixedLengthString(buffer, ref offset, isUnicode, fileNameLength); diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryExtendedAttributesFromList.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryExtendedAttributesFromList.cs index fd63330..e8981a8 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryExtendedAttributesFromList.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryExtendedAttributesFromList.cs @@ -22,7 +22,7 @@ namespace SMBLibrary.SMB1 public DateTime LastWriteDateTime; public uint FileDataSize; public uint AllocationSize; - public FileAttributes Attributes; + public SMBFileAttributes Attributes; public FullExtendedAttributeList ExtendedAttributeList; //byte FileNameLength; // In bytes, MUST exclude the null termination. public string FileName; // OEM / Unicode character array. MUST be written as SMB_STRING, and read as fixed length string. @@ -42,7 +42,7 @@ namespace SMBLibrary.SMB1 LastWriteDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); FileDataSize = LittleEndianReader.ReadUInt32(buffer, ref offset); AllocationSize = LittleEndianReader.ReadUInt32(buffer, ref offset); - Attributes = (FileAttributes)LittleEndianReader.ReadUInt16(buffer, ref offset); + Attributes = (SMBFileAttributes)LittleEndianReader.ReadUInt16(buffer, ref offset); ExtendedAttributeList = new FullExtendedAttributeList(buffer, offset); byte fileNameLength = ByteReader.ReadByte(buffer, ref offset); FileName = SMB1Helper.ReadFixedLengthString(buffer, ref offset, isUnicode, fileNameLength); diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoStandard.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoStandard.cs index 933acad..5580497 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoStandard.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoStandard.cs @@ -24,7 +24,7 @@ namespace SMBLibrary.SMB1 public DateTime LastWriteDateTime; public uint FileDataSize; public uint AllocationSize; - public FileAttributes Attributes; + public SMBFileAttributes Attributes; //byte FileNameLength; public string FileName; // SMB_STRING @@ -43,7 +43,7 @@ namespace SMBLibrary.SMB1 LastWriteDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); FileDataSize = LittleEndianReader.ReadUInt32(buffer, ref offset); AllocationSize = LittleEndianReader.ReadUInt32(buffer, ref offset); - Attributes = (FileAttributes)LittleEndianReader.ReadUInt16(buffer, ref offset); + Attributes = (SMBFileAttributes)LittleEndianReader.ReadUInt16(buffer, ref offset); byte fileNameLength = ByteReader.ReadByte(buffer, ref offset); FileName = SMB1Helper.ReadSMBString(buffer, ref offset, isUnicode); } diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryEASize.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryEASize.cs index 62d1ed7..0184e0c 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryEASize.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryEASize.cs @@ -23,7 +23,7 @@ namespace SMBLibrary.SMB1 public DateTime LastWriteDateTime; public uint FileDataSize; public uint AllocationSize; - public FileAttributes Attributes; + public SMBFileAttributes Attributes; public uint EASize; public QueryEASize() @@ -37,7 +37,7 @@ namespace SMBLibrary.SMB1 LastWriteDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); FileDataSize = LittleEndianReader.ReadUInt32(buffer, ref offset); AllocationSize = LittleEndianReader.ReadUInt32(buffer, ref offset); - Attributes = (FileAttributes)LittleEndianReader.ReadUInt16(buffer, ref offset); + Attributes = (SMBFileAttributes)LittleEndianReader.ReadUInt16(buffer, ref offset); EASize = LittleEndianReader.ReadUInt32(buffer, ref offset); } diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryInfoStandard.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryInfoStandard.cs index cf780bc..b6e9c9b 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryInfoStandard.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryInfoStandard.cs @@ -23,7 +23,7 @@ namespace SMBLibrary.SMB1 public DateTime LastWriteDateTime; public uint FileDataSize; public uint AllocationSize; - public FileAttributes Attributes; + public SMBFileAttributes Attributes; public QueryInfoStandard() { @@ -36,7 +36,7 @@ namespace SMBLibrary.SMB1 LastWriteDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); FileDataSize = LittleEndianReader.ReadUInt32(buffer, ref offset); AllocationSize = LittleEndianReader.ReadUInt32(buffer, ref offset); - Attributes = (FileAttributes)LittleEndianReader.ReadUInt16(buffer, ref offset); + Attributes = (SMBFileAttributes)LittleEndianReader.ReadUInt16(buffer, ref offset); } public override byte[] GetBytes() diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindFirst2Request.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindFirst2Request.cs index f6f5bc7..ac00d0a 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindFirst2Request.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindFirst2Request.cs @@ -17,7 +17,7 @@ namespace SMBLibrary.SMB1 public class Transaction2FindFirst2Request : Transaction2Subcommand { // Parameters: - public FileAttributes SearchAttributes; + public SMBFileAttributes SearchAttributes; public ushort SearchCount; public FindFlags Flags; public FindInformationLevel InformationLevel; @@ -33,7 +33,7 @@ namespace SMBLibrary.SMB1 public Transaction2FindFirst2Request(byte[] parameters, byte[] data, bool isUnicode) : base() { - SearchAttributes = (FileAttributes)LittleEndianConverter.ToUInt16(parameters, 0); + SearchAttributes = (SMBFileAttributes)LittleEndianConverter.ToUInt16(parameters, 0); SearchCount = LittleEndianConverter.ToUInt16(parameters, 2); Flags = (FindFlags)LittleEndianConverter.ToUInt16(parameters, 4); InformationLevel = (FindInformationLevel)LittleEndianConverter.ToUInt16(parameters, 6); diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Request.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Request.cs index bd70bb6..141a1ae 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Request.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Request.cs @@ -20,7 +20,7 @@ namespace SMBLibrary.SMB1 public Open2Flags Flags; public AccessModeOptions AccessMode; public ushort Reserved1; - public FileAttributes FileAttributes; + public SMBFileAttributes FileAttributes; public DateTime CreationTime; // UTIME (seconds since Jan 1, 1970) public OpenMode OpenMode; public uint AllocationSize; @@ -40,7 +40,7 @@ namespace SMBLibrary.SMB1 Flags = (Open2Flags)LittleEndianConverter.ToUInt16(parameters, 0); AccessMode = new AccessModeOptions(parameters, 2); Reserved1 = LittleEndianConverter.ToUInt16(parameters, 4); - FileAttributes = (FileAttributes)LittleEndianConverter.ToUInt16(parameters, 6); + FileAttributes = (SMBFileAttributes)LittleEndianConverter.ToUInt16(parameters, 6); CreationTime = SMB1Helper.ReadUTime(parameters, 8); OpenMode = new OpenMode(parameters, 12); AllocationSize = LittleEndianConverter.ToUInt32(parameters, 14); diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Response.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Response.cs index 3033d12..fa71302 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Response.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Response.cs @@ -19,7 +19,7 @@ namespace SMBLibrary.SMB1 public int ParametersLength = 30; // Parameters public ushort FID; - public FileAttributes FileAttributes; + public SMBFileAttributes FileAttributes; public DateTime CreationTime; public uint FileDataSize; public AccessModeOptions AccessMode; @@ -38,7 +38,7 @@ namespace SMBLibrary.SMB1 public Transaction2Open2Response(byte[] parameters, byte[] data, bool isUnicode) : base() { FID = LittleEndianConverter.ToUInt16(parameters, 0); - FileAttributes = (FileAttributes)LittleEndianConverter.ToUInt16(parameters, 2); + FileAttributes = (SMBFileAttributes)LittleEndianConverter.ToUInt16(parameters, 2); CreationTime = SMB1Helper.ReadUTime(parameters, 4); FileDataSize = LittleEndianConverter.ToUInt32(parameters, 8); AccessMode = new AccessModeOptions(parameters, 12); diff --git a/SMBLibrary/SMBLibrary.csproj b/SMBLibrary/SMBLibrary.csproj index 01c900a..f652abb 100644 --- a/SMBLibrary/SMBLibrary.csproj +++ b/SMBLibrary/SMBLibrary.csproj @@ -239,7 +239,6 @@ - @@ -256,6 +255,7 @@ + diff --git a/SMBLibrary/Server/ResponseHelpers/FileSystemResponseHelper.cs b/SMBLibrary/Server/ResponseHelpers/FileSystemResponseHelper.cs index 27e9437..bcd019e 100644 --- a/SMBLibrary/Server/ResponseHelpers/FileSystemResponseHelper.cs +++ b/SMBLibrary/Server/ResponseHelpers/FileSystemResponseHelper.cs @@ -117,8 +117,8 @@ namespace SMBLibrary.Server return new ErrorResponse(CommandName.SMB_COM_DELETE); } - if (!entry.IsDirectory && (request.SearchAttributes & SMBLibrary.SMB1.FileAttributes.Directory) > 0 - || entry.IsDirectory && (request.SearchAttributes & SMBLibrary.SMB1.FileAttributes.Directory) == 0) + if (!entry.IsDirectory && (request.SearchAttributes & SMBFileAttributes.Directory) > 0 + || entry.IsDirectory && (request.SearchAttributes & SMBFileAttributes.Directory) == 0) { header.Status = NTStatus.STATUS_OBJECT_PATH_INVALID; return new ErrorResponse(CommandName.SMB_COM_DELETE); @@ -227,15 +227,15 @@ namespace SMBLibrary.Server bool? isHidden = null; bool? isReadOnly = null; bool? isArchived = null; - if ((request.FileAttributes & SMBLibrary.SMB1.FileAttributes.Hidden) > 0) + if ((request.FileAttributes & SMBFileAttributes.Hidden) > 0) { isHidden = true; } - if ((request.FileAttributes & SMBLibrary.SMB1.FileAttributes.ReadOnly) > 0) + if ((request.FileAttributes & SMBFileAttributes.ReadOnly) > 0) { isReadOnly = true; } - if ((request.FileAttributes & SMBLibrary.SMB1.FileAttributes.Archive) > 0) + if ((request.FileAttributes & SMBFileAttributes.Archive) > 0) { isArchived = true; } diff --git a/SMBLibrary/Server/ResponseHelpers/InfoHelper.cs b/SMBLibrary/Server/ResponseHelpers/InfoHelper.cs index c9ca290..b45692d 100644 --- a/SMBLibrary/Server/ResponseHelpers/InfoHelper.cs +++ b/SMBLibrary/Server/ResponseHelpers/InfoHelper.cs @@ -313,24 +313,24 @@ namespace SMBLibrary.Server } - public static FileAttributes GetFileAttributes(FileSystemEntry entry) + public static SMBFileAttributes GetFileAttributes(FileSystemEntry entry) { - FileAttributes attributes = FileAttributes.Normal; + SMBFileAttributes attributes = SMBFileAttributes.Normal; if (entry.IsHidden) { - attributes |= FileAttributes.Hidden; + attributes |= SMBFileAttributes.Hidden; } if (entry.IsReadonly) { - attributes |= FileAttributes.ReadOnly; + attributes |= SMBFileAttributes.ReadOnly; } if (entry.IsArchived) { - attributes |= FileAttributes.Archive; + attributes |= SMBFileAttributes.Archive; } if (entry.IsDirectory) { - attributes |= FileAttributes.Directory; + attributes |= SMBFileAttributes.Directory; } return attributes; diff --git a/SMBLibrary/Server/ResponseHelpers/OpenAndXHelper.cs b/SMBLibrary/Server/ResponseHelpers/OpenAndXHelper.cs index e7805fe..291e7d3 100644 --- a/SMBLibrary/Server/ResponseHelpers/OpenAndXHelper.cs +++ b/SMBLibrary/Server/ResponseHelpers/OpenAndXHelper.cs @@ -102,7 +102,7 @@ namespace SMBLibrary.Server return new ErrorResponse(CommandName.SMB_COM_OPEN_ANDX); } - if ((request.FileAttrs & SMB1.FileAttributes.Directory) > 0) + if ((request.FileAttrs & SMBFileAttributes.Directory) > 0) { System.Diagnostics.Debug.Print("[{0}] OpenAndX: Creating directory '{1}'", DateTime.Now.ToString("HH:mm:ss:ffff"), path); entry = fileSystem.CreateDirectory(path); @@ -205,11 +205,11 @@ namespace SMBLibrary.Server OpenAndXResponse response = new OpenAndXResponse(); if (entry.IsDirectory) { - response.FileAttrs = SMBLibrary.SMB1.FileAttributes.Directory; + response.FileAttrs = SMBFileAttributes.Directory; } else { - response.FileAttrs = SMBLibrary.SMB1.FileAttributes.Normal; + response.FileAttrs = SMBFileAttributes.Normal; } response.FID = fileID; response.LastWriteTime = entry.LastWriteTime; @@ -225,11 +225,11 @@ namespace SMBLibrary.Server OpenAndXResponseExtended response = new OpenAndXResponseExtended(); if (entry.IsDirectory) { - response.FileAttrs = SMBLibrary.SMB1.FileAttributes.Directory; + response.FileAttrs = SMBFileAttributes.Directory; } else { - response.FileAttrs = SMBLibrary.SMB1.FileAttributes.Normal; + response.FileAttrs = SMBFileAttributes.Normal; } response.FID = fileID; response.LastWriteTime = entry.LastWriteTime;