mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-19 15:45:54 +02:00
SMB1: Added implementation of TRANS2_SET_FS_INFORMATION request and response
This commit is contained in:
parent
10882b2493
commit
d7a16a5217
5 changed files with 101 additions and 0 deletions
|
@ -0,0 +1,63 @@
|
|||
/* 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.SMB1
|
||||
{
|
||||
/// <summary>
|
||||
/// TRANS2_SET_FS_INFORMATION Request
|
||||
/// </summary>
|
||||
public class Transaction2SetFSInformationRequest : Transaction2Subcommand
|
||||
{
|
||||
public const int ParametersLength = 4;
|
||||
// Parameters:
|
||||
public ushort FID;
|
||||
public ushort InformationLevel; // This field MUST be a pass-through Information Level.
|
||||
// Data:
|
||||
public byte[] InformationBytes;
|
||||
|
||||
public Transaction2SetFSInformationRequest() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public Transaction2SetFSInformationRequest(byte[] parameters, byte[] data, bool isUnicode) : base()
|
||||
{
|
||||
FID = LittleEndianConverter.ToUInt16(parameters, 0);
|
||||
InformationLevel = LittleEndianConverter.ToUInt16(parameters, 2);
|
||||
|
||||
InformationBytes = data;
|
||||
}
|
||||
|
||||
public override byte[] GetSetup()
|
||||
{
|
||||
return LittleEndianConverter.GetBytes((ushort)SubcommandName);
|
||||
}
|
||||
|
||||
public override byte[] GetParameters(bool isUnicode)
|
||||
{
|
||||
byte[] parameters = new byte[ParametersLength];
|
||||
LittleEndianWriter.WriteUInt16(parameters, 0, FID);
|
||||
LittleEndianWriter.WriteUInt16(parameters, 2, InformationLevel);
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public override byte[] GetData(bool isUnicode)
|
||||
{
|
||||
return InformationBytes;
|
||||
}
|
||||
|
||||
public override Transaction2SubcommandName SubcommandName
|
||||
{
|
||||
get
|
||||
{
|
||||
return Transaction2SubcommandName.TRANS2_SET_FS_INFORMATION;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/* 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.SMB1
|
||||
{
|
||||
/// <summary>
|
||||
/// TRANS2_SET_FS_INFORMATION Response
|
||||
/// </summary>
|
||||
public class Transaction2SetFSInformationResponse : Transaction2Subcommand
|
||||
{
|
||||
public Transaction2SetFSInformationResponse() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public override Transaction2SubcommandName SubcommandName
|
||||
{
|
||||
get
|
||||
{
|
||||
return Transaction2SubcommandName.TRANS2_SET_FS_INFORMATION;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -52,6 +52,8 @@ namespace SMBLibrary.SMB1
|
|||
return new Transaction2FindNext2Request(parameters, data, isUnicode);
|
||||
case Transaction2SubcommandName.TRANS2_QUERY_FS_INFORMATION:
|
||||
return new Transaction2QueryFSInformationRequest(parameters, data, isUnicode);
|
||||
case Transaction2SubcommandName.TRANS2_SET_FS_INFORMATION:
|
||||
return new Transaction2SetFSInformationRequest(parameters, data, isUnicode);
|
||||
case Transaction2SubcommandName.TRANS2_QUERY_PATH_INFORMATION:
|
||||
return new Transaction2QueryPathInformationRequest(parameters, data, isUnicode);
|
||||
case Transaction2SubcommandName.TRANS2_SET_PATH_INFORMATION:
|
||||
|
|
|
@ -446,6 +446,8 @@
|
|||
<Compile Include="SMB1\Transaction2Subcommands\Transaction2QueryPathInformationResponse.cs" />
|
||||
<Compile Include="SMB1\Transaction2Subcommands\Transaction2SetFileInformationRequest.cs" />
|
||||
<Compile Include="SMB1\Transaction2Subcommands\Transaction2SetFileInformationResponse.cs" />
|
||||
<Compile Include="SMB1\Transaction2Subcommands\Transaction2SetFSInformationRequest.cs" />
|
||||
<Compile Include="SMB1\Transaction2Subcommands\Transaction2SetFSInformationResponse.cs" />
|
||||
<Compile Include="SMB1\Transaction2Subcommands\Transaction2SetPathInformationRequest.cs" />
|
||||
<Compile Include="SMB1\Transaction2Subcommands\Transaction2SetPathInformationResponse.cs" />
|
||||
<Compile Include="SMB1\Transaction2Subcommands\Transaction2Subcommand.cs" />
|
||||
|
|
|
@ -208,6 +208,10 @@ namespace SMBLibrary.Server.SMB1
|
|||
{
|
||||
subcommandResponse = Transaction2SubcommandHelper.GetSubcommandResponse(header, (Transaction2QueryFSInformationRequest)subcommand, share, state);
|
||||
}
|
||||
else if (subcommand is Transaction2SetFSInformationRequest)
|
||||
{
|
||||
header.Status = NTStatus.STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
else if (subcommand is Transaction2QueryPathInformationRequest)
|
||||
{
|
||||
subcommandResponse = Transaction2SubcommandHelper.GetSubcommandResponse(header, (Transaction2QueryPathInformationRequest)subcommand, share, state);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue