SMB1: SMB_COM_QUERY_INFORMATION Response: Bugfix: LastWriteTime is UTime

This commit is contained in:
Tal Aloni 2017-02-10 01:36:34 +02:00
parent 4be937e7c1
commit dabc3260be

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
*
* You can redistribute this program and/or modify it under the terms of
* the GNU Lesser Public License as published by the Free Software Foundation,
@ -12,7 +12,7 @@ using Utilities;
namespace SMBLibrary.SMB1
{
/// <summary>
/// SMB_COM_QUERY_INFORMATION Request.
/// SMB_COM_QUERY_INFORMATION Response.
/// This command is deprecated.
/// This command is used by Windows NT4 SP6.
/// </summary>
@ -21,7 +21,7 @@ namespace SMBLibrary.SMB1
public const int ParameterLength = 20;
// Parameters:
public SMBFileAttributes FileAttributes;
public DateTime LastWriteTime;
public DateTime? LastWriteTime;
public uint FileSize;
public byte[] Reserved; // 10 bytes
@ -33,7 +33,7 @@ namespace SMBLibrary.SMB1
public QueryInformationResponse(byte[] buffer, int offset) : base(buffer, offset, false)
{
FileAttributes = (SMBFileAttributes)LittleEndianConverter.ToUInt16(this.SMBParameters, 0);
LastWriteTime = SMB1Helper.ReadSMBDateTime(this.SMBParameters, 2);
LastWriteTime = UTimeHelper.ReadNullableUTime(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);
SMB1Helper.WriteSMBDateTime(this.SMBParameters, 2, LastWriteTime);
UTimeHelper.WriteUTime(this.SMBParameters, 2, LastWriteTime);
LittleEndianWriter.WriteUInt32(this.SMBParameters, 6, FileSize);
ByteWriter.WriteBytes(this.SMBParameters, 10, Reserved, 10);