diff --git a/SMBLibrary/NTFileStore/Structures/IOCtl/PipeWaitRequest.cs b/SMBLibrary/NTFileStore/Structures/IOCtl/PipeWaitRequest.cs new file mode 100644 index 0000000..01ed274 --- /dev/null +++ b/SMBLibrary/NTFileStore/Structures/IOCtl/PipeWaitRequest.cs @@ -0,0 +1,58 @@ +/* Copyright (C) 2017 Tal Aloni . All rights reserved. + * + * You can redistribute this program and/or modify it under the terms of + * the GNU Lesser Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + */ +using System; +using System.Collections.Generic; +using Utilities; + +namespace SMBLibrary +{ + /// + /// [MS-FSCC] 2.3.31 - FSCTL_PIPE_WAIT Request + /// + public class PipeWaitRequest + { + public const int FixedLength = 14; + + public ulong Timeout; + private uint NameLength; + public bool TimeSpecified; + public byte Padding; + public string Name; + + public PipeWaitRequest() + { + } + + public PipeWaitRequest(byte[] buffer, int offset) + { + Timeout = LittleEndianConverter.ToUInt64(buffer, offset + 0); + NameLength = LittleEndianConverter.ToUInt32(buffer, offset + 8); + TimeSpecified = Convert.ToBoolean(ByteReader.ReadByte(buffer, offset + 12)); + Padding = ByteReader.ReadByte(buffer, offset + 13); + Name = ByteReader.ReadUTF16String(buffer, offset + 14, (int)(NameLength / 2)); + } + + public byte[] GetBytes() + { + byte[] buffer = new byte[this.Length]; + LittleEndianWriter.WriteUInt64(buffer, 0, Timeout); + LittleEndianWriter.WriteUInt32(buffer, 8, (uint)(Name.Length * 2)); + ByteWriter.WriteByte(buffer, 12, Convert.ToByte(TimeSpecified)); + ByteWriter.WriteByte(buffer, 13, Padding); + ByteWriter.WriteUTF16String(buffer, 14, Name); + return buffer; + } + + public int Length + { + get + { + return FixedLength + Name.Length * 2; + } + } + } +} diff --git a/SMBLibrary/SMBLibrary.csproj b/SMBLibrary/SMBLibrary.csproj index 22bd3f1..1755bff 100644 --- a/SMBLibrary/SMBLibrary.csproj +++ b/SMBLibrary/SMBLibrary.csproj @@ -158,6 +158,7 @@ +