QueryFileAllInfo: Renamed members

This commit is contained in:
Tal Aloni 2017-10-08 20:02:51 +03:00
parent 03e2621fb0
commit 5b78f7ec93
2 changed files with 17 additions and 18 deletions

View file

@ -80,16 +80,16 @@ namespace SMBLibrary.SMB1
{ {
FileAllInformation fileAllInfo = (FileAllInformation)fileInformation; FileAllInformation fileAllInfo = (FileAllInformation)fileInformation;
QueryFileAllInfo result = new QueryFileAllInfo(); QueryFileAllInfo result = new QueryFileAllInfo();
result.CreationDateTime = fileAllInfo.BasicInformation.CreationTime; result.CreationTime = fileAllInfo.BasicInformation.CreationTime;
result.LastAccessDateTime = fileAllInfo.BasicInformation.LastAccessTime; result.LastAccessTime = fileAllInfo.BasicInformation.LastAccessTime;
result.LastWriteDateTime = fileAllInfo.BasicInformation.LastWriteTime; result.LastWriteTime = fileAllInfo.BasicInformation.LastWriteTime;
result.LastChangeTime = fileAllInfo.BasicInformation.ChangeTime; result.LastChangeTime = fileAllInfo.BasicInformation.ChangeTime;
result.ExtFileAttributes = (ExtendedFileAttributes)fileAllInfo.BasicInformation.FileAttributes; result.ExtFileAttributes = (ExtendedFileAttributes)fileAllInfo.BasicInformation.FileAttributes;
result.AllocationSize = fileAllInfo.StandardInformation.AllocationSize; result.AllocationSize = fileAllInfo.StandardInformation.AllocationSize;
result.EndOfFile = fileAllInfo.StandardInformation.EndOfFile; result.EndOfFile = fileAllInfo.StandardInformation.EndOfFile;
result.DeletePending = fileAllInfo.StandardInformation.DeletePending; result.DeletePending = fileAllInfo.StandardInformation.DeletePending;
result.Directory = fileAllInfo.StandardInformation.Directory; result.Directory = fileAllInfo.StandardInformation.Directory;
result.EASize = fileAllInfo.EaInformation.EaSize; result.EaSize = fileAllInfo.EaInformation.EaSize;
result.FileName = fileAllInfo.NameInformation.FileName; result.FileName = fileAllInfo.NameInformation.FileName;
return result; return result;
} }

View file

