diff --git a/SMBLibrary/SMB1/Commands/CheckDirectoryRequest.cs b/SMBLibrary/SMB1/Commands/CheckDirectoryRequest.cs index 85d3e6d..00a2afc 100644 --- a/SMBLibrary/SMB1/Commands/CheckDirectoryRequest.cs +++ b/SMBLibrary/SMB1/Commands/CheckDirectoryRequest.cs @@ -34,7 +34,7 @@ namespace SMBLibrary.SMB1 { throw new InvalidRequestException("Unsupported Buffer Format"); } - DirectoryName = SMBHelper.ReadSMBString(this.SMBData, 1, isUnicode); + DirectoryName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode); } public override byte[] GetBytes(bool isUnicode) @@ -50,7 +50,7 @@ namespace SMBLibrary.SMB1 } this.SMBData = new byte[1 + length]; ByteWriter.WriteByte(this.SMBData, 0, BufferFormat); - SMBHelper.WriteSMBString(this.SMBData, 1, isUnicode, DirectoryName); + SMB1Helper.WriteSMBString(this.SMBData, 1, isUnicode, DirectoryName); return base.GetBytes(isUnicode); } diff --git a/SMBLibrary/SMB1/Commands/CloseRequest.cs b/SMBLibrary/SMB1/Commands/CloseRequest.cs index cb5d8aa..d0baddc 100644 --- a/SMBLibrary/SMB1/Commands/CloseRequest.cs +++ b/SMBLibrary/SMB1/Commands/CloseRequest.cs @@ -26,20 +26,20 @@ namespace SMBLibrary.SMB1 public CloseRequest() : base() { - LastTimeModified = SMBHelper.UTimeNotSpecified; + LastTimeModified = SMB1Helper.UTimeNotSpecified; } public CloseRequest(byte[] buffer, int offset) : base(buffer, offset, false) { FID = LittleEndianConverter.ToUInt16(this.SMBParameters, 0); - LastTimeModified = SMBHelper.ReadUTime(this.SMBParameters, 2); + LastTimeModified = SMB1Helper.ReadUTime(this.SMBParameters, 2); } public override byte[] GetBytes(bool isUnicode) { this.SMBParameters = new byte[ParametersLength]; LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, FID); - SMBHelper.WriteUTime(this.SMBParameters, 2, LastTimeModified); + SMB1Helper.WriteUTime(this.SMBParameters, 2, LastTimeModified); return base.GetBytes(isUnicode); } diff --git a/SMBLibrary/SMB1/Commands/CreateDirectoryRequest.cs b/SMBLibrary/SMB1/Commands/CreateDirectoryRequest.cs index 8737497..2573937 100644 --- a/SMBLibrary/SMB1/Commands/CreateDirectoryRequest.cs +++ b/SMBLibrary/SMB1/Commands/CreateDirectoryRequest.cs @@ -36,7 +36,7 @@ namespace SMBLibrary.SMB1 { throw new InvalidRequestException("Unsupported Buffer Format"); } - DirectoryName = SMBHelper.ReadSMBString(this.SMBData, 1, isUnicode); + DirectoryName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode); } public override byte[] GetBytes(bool isUnicode) @@ -52,7 +52,7 @@ namespace SMBLibrary.SMB1 } this.SMBData = new byte[1 + length]; ByteWriter.WriteByte(this.SMBData, 0, BufferFormat); - SMBHelper.WriteSMBString(this.SMBData, 1, isUnicode, DirectoryName); + SMB1Helper.WriteSMBString(this.SMBData, 1, isUnicode, DirectoryName); return base.GetBytes(isUnicode); } diff --git a/SMBLibrary/SMB1/Commands/DeleteDirectoryRequest.cs b/SMBLibrary/SMB1/Commands/DeleteDirectoryRequest.cs index dd9ebdb..cb824ba 100644 --- a/SMBLibrary/SMB1/Commands/DeleteDirectoryRequest.cs +++ b/SMBLibrary/SMB1/Commands/DeleteDirectoryRequest.cs @@ -33,7 +33,7 @@ namespace SMBLibrary.SMB1 { throw new InvalidRequestException("Unsupported Buffer Format"); } - DirectoryName = SMBHelper.ReadSMBString(this.SMBData, 1, isUnicode); + DirectoryName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode); } public override byte[] GetBytes(bool isUnicode) @@ -49,7 +49,7 @@ namespace SMBLibrary.SMB1 } this.SMBData = new byte[length]; ByteWriter.WriteByte(this.SMBData, 0, BufferFormat); - SMBHelper.WriteSMBString(this.SMBData, 1, isUnicode, DirectoryName); + SMB1Helper.WriteSMBString(this.SMBData, 1, isUnicode, DirectoryName); return base.GetBytes(isUnicode); } diff --git a/SMBLibrary/SMB1/Commands/DeleteRequest.cs b/SMBLibrary/SMB1/Commands/DeleteRequest.cs index 9979abb..a3eb7b4 100644 --- a/SMBLibrary/SMB1/Commands/DeleteRequest.cs +++ b/SMBLibrary/SMB1/Commands/DeleteRequest.cs @@ -38,7 +38,7 @@ namespace SMBLibrary.SMB1 { throw new InvalidRequestException("Unsupported Buffer Format"); } - FileName = SMBHelper.ReadSMBString(this.SMBData, 1, isUnicode); + FileName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode); } public override byte[] GetBytes(bool isUnicode) diff --git a/SMBLibrary/SMB1/Commands/NTCreateAndXRequest.cs b/SMBLibrary/SMB1/Commands/NTCreateAndXRequest.cs index 9b8f0de..6b803eb 100644 --- a/SMBLibrary/SMB1/Commands/NTCreateAndXRequest.cs +++ b/SMBLibrary/SMB1/Commands/NTCreateAndXRequest.cs @@ -60,7 +60,7 @@ namespace SMBLibrary.SMB1 { dataOffset = 1; // 1 byte padding for 2 byte alignment } - FileName = SMBHelper.ReadSMBString(this.SMBData, dataOffset, isUnicode); + FileName = SMB1Helper.ReadSMBString(this.SMBData, dataOffset, isUnicode); } public override byte[] GetBytes(bool isUnicode) diff --git a/SMBLibrary/SMB1/Commands/NTCreateAndXResponse.cs b/SMBLibrary/SMB1/Commands/NTCreateAndXResponse.cs index 61ece40..091f0ab 100644 --- a/SMBLibrary/SMB1/Commands/NTCreateAndXResponse.cs +++ b/SMBLibrary/SMB1/Commands/NTCreateAndXResponse.cs @@ -37,10 +37,10 @@ namespace SMBLibrary.SMB1 public NTCreateAndXResponse() : base() { - CreateTime = SMBHelper.FileTimeNotSpecified; - LastAccessTime = SMBHelper.FileTimeNotSpecified; - LastWriteTime = SMBHelper.FileTimeNotSpecified; - LastChangeTime = SMBHelper.FileTimeNotSpecified; + CreateTime = SMB1Helper.FileTimeNotSpecified; + LastAccessTime = SMB1Helper.FileTimeNotSpecified; + LastWriteTime = SMB1Helper.FileTimeNotSpecified; + LastChangeTime = SMB1Helper.FileTimeNotSpecified; } public NTCreateAndXResponse(byte[] buffer, int offset) : base(buffer, offset, false) @@ -49,10 +49,10 @@ namespace SMBLibrary.SMB1 OpLockLevel = (OpLockLevel)ByteReader.ReadByte(this.SMBParameters, ref parametersOffset); FID = LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset); CreateDisposition = (CreateDisposition)LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset); - CreateTime = SMBHelper.ReadFileTime(buffer, ref parametersOffset); - LastAccessTime = SMBHelper.ReadFileTime(buffer, ref parametersOffset); - LastWriteTime = SMBHelper.ReadFileTime(buffer, ref parametersOffset); - LastChangeTime = SMBHelper.ReadFileTime(buffer, ref parametersOffset); + CreateTime = SMB1Helper.ReadFileTime(buffer, ref parametersOffset); + LastAccessTime = SMB1Helper.ReadFileTime(buffer, ref parametersOffset); + LastWriteTime = SMB1Helper.ReadFileTime(buffer, ref parametersOffset); + LastChangeTime = SMB1Helper.ReadFileTime(buffer, ref parametersOffset); ExtFileAttributes = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset); AllocationSize = LittleEndianReader.ReadUInt64(buffer, ref parametersOffset); EndOfFile = LittleEndianReader.ReadUInt64(buffer, ref parametersOffset); @@ -68,10 +68,10 @@ namespace SMBLibrary.SMB1 ByteWriter.WriteByte(this.SMBParameters, ref parametersOffset, (byte)OpLockLevel); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, FID); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, (uint)CreateDisposition); - SMBHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, CreateTime); - SMBHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastAccessTime); - SMBHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastWriteTime); - SMBHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastChangeTime); + SMB1Helper.WriteFileTime(this.SMBParameters, ref parametersOffset, CreateTime); + SMB1Helper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastAccessTime); + SMB1Helper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastWriteTime); + SMB1Helper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastChangeTime); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, (uint)ExtFileAttributes); LittleEndianWriter.WriteUInt64(this.SMBParameters, ref parametersOffset, AllocationSize); LittleEndianWriter.WriteUInt64(this.SMBParameters, ref parametersOffset, EndOfFile); diff --git a/SMBLibrary/SMB1/Commands/NTCreateAndXResponseExtended.cs b/SMBLibrary/SMB1/Commands/NTCreateAndXResponseExtended.cs index 9bcfdf1..0d4a3a7 100644 --- a/SMBLibrary/SMB1/Commands/NTCreateAndXResponseExtended.cs +++ b/SMBLibrary/SMB1/Commands/NTCreateAndXResponseExtended.cs @@ -41,10 +41,10 @@ namespace SMBLibrary.SMB1 public NTCreateAndXResponseExtended() : base() { - CreateTime = SMBHelper.FileTimeNotSpecified; - LastAccessTime = SMBHelper.FileTimeNotSpecified; - LastWriteTime = SMBHelper.FileTimeNotSpecified; - LastChangeTime = SMBHelper.FileTimeNotSpecified; + CreateTime = SMB1Helper.FileTimeNotSpecified; + LastAccessTime = SMB1Helper.FileTimeNotSpecified; + LastWriteTime = SMB1Helper.FileTimeNotSpecified; + LastChangeTime = SMB1Helper.FileTimeNotSpecified; } public NTCreateAndXResponseExtended(byte[] buffer, int offset) : base(buffer, offset, false) @@ -53,10 +53,10 @@ namespace SMBLibrary.SMB1 OpLockLevel = (OpLockLevel)ByteReader.ReadByte(this.SMBParameters, ref parametersOffset); FID = LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset); CreateDisposition = (CreateDisposition)LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset); - CreateTime = SMBHelper.ReadFileTime(buffer, ref parametersOffset); - LastAccessTime = SMBHelper.ReadFileTime(buffer, ref parametersOffset); - LastWriteTime = SMBHelper.ReadFileTime(buffer, ref parametersOffset); - LastChangeTime = SMBHelper.ReadFileTime(buffer, ref parametersOffset); + CreateTime = SMB1Helper.ReadFileTime(buffer, ref parametersOffset); + LastAccessTime = SMB1Helper.ReadFileTime(buffer, ref parametersOffset); + LastWriteTime = SMB1Helper.ReadFileTime(buffer, ref parametersOffset); + LastChangeTime = SMB1Helper.ReadFileTime(buffer, ref parametersOffset); ExtFileAttributes = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset); AllocationSize = LittleEndianReader.ReadUInt64(buffer, ref parametersOffset); EndOfFile = LittleEndianReader.ReadUInt64(buffer, ref parametersOffset); @@ -76,10 +76,10 @@ namespace SMBLibrary.SMB1 ByteWriter.WriteByte(this.SMBParameters, ref parametersOffset, (byte)OpLockLevel); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, FID); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, (uint)CreateDisposition); - SMBHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, CreateTime); - SMBHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastAccessTime); - SMBHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastWriteTime); - SMBHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastChangeTime); + SMB1Helper.WriteFileTime(this.SMBParameters, ref parametersOffset, CreateTime); + SMB1Helper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastAccessTime); + SMB1Helper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastWriteTime); + SMB1Helper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastChangeTime); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, (uint)ExtFileAttributes); LittleEndianWriter.WriteUInt64(this.SMBParameters, ref parametersOffset, AllocationSize); LittleEndianWriter.WriteUInt64(this.SMBParameters, ref parametersOffset, EndOfFile); diff --git a/SMBLibrary/SMB1/Commands/NegotiateResponseNTLM.cs b/SMBLibrary/SMB1/Commands/NegotiateResponseNTLM.cs index fb75875..1a129fb 100644 --- a/SMBLibrary/SMB1/Commands/NegotiateResponseNTLM.cs +++ b/SMBLibrary/SMB1/Commands/NegotiateResponseNTLM.cs @@ -71,8 +71,8 @@ namespace SMBLibrary.SMB1 int offset = 0; ByteWriter.WriteBytes(this.SMBData, ref offset, Challenge); offset += padding; - SMBHelper.WriteSMBString(this.SMBData, ref offset, isUnicode, DomainName); - SMBHelper.WriteSMBString(this.SMBData, ref offset, isUnicode, ServerName); + SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, DomainName); + SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, ServerName); return base.GetBytes(isUnicode); } diff --git a/SMBLibrary/SMB1/Commands/OpenAndXRequest.cs b/SMBLibrary/SMB1/Commands/OpenAndXRequest.cs index a48bcd1..3599584 100644 --- a/SMBLibrary/SMB1/Commands/OpenAndXRequest.cs +++ b/SMBLibrary/SMB1/Commands/OpenAndXRequest.cs @@ -44,7 +44,7 @@ namespace SMBLibrary.SMB1 AccessMode = AccessModeOptions.Read(this.SMBParameters, ref parametersOffset); SearchAttrs = (FileAttributes)LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset); FileAttrs = (FileAttributes)LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset); - CreationTime = SMBHelper.ReadUTime(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); Timeout = LittleEndianReader.ReadUInt32(this.SMBParameters, ref parametersOffset); @@ -55,7 +55,7 @@ namespace SMBLibrary.SMB1 { dataOffset = 1; // 1 byte padding for 2 byte alignment } - FileName = SMBHelper.ReadSMBString(this.SMBData, dataOffset, isUnicode); + FileName = SMB1Helper.ReadSMBString(this.SMBData, dataOffset, isUnicode); } public override byte[] GetBytes(bool isUnicode) diff --git a/SMBLibrary/SMB1/Commands/OpenAndXResponse.cs b/SMBLibrary/SMB1/Commands/OpenAndXResponse.cs index 23d23d1..64883a4 100644 --- a/SMBLibrary/SMB1/Commands/OpenAndXResponse.cs +++ b/SMBLibrary/SMB1/Commands/OpenAndXResponse.cs @@ -33,7 +33,7 @@ namespace SMBLibrary.SMB1 public OpenAndXResponse() : base() { - LastWriteTime = SMBHelper.UTimeNotSpecified; + LastWriteTime = SMB1Helper.UTimeNotSpecified; Reserved = new byte[6]; } @@ -48,7 +48,7 @@ namespace SMBLibrary.SMB1 int parametersOffset = 4; LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, FID); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)FileAttrs); - SMBHelper.WriteUTime(this.SMBParameters, ref parametersOffset, LastWriteTime); + SMB1Helper.WriteUTime(this.SMBParameters, ref parametersOffset, LastWriteTime); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, FileDataSize); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)AccessRights); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)ResourceType); diff --git a/SMBLibrary/SMB1/Commands/OpenAndXResponseExtended.cs b/SMBLibrary/SMB1/Commands/OpenAndXResponseExtended.cs index 16739d4..35e4a72 100644 --- a/SMBLibrary/SMB1/Commands/OpenAndXResponseExtended.cs +++ b/SMBLibrary/SMB1/Commands/OpenAndXResponseExtended.cs @@ -36,7 +36,7 @@ namespace SMBLibrary.SMB1 public OpenAndXResponseExtended() : base() { - LastWriteTime = SMBHelper.UTimeNotSpecified; + LastWriteTime = SMB1Helper.UTimeNotSpecified; } public OpenAndXResponseExtended(byte[] buffer, int offset) : base(buffer, offset, false) @@ -50,7 +50,7 @@ namespace SMBLibrary.SMB1 int parametersOffset = 4; LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, FID); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)FileAttrs); - SMBHelper.WriteUTime(this.SMBParameters, ref parametersOffset, LastWriteTime); + SMB1Helper.WriteUTime(this.SMBParameters, ref parametersOffset, LastWriteTime); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, FileDataSize); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)AccessRights); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)ResourceType); diff --git a/SMBLibrary/SMB1/Commands/QueryInformationRequest.cs b/SMBLibrary/SMB1/Commands/QueryInformationRequest.cs index bd1c4f1..b700201 100644 --- a/SMBLibrary/SMB1/Commands/QueryInformationRequest.cs +++ b/SMBLibrary/SMB1/Commands/QueryInformationRequest.cs @@ -36,7 +36,7 @@ namespace SMBLibrary.SMB1 { throw new InvalidRequestException("Unsupported Buffer Format"); } - FileName = SMBHelper.ReadSMBString(this.SMBData, 1, isUnicode); + FileName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode); } public override byte[] GetBytes(bool isUnicode) @@ -52,7 +52,7 @@ namespace SMBLibrary.SMB1 } this.SMBData = new byte[1 + length]; ByteWriter.WriteByte(this.SMBData, 0, BufferFormat); - SMBHelper.WriteSMBString(this.SMBData, 1, isUnicode, FileName); + SMB1Helper.WriteSMBString(this.SMBData, 1, isUnicode, FileName); return base.GetBytes(isUnicode); } diff --git a/SMBLibrary/SMB1/Commands/QueryInformationResponse.cs b/SMBLibrary/SMB1/Commands/QueryInformationResponse.cs index 3417890..d26c469 100644 --- a/SMBLibrary/SMB1/Commands/QueryInformationResponse.cs +++ b/SMBLibrary/SMB1/Commands/QueryInformationResponse.cs @@ -33,7 +33,7 @@ namespace SMBLibrary.SMB1 public QueryInformationResponse(byte[] buffer, int offset) : base(buffer, offset, false) { FileAttributes = (FileAttributes)LittleEndianConverter.ToUInt16(this.SMBParameters, 0); - LastWriteTime = SMBHelper.ReadSMBDateTime(this.SMBParameters, 2); + LastWriteTime = SMB1Helper.ReadSMBDateTime(this.SMBParameters, 2); FileSize = LittleEndianConverter.ToUInt32(this.SMBParameters, 6); Reserved = ByteReader.ReadBytes(this.SMBParameters, 10, 10); } @@ -42,7 +42,7 @@ namespace SMBLibrary.SMB1 { this.SMBParameters = new byte[ParameterLength]; LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, (ushort)FileAttributes); - SMBHelper.WriteSMBDateTime(this.SMBParameters, 2, LastWriteTime); + SMB1Helper.WriteSMBDateTime(this.SMBParameters, 2, LastWriteTime); LittleEndianWriter.WriteUInt32(this.SMBParameters, 6, FileSize); ByteWriter.WriteBytes(this.SMBParameters, 10, Reserved, 10); diff --git a/SMBLibrary/SMB1/Commands/RenameRequest.cs b/SMBLibrary/SMB1/Commands/RenameRequest.cs index 05e2c47..d830214 100644 --- a/SMBLibrary/SMB1/Commands/RenameRequest.cs +++ b/SMBLibrary/SMB1/Commands/RenameRequest.cs @@ -42,7 +42,7 @@ namespace SMBLibrary.SMB1 { throw new InvalidRequestException("Unsupported Buffer Format"); } - OldFileName = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + OldFileName = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); BufferFormat2 = ByteReader.ReadByte(this.SMBData, ref dataOffset); if (BufferFormat2 != SupportedBufferFormat) { @@ -52,7 +52,7 @@ namespace SMBLibrary.SMB1 { dataOffset++; } - NewFileName = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + NewFileName = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); } public override byte[] GetBytes(bool isUnicode) @@ -71,13 +71,13 @@ namespace SMBLibrary.SMB1 } int dataOffset = 0; ByteWriter.WriteByte(this.SMBData, ref dataOffset, BufferFormat1); - SMBHelper.WriteSMBString(this.SMBData, ref dataOffset, isUnicode, OldFileName); + SMB1Helper.WriteSMBString(this.SMBData, ref dataOffset, isUnicode, OldFileName); ByteWriter.WriteByte(this.SMBData, ref dataOffset, BufferFormat2); if (isUnicode) { dataOffset++; // padding } - SMBHelper.WriteSMBString(this.SMBData, ref dataOffset, isUnicode, NewFileName); + SMB1Helper.WriteSMBString(this.SMBData, ref dataOffset, isUnicode, NewFileName); return base.GetBytes(isUnicode); } diff --git a/SMBLibrary/SMB1/Commands/SessionSetupAndXRequest.cs b/SMBLibrary/SMB1/Commands/SessionSetupAndXRequest.cs index 30fa905..384a263 100644 --- a/SMBLibrary/SMB1/Commands/SessionSetupAndXRequest.cs +++ b/SMBLibrary/SMB1/Commands/SessionSetupAndXRequest.cs @@ -56,10 +56,10 @@ namespace SMBLibrary.SMB1 int padding = (1 + OEMPasswordLength + UnicodePasswordLength) % 2; dataOffset += padding; } - AccountName = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); - PrimaryDomain = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); - NativeOS = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); - NativeLanMan = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + AccountName = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + PrimaryDomain = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + NativeOS = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + NativeLanMan = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); } public override CommandName CommandName diff --git a/SMBLibrary/SMB1/Commands/SessionSetupAndXRequestExtended.cs b/SMBLibrary/SMB1/Commands/SessionSetupAndXRequestExtended.cs index d4b6900..795c1cc 100644 --- a/SMBLibrary/SMB1/Commands/SessionSetupAndXRequestExtended.cs +++ b/SMBLibrary/SMB1/Commands/SessionSetupAndXRequestExtended.cs @@ -50,8 +50,8 @@ namespace SMBLibrary.SMB1 int padding = (securityBlobLength + 1) % 2; dataOffset += padding; } - NativeOS = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); - NativeLanMan = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + NativeOS = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + NativeLanMan = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); } public override CommandName CommandName diff --git a/SMBLibrary/SMB1/Commands/SessionSetupAndXResponse.cs b/SMBLibrary/SMB1/Commands/SessionSetupAndXResponse.cs index fccc681..429f16d 100644 --- a/SMBLibrary/SMB1/Commands/SessionSetupAndXResponse.cs +++ b/SMBLibrary/SMB1/Commands/SessionSetupAndXResponse.cs @@ -37,9 +37,9 @@ namespace SMBLibrary.SMB1 { dataOffset++; } - NativeOS = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); - NativeLanMan = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); - PrimaryDomain = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + NativeOS = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + NativeLanMan = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + PrimaryDomain = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); } public override byte[] GetBytes(bool isUnicode) @@ -58,9 +58,9 @@ namespace SMBLibrary.SMB1 { this.SMBData = new byte[NativeOS.Length + NativeLanMan.Length + PrimaryDomain.Length + 3]; } - SMBHelper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeOS); - SMBHelper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeLanMan); - SMBHelper.WriteSMBString(this.SMBData, ref offset, isUnicode, PrimaryDomain); + SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeOS); + SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeLanMan); + SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, PrimaryDomain); return base.GetBytes(isUnicode); } diff --git a/SMBLibrary/SMB1/Commands/SessionSetupAndXResponseExtended.cs b/SMBLibrary/SMB1/Commands/SessionSetupAndXResponseExtended.cs index 7ffd593..4f45c93 100644 --- a/SMBLibrary/SMB1/Commands/SessionSetupAndXResponseExtended.cs +++ b/SMBLibrary/SMB1/Commands/SessionSetupAndXResponseExtended.cs @@ -54,8 +54,8 @@ namespace SMBLibrary.SMB1 int offset = 0; ByteWriter.WriteBytes(this.SMBData, ref offset, SecurityBlob); offset += padding; - SMBHelper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeOS); - SMBHelper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeLanMan); + SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeOS); + SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeLanMan); return base.GetBytes(isUnicode); } diff --git a/SMBLibrary/SMB1/Commands/SetInformation2Request.cs b/SMBLibrary/SMB1/Commands/SetInformation2Request.cs index fd69b4d..0823775 100644 --- a/SMBLibrary/SMB1/Commands/SetInformation2Request.cs +++ b/SMBLibrary/SMB1/Commands/SetInformation2Request.cs @@ -59,7 +59,7 @@ namespace SMBLibrary.SMB1 uint value = LittleEndianConverter.ToUInt32(buffer, offset); if (value > 0) { - return SMBHelper.ReadSMBDateTime(buffer, offset); + return SMB1Helper.ReadSMBDateTime(buffer, offset); } return null; } @@ -68,7 +68,7 @@ namespace SMBLibrary.SMB1 { if (datetime.HasValue) { - SMBHelper.WriteSMBDateTime(buffer, offset, datetime.Value); + SMB1Helper.WriteSMBDateTime(buffer, offset, datetime.Value); } } } diff --git a/SMBLibrary/SMB1/Commands/SetInformationRequest.cs b/SMBLibrary/SMB1/Commands/SetInformationRequest.cs index 91aa9d8..02742a3 100644 --- a/SMBLibrary/SMB1/Commands/SetInformationRequest.cs +++ b/SMBLibrary/SMB1/Commands/SetInformationRequest.cs @@ -35,7 +35,7 @@ namespace SMBLibrary.SMB1 public SetInformationRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) { FileAttributes = (FileAttributes)LittleEndianConverter.ToUInt16(this.SMBParameters, 0); - LastWriteTime = SMBHelper.ReadUTime(this.SMBParameters, 2); + LastWriteTime = SMB1Helper.ReadUTime(this.SMBParameters, 2); Reserved = ByteReader.ReadBytes(this.SMBParameters, 6, 10); BufferFormat = ByteReader.ReadByte(this.SMBData, 0); @@ -43,14 +43,14 @@ namespace SMBLibrary.SMB1 { throw new InvalidRequestException("Unsupported Buffer Format"); } - FileName = SMBHelper.ReadSMBString(this.SMBData, 1, isUnicode); + FileName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode); } public override byte[] GetBytes(bool isUnicode) { this.SMBParameters = new byte[ParametersLength]; LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, (ushort)FileAttributes); - SMBHelper.WriteUTime(this.SMBParameters, 2, LastWriteTime); + SMB1Helper.WriteUTime(this.SMBParameters, 2, LastWriteTime); ByteWriter.WriteBytes(this.SMBParameters, 6, Reserved, 10); int length = 1; @@ -64,7 +64,7 @@ namespace SMBLibrary.SMB1 } this.SMBData = new byte[length]; ByteWriter.WriteByte(this.SMBData, 0, BufferFormat); - SMBHelper.WriteSMBString(this.SMBData, 1, isUnicode, FileName); + SMB1Helper.WriteSMBString(this.SMBData, 1, isUnicode, FileName); return base.GetBytes(isUnicode); } diff --git a/SMBLibrary/SMB1/Commands/TransactionRequest.cs b/SMBLibrary/SMB1/Commands/TransactionRequest.cs index ad7528d..bbc4525 100644 --- a/SMBLibrary/SMB1/Commands/TransactionRequest.cs +++ b/SMBLibrary/SMB1/Commands/TransactionRequest.cs @@ -80,7 +80,7 @@ namespace SMBLibrary.SMB1 int namePadding = 1; dataOffset += namePadding; } - Name = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + Name = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); } } TransParameters = ByteReader.ReadBytes(buffer, ParameterOffset, ParameterCount); @@ -154,7 +154,7 @@ namespace SMBLibrary.SMB1 this.SMBData = new byte[Name.Length + 1 + ParameterCount + DataCount + padding1 + padding2]; } } - SMBHelper.WriteSMBString(this.SMBData, ref offset, isUnicode, Name); + SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, Name); ByteWriter.WriteBytes(this.SMBData, offset + padding1, TransParameters); ByteWriter.WriteBytes(this.SMBData, offset + padding1 + ParameterCount + padding2, TransData); diff --git a/SMBLibrary/SMB1/Commands/TreeConnectAndXRequest.cs b/SMBLibrary/SMB1/Commands/TreeConnectAndXRequest.cs index c22b7a4..c10cd4b 100644 --- a/SMBLibrary/SMB1/Commands/TreeConnectAndXRequest.cs +++ b/SMBLibrary/SMB1/Commands/TreeConnectAndXRequest.cs @@ -40,7 +40,7 @@ namespace SMBLibrary.SMB1 int padding = (1 + passwordLength) % 2; dataOffset += padding; } - Path = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + Path = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); // Should be read as OEM string but it doesn't really matter string serviceString = ByteReader.ReadNullTerminatedAnsiString(this.SMBData, ref dataOffset); Service = TreeConnectHelper.GetServiceName(serviceString); @@ -75,7 +75,7 @@ namespace SMBLibrary.SMB1 int padding = (1 + passwordLength) % 2; dataOffset += padding; } - SMBHelper.WriteSMBString(this.SMBData, ref dataOffset, isUnicode, Path); + SMB1Helper.WriteSMBString(this.SMBData, ref dataOffset, isUnicode, Path); ByteWriter.WriteNullTerminatedAnsiString(this.SMBData, ref dataOffset, serviceString); return base.GetBytes(isUnicode); diff --git a/SMBLibrary/SMB1/Commands/TreeConnectAndXResponse.cs b/SMBLibrary/SMB1/Commands/TreeConnectAndXResponse.cs index 3331151..fec6630 100644 --- a/SMBLibrary/SMB1/Commands/TreeConnectAndXResponse.cs +++ b/SMBLibrary/SMB1/Commands/TreeConnectAndXResponse.cs @@ -36,7 +36,7 @@ namespace SMBLibrary.SMB1 int dataOffset = 0; string serviceString = ByteReader.ReadNullTerminatedAnsiString(this.SMBData, ref dataOffset); - NativeFileSystem = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + NativeFileSystem = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); Service = TreeConnectHelper.GetServiceName(serviceString); } @@ -59,7 +59,7 @@ namespace SMBLibrary.SMB1 int offset = 0; ByteWriter.WriteNullTerminatedAnsiString(this.SMBData, ref offset, serviceString); - SMBHelper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeFileSystem); + SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeFileSystem); return base.GetBytes(isUnicode); } diff --git a/SMBLibrary/SMB1/Commands/TreeConnectAndXResponseExtended.cs b/SMBLibrary/SMB1/Commands/TreeConnectAndXResponseExtended.cs index 20b342c..cb12b54 100644 --- a/SMBLibrary/SMB1/Commands/TreeConnectAndXResponseExtended.cs +++ b/SMBLibrary/SMB1/Commands/TreeConnectAndXResponseExtended.cs @@ -41,7 +41,7 @@ namespace SMBLibrary.SMB1 int dataOffset = 0; string serviceString = ByteReader.ReadNullTerminatedAnsiString(this.SMBData, ref dataOffset); - NativeFileSystem = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); + NativeFileSystem = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode); Service = TreeConnectHelper.GetServiceName(serviceString); } @@ -67,7 +67,7 @@ namespace SMBLibrary.SMB1 int offset = 0; ByteWriter.WriteNullTerminatedAnsiString(this.SMBData, ref offset, serviceString); - SMBHelper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeFileSystem); + SMB1Helper.WriteSMBString(this.SMBData, ref offset, isUnicode, NativeFileSystem); return base.GetBytes(isUnicode); } diff --git a/SMBLibrary/SMB1/NTTransactSubcommands/NTTransactCreateRequest.cs b/SMBLibrary/SMB1/NTTransactSubcommands/NTTransactCreateRequest.cs index c827e74..3b2d096 100644 --- a/SMBLibrary/SMB1/NTTransactSubcommands/NTTransactCreateRequest.cs +++ b/SMBLibrary/SMB1/NTTransactSubcommands/NTTransactCreateRequest.cs @@ -61,7 +61,7 @@ namespace SMBLibrary.SMB1 { parametersOffset++; } - Name = SMBHelper.ReadFixedLengthString(parameters, ref parametersOffset, isUnicode, (int)nameLength); + Name = SMB1Helper.ReadFixedLengthString(parameters, ref parametersOffset, isUnicode, (int)nameLength); if (securityDescriptiorLength > 0) { SecurityDescriptor = new SecurityDescriptor(data, 0); diff --git a/SMBLibrary/SMB1/SMBHelper.cs b/SMBLibrary/SMB1/SMB1Helper.cs similarity index 96% rename from SMBLibrary/SMB1/SMBHelper.cs rename to SMBLibrary/SMB1/SMB1Helper.cs index daed92b..edc88c9 100644 --- a/SMBLibrary/SMB1/SMBHelper.cs +++ b/SMBLibrary/SMB1/SMB1Helper.cs @@ -9,9 +9,9 @@ using System.Collections.Generic; using System.Text; using Utilities; -namespace SMBLibrary +namespace SMBLibrary.SMB1 { - public class SMBHelper + public class SMB1Helper { public static readonly DateTime UTimeNotSpecified = new DateTime(1970, 1, 1); public static readonly DateTime FileTimeNotSpecified = new DateTime(1601, 1, 1); diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileBothDirectoryInfo.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileBothDirectoryInfo.cs index 45573ad..4e3d32f 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileBothDirectoryInfo.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileBothDirectoryInfo.cs @@ -46,10 +46,10 @@ namespace SMBLibrary.SMB1 { NextEntryOffset = LittleEndianReader.ReadUInt32(buffer, ref offset); FileIndex = LittleEndianReader.ReadUInt32(buffer, ref offset); - CreationTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastAccessTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastWriteTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastChangeTime = SMBHelper.ReadFileTime(buffer, ref offset); + CreationTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastAccessTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastWriteTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastChangeTime = SMB1Helper.ReadFileTime(buffer, ref offset); EndOfFile = LittleEndianReader.ReadUInt64(buffer, ref offset); AllocationSize = LittleEndianReader.ReadUInt64(buffer, ref offset); ExtFileAttributes = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(buffer, ref offset); @@ -59,7 +59,7 @@ namespace SMBLibrary.SMB1 Reserved = ByteReader.ReadByte(buffer, ref offset); ShortName = ByteReader.ReadUTF16String(buffer, ref offset, 12); ShortName = ShortName.Substring(0, shortNameLength); - FileName = SMBHelper.ReadFixedLengthString(buffer, ref offset, isUnicode, (int)fileNameLength); + FileName = SMB1Helper.ReadFixedLengthString(buffer, ref offset, isUnicode, (int)fileNameLength); } public override void WriteBytes(byte[] buffer, ref int offset, bool isUnicode) @@ -69,10 +69,10 @@ namespace SMBLibrary.SMB1 LittleEndianWriter.WriteUInt32(buffer, ref offset, NextEntryOffset); LittleEndianWriter.WriteUInt32(buffer, ref offset, FileIndex); - SMBHelper.WriteFileTime(buffer, ref offset, CreationTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastAccessTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastWriteTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastChangeTime); + SMB1Helper.WriteFileTime(buffer, ref offset, CreationTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastAccessTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastWriteTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastChangeTime); LittleEndianWriter.WriteUInt64(buffer, ref offset, EndOfFile); LittleEndianWriter.WriteUInt64(buffer, ref offset, AllocationSize); LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)ExtFileAttributes); @@ -81,7 +81,7 @@ namespace SMBLibrary.SMB1 ByteWriter.WriteByte(buffer, ref offset, shortNameLength); ByteWriter.WriteByte(buffer, ref offset, Reserved); ByteWriter.WriteUTF16String(buffer, ref offset, ShortName, 12); - SMBHelper.WriteSMBString(buffer, ref offset, isUnicode, FileName); + SMB1Helper.WriteSMBString(buffer, ref offset, isUnicode, FileName); } public override int GetLength(bool isUnicode) diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileDirectoryInfo.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileDirectoryInfo.cs index 39a2655..dcbaba5 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileDirectoryInfo.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileDirectoryInfo.cs @@ -38,15 +38,15 @@ namespace SMBLibrary.SMB1 { NextEntryOffset = LittleEndianReader.ReadUInt32(buffer, ref offset); FileIndex = LittleEndianReader.ReadUInt32(buffer, ref offset); - CreationTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastAccessTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastWriteTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastAttrChangeTime = SMBHelper.ReadFileTime(buffer, ref offset); + CreationTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastAccessTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastWriteTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastAttrChangeTime = SMB1Helper.ReadFileTime(buffer, ref offset); EndOfFile = LittleEndianReader.ReadUInt64(buffer, ref offset); AllocationSize = LittleEndianReader.ReadUInt64(buffer, ref offset); ExtFileAttributes = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(buffer, ref offset); uint fileNameLength = LittleEndianReader.ReadUInt32(buffer, ref offset); - FileName = SMBHelper.ReadFixedLengthString(buffer, ref offset, isUnicode, (int)fileNameLength); + FileName = SMB1Helper.ReadFixedLengthString(buffer, ref offset, isUnicode, (int)fileNameLength); } public override void WriteBytes(byte[] buffer, ref int offset, bool isUnicode) @@ -55,15 +55,15 @@ namespace SMBLibrary.SMB1 LittleEndianWriter.WriteUInt32(buffer, ref offset, NextEntryOffset); LittleEndianWriter.WriteUInt32(buffer, ref offset, FileIndex); - SMBHelper.WriteFileTime(buffer, ref offset, CreationTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastAccessTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastWriteTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastAttrChangeTime); + SMB1Helper.WriteFileTime(buffer, ref offset, CreationTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastAccessTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastWriteTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastAttrChangeTime); LittleEndianWriter.WriteUInt64(buffer, ref offset, EndOfFile); LittleEndianWriter.WriteUInt64(buffer, ref offset, AllocationSize); LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)ExtFileAttributes); LittleEndianWriter.WriteUInt32(buffer, ref offset, fileNameLength); - SMBHelper.WriteSMBString(buffer, ref offset, isUnicode, FileName); + SMB1Helper.WriteSMBString(buffer, ref offset, isUnicode, FileName); } public override int GetLength(bool isUnicode) diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileFullDirectoryInfo.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileFullDirectoryInfo.cs index c70ea9e..3a77d73 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileFullDirectoryInfo.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileFullDirectoryInfo.cs @@ -39,16 +39,16 @@ namespace SMBLibrary.SMB1 { NextEntryOffset = LittleEndianReader.ReadUInt32(buffer, ref offset); FileIndex = LittleEndianReader.ReadUInt32(buffer, ref offset); - CreationTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastAccessTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastWriteTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastAttrChangeTime = SMBHelper.ReadFileTime(buffer, ref offset); + CreationTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastAccessTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastWriteTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastAttrChangeTime = SMB1Helper.ReadFileTime(buffer, ref offset); EndOfFile = LittleEndianReader.ReadUInt64(buffer, ref offset); AllocationSize = LittleEndianReader.ReadUInt64(buffer, ref offset); ExtFileAttributes = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(buffer, ref offset); uint fileNameLength = LittleEndianReader.ReadUInt32(buffer, ref offset); EASize = LittleEndianReader.ReadUInt32(buffer, ref offset); - FileName = SMBHelper.ReadFixedLengthString(buffer, ref offset, isUnicode, (int)fileNameLength); + FileName = SMB1Helper.ReadFixedLengthString(buffer, ref offset, isUnicode, (int)fileNameLength); } public override void WriteBytes(byte[] buffer, ref int offset, bool isUnicode) @@ -57,16 +57,16 @@ namespace SMBLibrary.SMB1 LittleEndianWriter.WriteUInt32(buffer, ref offset, NextEntryOffset); LittleEndianWriter.WriteUInt32(buffer, ref offset, FileIndex); - SMBHelper.WriteFileTime(buffer, ref offset, CreationTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastAccessTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastWriteTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastAttrChangeTime); + SMB1Helper.WriteFileTime(buffer, ref offset, CreationTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastAccessTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastWriteTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastAttrChangeTime); LittleEndianWriter.WriteUInt64(buffer, ref offset, EndOfFile); LittleEndianWriter.WriteUInt64(buffer, ref offset, AllocationSize); LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)ExtFileAttributes); LittleEndianWriter.WriteUInt32(buffer, ref offset, fileNameLength); LittleEndianWriter.WriteUInt32(buffer, ref offset, EASize); - SMBHelper.WriteSMBString(buffer, ref offset, isUnicode, FileName); + SMB1Helper.WriteSMBString(buffer, ref offset, isUnicode, FileName); } public override int GetLength(bool isUnicode) diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileNamesInfo.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileNamesInfo.cs index 5b13a0f..8e1ec0d 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileNamesInfo.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindFileNamesInfo.cs @@ -32,7 +32,7 @@ namespace SMBLibrary.SMB1 NextEntryOffset = LittleEndianReader.ReadUInt32(buffer, ref offset); FileIndex = LittleEndianReader.ReadUInt32(buffer, ref offset); uint fileNameLength = LittleEndianReader.ReadUInt32(buffer, ref offset); - FileName = SMBHelper.ReadFixedLengthString(buffer, ref offset, isUnicode, (int)fileNameLength); + FileName = SMB1Helper.ReadFixedLengthString(buffer, ref offset, isUnicode, (int)fileNameLength); } public override void WriteBytes(byte[] buffer, ref int offset, bool isUnicode) @@ -42,7 +42,7 @@ namespace SMBLibrary.SMB1 LittleEndianWriter.WriteUInt32(buffer, ref offset, NextEntryOffset); LittleEndianWriter.WriteUInt32(buffer, ref offset, FileIndex); LittleEndianWriter.WriteUInt32(buffer, ref offset, fileNameLength); - SMBHelper.WriteSMBString(buffer, ref offset, isUnicode, FileName); + SMB1Helper.WriteSMBString(buffer, ref offset, isUnicode, FileName); } public override int GetLength(bool isUnicode) diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryEASize.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryEASize.cs index cd843ba..4ead1cf 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryEASize.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryEASize.cs @@ -37,15 +37,15 @@ namespace SMBLibrary.SMB1 { ResumeKey = LittleEndianReader.ReadUInt32(buffer, ref offset); } - CreationDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); - LastAccessDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); - LastWriteDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); + CreationDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); + LastAccessDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); + 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); EASize = LittleEndianReader.ReadUInt32(buffer, ref offset); byte fileNameLength = ByteReader.ReadByte(buffer, ref offset); - FileName = SMBHelper.ReadFixedLengthString(buffer, ref offset, isUnicode, fileNameLength); + FileName = SMB1Helper.ReadFixedLengthString(buffer, ref offset, isUnicode, fileNameLength); } public override void WriteBytes(byte[] buffer, ref int offset, bool isUnicode) @@ -56,15 +56,15 @@ namespace SMBLibrary.SMB1 { LittleEndianWriter.WriteUInt32(buffer, ref offset, ResumeKey); } - SMBHelper.WriteSMBDateTime(buffer, ref offset, CreationDateTime); - SMBHelper.WriteSMBDateTime(buffer, ref offset, LastAccessDateTime); - SMBHelper.WriteSMBDateTime(buffer, ref offset, LastWriteDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, CreationDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, LastAccessDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, LastWriteDateTime); LittleEndianWriter.WriteUInt32(buffer, ref offset, FileDataSize); LittleEndianWriter.WriteUInt32(buffer, ref offset, AllocationSize); LittleEndianWriter.WriteUInt16(buffer, ref offset, (ushort)Attributes); LittleEndianWriter.WriteUInt32(buffer, ref offset, EASize); ByteWriter.WriteByte(buffer, ref offset, fileNameLength); - SMBHelper.WriteSMBString(buffer, ref offset, isUnicode, FileName); + SMB1Helper.WriteSMBString(buffer, ref offset, isUnicode, FileName); } public override int GetLength(bool isUnicode) diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryExtendedAttributesFromList.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryExtendedAttributesFromList.cs index c136a79..fd63330 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryExtendedAttributesFromList.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoQueryExtendedAttributesFromList.cs @@ -37,15 +37,15 @@ namespace SMBLibrary.SMB1 { ResumeKey = LittleEndianReader.ReadUInt32(buffer, ref offset); } - CreationDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); - LastAccessDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); - LastWriteDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); + CreationDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); + LastAccessDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); + 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); ExtendedAttributeList = new FullExtendedAttributeList(buffer, offset); byte fileNameLength = ByteReader.ReadByte(buffer, ref offset); - FileName = SMBHelper.ReadFixedLengthString(buffer, ref offset, isUnicode, fileNameLength); + FileName = SMB1Helper.ReadFixedLengthString(buffer, ref offset, isUnicode, fileNameLength); } public override void WriteBytes(byte[] buffer, ref int offset, bool isUnicode) @@ -56,15 +56,15 @@ namespace SMBLibrary.SMB1 { LittleEndianWriter.WriteUInt32(buffer, ref offset, ResumeKey); } - SMBHelper.WriteSMBDateTime(buffer, ref offset, CreationDateTime); - SMBHelper.WriteSMBDateTime(buffer, ref offset, LastAccessDateTime); - SMBHelper.WriteSMBDateTime(buffer, ref offset, LastWriteDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, CreationDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, LastAccessDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, LastWriteDateTime); LittleEndianWriter.WriteUInt32(buffer, ref offset, FileDataSize); LittleEndianWriter.WriteUInt32(buffer, ref offset, AllocationSize); LittleEndianWriter.WriteUInt16(buffer, ref offset, (ushort)Attributes); ExtendedAttributeList.WriteBytes(buffer, ref offset); ByteWriter.WriteByte(buffer, ref offset, fileNameLength); - SMBHelper.WriteSMBString(buffer, ref offset, isUnicode, FileName); + SMB1Helper.WriteSMBString(buffer, ref offset, isUnicode, FileName); } public override int GetLength(bool isUnicode) diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoStandard.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoStandard.cs index bd3dd53..933acad 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoStandard.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/FindInformation/FindInfoStandard.cs @@ -38,14 +38,14 @@ namespace SMBLibrary.SMB1 { ResumeKey = LittleEndianReader.ReadUInt32(buffer, ref offset); } - CreationDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); - LastAccessDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); - LastWriteDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); + CreationDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); + LastAccessDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); + 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); byte fileNameLength = ByteReader.ReadByte(buffer, ref offset); - FileName = SMBHelper.ReadSMBString(buffer, ref offset, isUnicode); + FileName = SMB1Helper.ReadSMBString(buffer, ref offset, isUnicode); } public override void WriteBytes(byte[] buffer, ref int offset, bool isUnicode) @@ -56,14 +56,14 @@ namespace SMBLibrary.SMB1 { LittleEndianWriter.WriteUInt32(buffer, ref offset, ResumeKey); } - SMBHelper.WriteSMBDateTime(buffer, ref offset, CreationDateTime); - SMBHelper.WriteSMBDateTime(buffer, ref offset, LastAccessDateTime); - SMBHelper.WriteSMBDateTime(buffer, ref offset, LastWriteDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, CreationDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, LastAccessDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, LastWriteDateTime); LittleEndianWriter.WriteUInt32(buffer, ref offset, FileDataSize); LittleEndianWriter.WriteUInt32(buffer, ref offset, AllocationSize); LittleEndianWriter.WriteUInt16(buffer, ref offset, (ushort)Attributes); ByteWriter.WriteByte(buffer, ref offset, fileNameLength); - SMBHelper.WriteSMBString(buffer, ref offset, isUnicode, FileName); + SMB1Helper.WriteSMBString(buffer, ref offset, isUnicode, FileName); } public override int GetLength(bool isUnicode) diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryFSInformation/QueryFSInfoVolume.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryFSInformation/QueryFSInfoVolume.cs index fad2dcd..3d7b062 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryFSInformation/QueryFSInfoVolume.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryFSInformation/QueryFSInfoVolume.cs @@ -28,7 +28,7 @@ namespace SMBLibrary.SMB1 { VolumeSerialNumber = LittleEndianConverter.ToUInt32(buffer, offset + 0); byte charCount = ByteReader.ReadByte(buffer, offset + 4); - VolumeLabel = SMBHelper.ReadSMBString(buffer, offset + 5, isUnicode); + VolumeLabel = SMB1Helper.ReadSMBString(buffer, offset + 5, isUnicode); } public override byte[] GetBytes(bool isUnicode) @@ -39,7 +39,7 @@ namespace SMBLibrary.SMB1 byte[] buffer = new byte[length]; LittleEndianWriter.WriteUInt32(buffer, 0, VolumeSerialNumber); ByteWriter.WriteByte(buffer, 4, charCount); - SMBHelper.WriteSMBString(buffer, 5, isUnicode, VolumeLabel); + SMB1Helper.WriteSMBString(buffer, 5, isUnicode, VolumeLabel); return buffer; } diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryFSInformation/QueryFSVolumeInfo.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryFSInformation/QueryFSVolumeInfo.cs index ae24bd9..a6f7f99 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryFSInformation/QueryFSVolumeInfo.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryFSInformation/QueryFSVolumeInfo.cs @@ -31,7 +31,7 @@ namespace SMBLibrary.SMB1 public QueryFSVolumeInfo(byte[] buffer, int offset) { - VolumeCreationTime = SMBHelper.ReadFileTime(buffer, offset + 0); + VolumeCreationTime = SMB1Helper.ReadFileTime(buffer, offset + 0); SerialNumber = LittleEndianConverter.ToUInt32(buffer, offset + 8); uint volumeLabelSize = LittleEndianConverter.ToUInt32(buffer, offset + 12); Reserved = LittleEndianConverter.ToUInt16(buffer, offset + 16); @@ -43,7 +43,7 @@ namespace SMBLibrary.SMB1 uint volumeLabelSize = (uint)(VolumeLabel.Length * 2); byte[] buffer = new byte[FixedLength + volumeLabelSize]; - SMBHelper.WriteFileTime(buffer, 0, VolumeCreationTime); + SMB1Helper.WriteFileTime(buffer, 0, VolumeCreationTime); LittleEndianWriter.WriteUInt32(buffer, 8, SerialNumber); LittleEndianWriter.WriteUInt32(buffer, 12, volumeLabelSize); LittleEndianWriter.WriteUInt16(buffer, 16, Reserved); diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryEASize.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryEASize.cs index c8a405d..62d1ed7 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryEASize.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryEASize.cs @@ -32,9 +32,9 @@ namespace SMBLibrary.SMB1 public QueryEASize(byte[] buffer, int offset) { - CreationDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); - LastAccessDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); - LastWriteDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); + CreationDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); + LastAccessDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); + 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); @@ -45,9 +45,9 @@ namespace SMBLibrary.SMB1 { byte[] buffer = new byte[Length]; int offset = 0; - SMBHelper.WriteSMBDateTime(buffer, ref offset, CreationDateTime); - SMBHelper.WriteSMBDateTime(buffer, ref offset, LastAccessDateTime); - SMBHelper.WriteSMBDateTime(buffer, ref offset, LastWriteDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, CreationDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, LastAccessDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, LastWriteDateTime); LittleEndianWriter.WriteUInt32(buffer, ref offset, FileDataSize); LittleEndianWriter.WriteUInt32(buffer, ref offset, AllocationSize); LittleEndianWriter.WriteUInt16(buffer, ref offset, (ushort)Attributes); diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryFileAllInfo.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryFileAllInfo.cs index ba67c07..a664470 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryFileAllInfo.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryFileAllInfo.cs @@ -40,10 +40,10 @@ namespace SMBLibrary.SMB1 public QueryFileAllInfo(byte[] buffer, int offset) { - CreationDateTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastAccessDateTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastWriteDateTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastChangeTime = SMBHelper.ReadFileTime(buffer, ref offset); + CreationDateTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastAccessDateTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastWriteDateTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastChangeTime = SMB1Helper.ReadFileTime(buffer, ref offset); ExtFileAttributes = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(buffer, ref offset); Reserved1 = LittleEndianReader.ReadUInt32(buffer, ref offset); AllocationSize = LittleEndianReader.ReadUInt64(buffer, ref offset); @@ -62,10 +62,10 @@ namespace SMBLibrary.SMB1 uint fileNameLength = (uint)(FileName.Length * 2); byte[] buffer = new byte[FixedLength + fileNameLength]; int offset = 0; - SMBHelper.WriteFileTime(buffer, ref offset, CreationDateTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastAccessDateTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastWriteDateTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastChangeTime); + SMB1Helper.WriteFileTime(buffer, ref offset, CreationDateTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastAccessDateTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastWriteDateTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastChangeTime); LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)ExtFileAttributes); LittleEndianWriter.WriteUInt32(buffer, ref offset, Reserved1); LittleEndianWriter.WriteUInt64(buffer, ref offset, AllocationSize); diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryFileBasicInfo.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryFileBasicInfo.cs index 2c6b25c..def18ef 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryFileBasicInfo.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryFileBasicInfo.cs @@ -31,10 +31,10 @@ namespace SMBLibrary.SMB1 public QueryFileBasicInfo(byte[] buffer, int offset) { - CreationDateTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastAccessDateTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastWriteDateTime = SMBHelper.ReadFileTime(buffer, ref offset); - LastChangeTime = SMBHelper.ReadFileTime(buffer, ref offset); + CreationDateTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastAccessDateTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastWriteDateTime = SMB1Helper.ReadFileTime(buffer, ref offset); + LastChangeTime = SMB1Helper.ReadFileTime(buffer, ref offset); ExtFileAttributes = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(buffer, ref offset); Reserved = LittleEndianReader.ReadUInt32(buffer, ref offset); } @@ -43,10 +43,10 @@ namespace SMBLibrary.SMB1 { byte[] buffer = new byte[Length]; int offset = 0; - SMBHelper.WriteFileTime(buffer, ref offset, CreationDateTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastAccessDateTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastWriteDateTime); - SMBHelper.WriteFileTime(buffer, ref offset, LastChangeTime); + SMB1Helper.WriteFileTime(buffer, ref offset, CreationDateTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastAccessDateTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastWriteDateTime); + SMB1Helper.WriteFileTime(buffer, ref offset, LastChangeTime); LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)ExtFileAttributes); LittleEndianWriter.WriteUInt32(buffer, ref offset, Reserved); return buffer; diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryInfoStandard.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryInfoStandard.cs index 19c2904..cf780bc 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryInfoStandard.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/QueryInformation/QueryInfoStandard.cs @@ -31,9 +31,9 @@ namespace SMBLibrary.SMB1 public QueryInfoStandard(byte[] buffer, int offset) { - CreationDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); - LastAccessDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); - LastWriteDateTime = SMBHelper.ReadSMBDateTime(buffer, ref offset); + CreationDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); + LastAccessDateTime = SMB1Helper.ReadSMBDateTime(buffer, ref offset); + 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); @@ -43,9 +43,9 @@ namespace SMBLibrary.SMB1 { byte[] buffer = new byte[Length]; int offset = 0; - SMBHelper.WriteSMBDateTime(buffer, ref offset, CreationDateTime); - SMBHelper.WriteSMBDateTime(buffer, ref offset, LastAccessDateTime); - SMBHelper.WriteSMBDateTime(buffer, ref offset, LastWriteDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, CreationDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, LastAccessDateTime); + SMB1Helper.WriteSMBDateTime(buffer, ref offset, LastWriteDateTime); LittleEndianWriter.WriteUInt32(buffer, ref offset, FileDataSize); LittleEndianWriter.WriteUInt32(buffer, ref offset, AllocationSize); LittleEndianWriter.WriteUInt16(buffer, ref offset, (ushort)Attributes); diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/SetInformation/SetFileBasicInfo.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/SetInformation/SetFileBasicInfo.cs index 04b2840..e528fe4 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/SetInformation/SetFileBasicInfo.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/SetInformation/SetFileBasicInfo.cs @@ -35,10 +35,10 @@ namespace SMBLibrary.SMB1 public SetFileBasicInfo(byte[] buffer, int offset) { - CreationTime = SMBHelper.ReadSetFileTime(buffer, offset + 0); - LastAccessTime = SMBHelper.ReadSetFileTime(buffer, offset + 8); - LastWriteTime = SMBHelper.ReadSetFileTime(buffer, offset + 16); - LastChangeTime = SMBHelper.ReadSetFileTime(buffer, offset + 24); + CreationTime = SMB1Helper.ReadSetFileTime(buffer, offset + 0); + LastAccessTime = SMB1Helper.ReadSetFileTime(buffer, offset + 8); + LastWriteTime = SMB1Helper.ReadSetFileTime(buffer, offset + 16); + LastChangeTime = SMB1Helper.ReadSetFileTime(buffer, offset + 24); ExtFileAttributes = (ExtendedFileAttributes)LittleEndianConverter.ToUInt32(buffer, offset + 32); Reserved = LittleEndianConverter.ToUInt32(buffer, offset + 36); } @@ -46,10 +46,10 @@ namespace SMBLibrary.SMB1 public override byte[] GetBytes() { byte[] buffer = new byte[Length]; - SMBHelper.WriteFileTime(buffer, 0, CreationTime); - SMBHelper.WriteFileTime(buffer, 8, LastAccessTime); - SMBHelper.WriteFileTime(buffer, 16, LastWriteTime); - SMBHelper.WriteFileTime(buffer, 24, LastChangeTime); + SMB1Helper.WriteFileTime(buffer, 0, CreationTime); + SMB1Helper.WriteFileTime(buffer, 8, LastAccessTime); + SMB1Helper.WriteFileTime(buffer, 16, LastWriteTime); + SMB1Helper.WriteFileTime(buffer, 24, LastChangeTime); LittleEndianWriter.WriteUInt32(buffer, 32, (uint)ExtFileAttributes); LittleEndianWriter.WriteUInt32(buffer, 36, Reserved); return buffer; diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/SetInformation/SetInfoStandard.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/SetInformation/SetInfoStandard.cs index 8d8da61..6c2f519 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Structures/SetInformation/SetInfoStandard.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Structures/SetInformation/SetInfoStandard.cs @@ -34,18 +34,18 @@ namespace SMBLibrary.SMB1 public SetInfoStandard(byte[] buffer, int offset) { - CreationDateTime = SMBHelper.ReadSMBDateTime(buffer, offset + 0); - LastAccessDateTime = SMBHelper.ReadSMBDateTime(buffer, offset + 4); - LastWriteDateTime = SMBHelper.ReadSMBDateTime(buffer, offset + 8); + CreationDateTime = SMB1Helper.ReadSMBDateTime(buffer, offset + 0); + LastAccessDateTime = SMB1Helper.ReadSMBDateTime(buffer, offset + 4); + LastWriteDateTime = SMB1Helper.ReadSMBDateTime(buffer, offset + 8); Reserved = ByteReader.ReadBytes(buffer, offset + 12, 10); } public override byte[] GetBytes() { byte[] buffer = new byte[Length]; - SMBHelper.WriteSMBDateTime(buffer, 0, CreationDateTime); - SMBHelper.WriteSMBDateTime(buffer, 4, LastAccessDateTime); - SMBHelper.WriteSMBDateTime(buffer, 8, LastWriteDateTime); + SMB1Helper.WriteSMBDateTime(buffer, 0, CreationDateTime); + SMB1Helper.WriteSMBDateTime(buffer, 4, LastAccessDateTime); + SMB1Helper.WriteSMBDateTime(buffer, 8, LastWriteDateTime); ByteWriter.WriteBytes(buffer, 12, Reserved); return buffer; } diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2CreateDirectoryRequest.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2CreateDirectoryRequest.cs index bd670dd..c92f731 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2CreateDirectoryRequest.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2CreateDirectoryRequest.cs @@ -28,7 +28,7 @@ namespace SMBLibrary.SMB1 public Transaction2CreateDirectoryRequest(byte[] parameters, byte[] data, bool isUnicode) : base() { Reserved = LittleEndianConverter.ToUInt32(parameters, 0); - DirectoryName = SMBHelper.ReadSMBString(parameters, 4, isUnicode); + DirectoryName = SMB1Helper.ReadSMBString(parameters, 4, isUnicode); ExtendedAttributeList = new FullExtendedAttributeList(data); } @@ -43,7 +43,7 @@ namespace SMBLibrary.SMB1 length += isUnicode ? DirectoryName.Length * 2 + 2 : DirectoryName.Length + 1 + 1; byte[] parameters = new byte[length]; LittleEndianWriter.WriteUInt32(parameters, 0, Reserved); - SMBHelper.WriteSMBString(parameters, 4, isUnicode, DirectoryName); + SMB1Helper.WriteSMBString(parameters, 4, isUnicode, DirectoryName); return parameters; } diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindFirst2Request.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindFirst2Request.cs index 51de456..f6f5bc7 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindFirst2Request.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindFirst2Request.cs @@ -38,7 +38,7 @@ namespace SMBLibrary.SMB1 Flags = (FindFlags)LittleEndianConverter.ToUInt16(parameters, 4); InformationLevel = (FindInformationLevel)LittleEndianConverter.ToUInt16(parameters, 6); SearchStorageType = (SearchStorageType)LittleEndianConverter.ToUInt32(parameters, 8); - FileName = SMBHelper.ReadSMBString(parameters, 12, isUnicode); + FileName = SMB1Helper.ReadSMBString(parameters, 12, isUnicode); if (InformationLevel == FindInformationLevel.SMB_INFO_QUERY_EAS_FROM_LIST) { @@ -69,7 +69,7 @@ namespace SMBLibrary.SMB1 LittleEndianWriter.WriteUInt16(parameters, 4, (ushort)Flags); LittleEndianWriter.WriteUInt16(parameters, 6, (ushort)InformationLevel); LittleEndianWriter.WriteUInt32(parameters, 8, (uint)SearchStorageType); - SMBHelper.WriteSMBString(parameters, 12, isUnicode, FileName); + SMB1Helper.WriteSMBString(parameters, 12, isUnicode, FileName); return parameters; } diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindNext2Request.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindNext2Request.cs index aaa3db2..28461a3 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindNext2Request.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindNext2Request.cs @@ -35,7 +35,7 @@ namespace SMBLibrary.SMB1 InformationLevel = (FindInformationLevel)LittleEndianConverter.ToUInt16(parameters, 4); ResumeKey = LittleEndianConverter.ToUInt32(parameters, 6); Flags = (FindFlags)LittleEndianConverter.ToUInt16(parameters, 10); - FileName = SMBHelper.ReadSMBString(parameters, 12, isUnicode); + FileName = SMB1Helper.ReadSMBString(parameters, 12, isUnicode); } public override byte[] GetSetup() @@ -61,7 +61,7 @@ namespace SMBLibrary.SMB1 LittleEndianWriter.WriteUInt16(parameters, 4, (ushort)InformationLevel); LittleEndianWriter.WriteUInt32(parameters, 6, ResumeKey); LittleEndianWriter.WriteUInt16(parameters, 10, (ushort)Flags); - SMBHelper.WriteSMBString(parameters, 12, isUnicode, FileName); + SMB1Helper.WriteSMBString(parameters, 12, isUnicode, FileName); return parameters; } diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Request.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Request.cs index 391500d..bd70bb6 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Request.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Request.cs @@ -31,7 +31,7 @@ namespace SMBLibrary.SMB1 public Transaction2Open2Request() : base() { - CreationTime = SMBHelper.UTimeNotSpecified; + CreationTime = SMB1Helper.UTimeNotSpecified; Reserved = new byte[10]; } @@ -41,11 +41,11 @@ namespace SMBLibrary.SMB1 AccessMode = new AccessModeOptions(parameters, 2); Reserved1 = LittleEndianConverter.ToUInt16(parameters, 4); FileAttributes = (FileAttributes)LittleEndianConverter.ToUInt16(parameters, 6); - CreationTime = SMBHelper.ReadUTime(parameters, 8); + CreationTime = SMB1Helper.ReadUTime(parameters, 8); OpenMode = new OpenMode(parameters, 12); AllocationSize = LittleEndianConverter.ToUInt32(parameters, 14); Reserved = ByteReader.ReadBytes(parameters, 18, 10); - FileName = SMBHelper.ReadSMBString(parameters, 28, isUnicode); + FileName = SMB1Helper.ReadSMBString(parameters, 28, isUnicode); ExtendedAttributeList = new FullExtendedAttributeList(data, 0); } @@ -72,11 +72,11 @@ namespace SMBLibrary.SMB1 AccessMode.WriteBytes(parameters, 2); LittleEndianWriter.WriteUInt16(parameters, 4, Reserved1); LittleEndianWriter.WriteUInt16(parameters, 6, (ushort)FileAttributes); - SMBHelper.WriteUTime(parameters, 8, CreationTime); + SMB1Helper.WriteUTime(parameters, 8, CreationTime); OpenMode.WriteBytes(parameters, 12); LittleEndianWriter.WriteUInt32(parameters, 14, AllocationSize); ByteWriter.WriteBytes(parameters, 18, Reserved, 10); - SMBHelper.WriteSMBString(parameters, 28, isUnicode, FileName); + SMB1Helper.WriteSMBString(parameters, 28, isUnicode, FileName); return parameters; } diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Response.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Response.cs index 68a71b9..3033d12 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Response.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2Open2Response.cs @@ -32,14 +32,14 @@ namespace SMBLibrary.SMB1 public Transaction2Open2Response() : base() { - CreationTime = SMBHelper.FileTimeNotSpecified; + CreationTime = SMB1Helper.FileTimeNotSpecified; } public Transaction2Open2Response(byte[] parameters, byte[] data, bool isUnicode) : base() { FID = LittleEndianConverter.ToUInt16(parameters, 0); FileAttributes = (FileAttributes)LittleEndianConverter.ToUInt16(parameters, 2); - CreationTime = SMBHelper.ReadUTime(parameters, 4); + CreationTime = SMB1Helper.ReadUTime(parameters, 4); FileDataSize = LittleEndianConverter.ToUInt32(parameters, 8); AccessMode = new AccessModeOptions(parameters, 12); ResourceType = (ResourceType)LittleEndianConverter.ToUInt16(parameters, 14); @@ -55,7 +55,7 @@ namespace SMBLibrary.SMB1 byte[] parameters = new byte[ParametersLength]; LittleEndianWriter.WriteUInt16(parameters, 0, FID); LittleEndianWriter.WriteUInt16(parameters, 2, (ushort)FileAttributes); - SMBHelper.WriteUTime(parameters, 4, CreationTime); + SMB1Helper.WriteUTime(parameters, 4, CreationTime); LittleEndianWriter.WriteUInt32(parameters, 8, FileDataSize); AccessMode.WriteBytes(parameters, 12); LittleEndianWriter.WriteUInt16(parameters, 14, (ushort)ResourceType); diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2QueryPathInformationRequest.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2QueryPathInformationRequest.cs index 988356e..2fb3111 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2QueryPathInformationRequest.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2QueryPathInformationRequest.cs @@ -32,7 +32,7 @@ namespace SMBLibrary.SMB1 { InformationLevel = (QueryInformationLevel)LittleEndianConverter.ToUInt16(parameters, 0); Reserved = LittleEndianConverter.ToUInt32(parameters, 4); - FileName = SMBHelper.ReadSMBString(parameters, 6, isUnicode); + FileName = SMB1Helper.ReadSMBString(parameters, 6, isUnicode); if (InformationLevel == QueryInformationLevel.SMB_INFO_QUERY_EAS_FROM_LIST) { @@ -59,7 +59,7 @@ namespace SMBLibrary.SMB1 byte[] parameters = new byte[length]; LittleEndianWriter.WriteUInt16(parameters, 0, (ushort)InformationLevel); LittleEndianWriter.WriteUInt32(parameters, 2, Reserved); - SMBHelper.WriteSMBString(parameters, 6, isUnicode, FileName); + SMB1Helper.WriteSMBString(parameters, 6, isUnicode, FileName); return parameters; } diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2SetPathInformationRequest.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2SetPathInformationRequest.cs index deac64e..85f8011 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2SetPathInformationRequest.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2SetPathInformationRequest.cs @@ -31,7 +31,7 @@ namespace SMBLibrary.SMB1 { InformationLevel = (SetInformationLevel)LittleEndianConverter.ToUInt16(parameters, 0); Reserved = LittleEndianConverter.ToUInt32(parameters, 2); - FileName = SMBHelper.ReadSMBString(parameters, 6, isUnicode); + FileName = SMB1Helper.ReadSMBString(parameters, 6, isUnicode); } public override byte[] GetSetup() @@ -54,7 +54,7 @@ namespace SMBLibrary.SMB1 byte[] parameters = new byte[length]; LittleEndianWriter.WriteUInt16(parameters, 0, (ushort)InformationLevel); LittleEndianWriter.WriteUInt32(parameters, 2, Reserved); - SMBHelper.WriteSMBString(parameters, 6, isUnicode, FileName); + SMB1Helper.WriteSMBString(parameters, 6, isUnicode, FileName); return parameters; } diff --git a/SMBLibrary/SMB1/TransactionSubcommands/TransactionQueryNamedPipeInfoResponse.cs b/SMBLibrary/SMB1/TransactionSubcommands/TransactionQueryNamedPipeInfoResponse.cs index 2ae6476..c0da875 100644 --- a/SMBLibrary/SMB1/TransactionSubcommands/TransactionQueryNamedPipeInfoResponse.cs +++ b/SMBLibrary/SMB1/TransactionSubcommands/TransactionQueryNamedPipeInfoResponse.cs @@ -35,7 +35,7 @@ namespace SMBLibrary.SMB1 CurrentInstances = ByteReader.ReadByte(parameters, 5); PipeNameLength = ByteReader.ReadByte(parameters, 6); // Note: Trans_Parameters is aligned to 4 byte boundary - PipeName = SMBHelper.ReadSMBString(parameters, 8, isUnicode); + PipeName = SMB1Helper.ReadSMBString(parameters, 8, isUnicode); } public override byte[] GetParameters(bool isUnicode) @@ -55,7 +55,7 @@ namespace SMBLibrary.SMB1 ByteWriter.WriteByte(parameters, 4, MaximumInstances); ByteWriter.WriteByte(parameters, 5, CurrentInstances); ByteWriter.WriteByte(parameters, 6, PipeNameLength); - SMBHelper.WriteSMBString(parameters, 8, isUnicode, PipeName); + SMB1Helper.WriteSMBString(parameters, 8, isUnicode, PipeName); return parameters; ; } diff --git a/SMBLibrary/SMBLibrary.csproj b/SMBLibrary/SMBLibrary.csproj index d4600dd..131142f 100644 --- a/SMBLibrary/SMBLibrary.csproj +++ b/SMBLibrary/SMBLibrary.csproj @@ -275,7 +275,7 @@ - + diff --git a/SMBLibrary/Server/ResponseHelpers/FileSystemResponseHelper.cs b/SMBLibrary/Server/ResponseHelpers/FileSystemResponseHelper.cs index 12a09d5..27e9437 100644 --- a/SMBLibrary/Server/ResponseHelpers/FileSystemResponseHelper.cs +++ b/SMBLibrary/Server/ResponseHelpers/FileSystemResponseHelper.cs @@ -241,7 +241,7 @@ namespace SMBLibrary.Server } fileSystem.SetAttributes(request.FileName, isHidden, isReadOnly, isArchived); - if (request.LastWriteTime != SMBHelper.UTimeNotSpecified) + if (request.LastWriteTime != SMB1Helper.UTimeNotSpecified) { fileSystem.SetDates(request.FileName, null, request.LastWriteTime, null); } diff --git a/SMBLibrary/Server/ResponseHelpers/Transaction2SubcommandHelper.cs b/SMBLibrary/Server/ResponseHelpers/Transaction2SubcommandHelper.cs index a50a74e..56b0fa7 100644 --- a/SMBLibrary/Server/ResponseHelpers/Transaction2SubcommandHelper.cs +++ b/SMBLibrary/Server/ResponseHelpers/Transaction2SubcommandHelper.cs @@ -326,15 +326,15 @@ namespace SMBLibrary.Server DateTime? creationTime = null; DateTime? lastWriteDT = null; DateTime? lastAccessTime = null; - if (info.CreationTime != SMBHelper.FileTimeNotSpecified) + if (info.CreationTime != SMB1Helper.FileTimeNotSpecified) { creationTime = info.CreationTime; } - if (info.LastWriteTime != SMBHelper.FileTimeNotSpecified) + if (info.LastWriteTime != SMB1Helper.FileTimeNotSpecified) { lastWriteDT = info.LastWriteTime; } - if (info.LastAccessTime != SMBHelper.FileTimeNotSpecified) + if (info.LastAccessTime != SMB1Helper.FileTimeNotSpecified) { lastAccessTime = info.LastAccessTime; }