Added FSCTL_PIPE_WAIT Request implementation

This commit is contained in:
Tal Aloni 2017-08-30 12:21:55 +03:00
parent fd2e6cf517
commit 8e5de68f78
2 changed files with 59 additions and 0 deletions

View file

@ -0,0 +1,58 @@
/* Copyright (C) 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,
* either version 3 of the License, or (at your option) any later version.
*/
using System;
using System.Collections.Generic;
using Utilities;
namespace SMBLibrary
{
/// <summary>
/// [MS-FSCC] 2.3.31 - FSCTL_PIPE_WAIT Request
/// </summary>
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;
}
}
}
}

View file

@ -158,6 +158,7 @@
<Compile Include="NTFileStore\Structures\FileSystemInformation\FileFsSizeInformation.cs" />
<Compile Include="NTFileStore\Structures\FileSystemInformation\FileFsVolumeInformation.cs" />
<Compile Include="NTFileStore\Structures\FileSystemInformation\FileSystemInformation.cs" />
<Compile Include="NTFileStore\Structures\IOCtl\PipeWaitRequest.cs" />
<Compile Include="NTFileStore\Structures\ObjectIDBufferType1.cs" />
<Compile Include="NTFileStore\Structures\SecurityDescriptor.cs" />
<Compile Include="NTFileStore\Structures\SID.cs" />