@ -6,7 +6,6 @@
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using Utilities; using Utilities;
namespace SMBLibrary.SMB1 namespace SMBLibrary.SMB1
@ -18,9 +17,9 @@ namespace SMBLibrary.SMB1
{ {
public const int FixedLength = 72; public const int FixedLength = 72;
public DateTime? CreationDateTime; public DateTime? CreationTime;
public DateTime? LastAccessDateTime; public DateTime? LastAccessTime;
public DateTime? LastWriteDateTime; public DateTime? LastWriteTime;
public DateTime? LastChangeTime; public DateTime? LastChangeTime;
public ExtendedFileAttributes ExtFileAttributes; public ExtendedFileAttributes ExtFileAttributes;
public uint Reserved1; public uint Reserved1;
@ -30,8 +29,8 @@ namespace SMBLibrary.SMB1
public bool DeletePending; public bool DeletePending;
public bool Directory; public bool Directory;
public ushort Reserved2; public ushort Reserved2;
public uint EASize; public uint EaSize;
//uint FileNameLength; // In bytes // uint FileNameLength; // In bytes
public string FileName; // Unicode public string FileName; // Unicode
public QueryFileAllInfo() public QueryFileAllInfo()
@ -40,9 +39,9 @@ namespace SMBLibrary.SMB1
public QueryFileAllInfo(byte[] buffer, int offset) public QueryFileAllInfo(byte[] buffer, int offset)
{ {
CreationDateTime = FileTimeHelper.ReadNullableFileTime(buffer, ref offset); CreationTime = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
LastAccessDateTime = FileTimeHelper.ReadNullableFileTime(buffer, ref offset); LastAccessTime = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
LastWriteDateTime = FileTimeHelper.ReadNullableFileTime(buffer, ref offset); LastWriteTime = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
LastChangeTime = FileTimeHelper.ReadNullableFileTime(buffer, ref offset); LastChangeTime = FileTimeHelper.ReadNullableFileTime(buffer, ref offset);
ExtFileAttributes = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(buffer, ref offset); ExtFileAttributes = (ExtendedFileAttributes)LittleEndianReader.ReadUInt32(buffer, ref offset);
Reserved1 = LittleEndianReader.ReadUInt32(buffer, ref offset); Reserved1 = LittleEndianReader.ReadUInt32(buffer, ref offset);
@ -52,7 +51,7 @@ namespace SMBLibrary.SMB1
DeletePending = (ByteReader.ReadByte(buffer, ref offset) > 0); DeletePending = (ByteReader.ReadByte(buffer, ref offset) > 0);
Directory = (ByteReader.ReadByte(buffer, ref offset) > 0); Directory = (ByteReader.ReadByte(buffer, ref offset) > 0);
Reserved2 = LittleEndianReader.ReadUInt16(buffer, ref offset); Reserved2 = LittleEndianReader.ReadUInt16(buffer, ref offset);
EASize = LittleEndianReader.ReadUInt32(buffer, ref offset); EaSize = LittleEndianReader.ReadUInt32(buffer, ref offset);
uint fileNameLength = LittleEndianReader.ReadUInt32(buffer, ref offset); uint fileNameLength = LittleEndianReader.ReadUInt32(buffer, ref offset);
FileName = ByteReader.ReadUTF16String(buffer, ref offset, (int)(fileNameLength / 2)); FileName = ByteReader.ReadUTF16String(buffer, ref offset, (int)(fileNameLength / 2));
} }
@ -62,9 +61,9 @@ namespace SMBLibrary.SMB1
uint fileNameLength = (uint)(FileName.Length * 2); uint fileNameLength = (uint)(FileName.Length * 2);
byte[] buffer = new byte[FixedLength + fileNameLength]; byte[] buffer = new byte[FixedLength + fileNameLength];
int offset = 0; int offset = 0;
FileTimeHelper.WriteFileTime(buffer, ref offset, CreationDateTime); FileTimeHelper.WriteFileTime(buffer, ref offset, CreationTime);
FileTimeHelper.WriteFileTime(buffer, ref offset, LastAccessDateTime); FileTimeHelper.WriteFileTime(buffer, ref offset, LastAccessTime);
FileTimeHelper.WriteFileTime(buffer, ref offset, LastWriteDateTime); FileTimeHelper.WriteFileTime(buffer, ref offset, LastWriteTime);
FileTimeHelper.WriteFileTime(buffer, ref offset, LastChangeTime); FileTimeHelper.WriteFileTime(buffer, ref offset, LastChangeTime);
LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)ExtFileAttributes); LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)ExtFileAttributes);
LittleEndianWriter.WriteUInt32(buffer, ref offset, Reserved1); LittleEndianWriter.WriteUInt32(buffer, ref offset, Reserved1);
@ -74,7 +73,7 @@ namespace SMBLibrary.SMB1
ByteWriter.WriteByte(buffer, ref offset, Convert.ToByte(DeletePending)); ByteWriter.WriteByte(buffer, ref offset, Convert.ToByte(DeletePending));
ByteWriter.WriteByte(buffer, ref offset, Convert.ToByte(Directory)); ByteWriter.WriteByte(buffer, ref offset, Convert.ToByte(Directory));
LittleEndianWriter.WriteUInt16(buffer, ref offset, Reserved2); LittleEndianWriter.WriteUInt16(buffer, ref offset, Reserved2);
LittleEndianWriter.WriteUInt32(buffer, ref offset, EASize); LittleEndianWriter.WriteUInt32(buffer, ref offset, EaSize);
LittleEndianWriter.WriteUInt32(buffer, ref offset, fileNameLength); LittleEndianWriter.WriteUInt32(buffer, ref offset, fileNameLength);
ByteWriter.WriteUTF16String(buffer, ref offset, FileName); ByteWriter.WriteUTF16String(buffer, ref offset, FileName);
return buffer; return buffer;