mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-08-02 14:01:50 +02:00
TransactionQueryNamedPipeInfoResponse: Corrected implementation
This commit is contained in:
parent
b8eae1a400
commit
51697529bf
18 changed files with 56 additions and 55 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -460,8 +460,8 @@ namespace SMBLibrary.Client
|
|||
|
||||
TransactionRequest request = new TransactionRequest();
|
||||
request.Setup = subcommand.GetSetup();
|
||||
request.TransParameters = subcommand.GetParameters(m_client.Unicode);
|
||||
request.TransData = subcommand.GetData();
|
||||
request.TransParameters = subcommand.GetParameters();
|
||||
request.TransData = subcommand.GetData(m_client.Unicode);
|
||||
request.TotalDataCount = (ushort)request.TransData.Length;
|
||||
request.TotalParameterCount = (ushort)request.TransParameters.Length;
|
||||
request.MaxParameterCount = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -40,7 +40,7 @@ namespace SMBLibrary.SMB1
|
|||
return setup;
|
||||
}
|
||||
|
||||
public override byte[] GetData()
|
||||
public override byte[] GetData(bool isUnicode)
|
||||
{
|
||||
return WriteData;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -28,7 +28,7 @@ namespace SMBLibrary.SMB1
|
|||
ReadData = data;
|
||||
}
|
||||
|
||||
public override byte[] GetData()
|
||||
public override byte[] GetData(bool isUnicode)
|
||||
{
|
||||
return ReadData;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -36,7 +36,7 @@ namespace SMBLibrary.SMB1
|
|||
ReadData = data;
|
||||
}
|
||||
|
||||
public override byte[] GetParameters(bool isUnicode)
|
||||
public override byte[] GetParameters()
|
||||
{
|
||||
byte[] parameters = new byte[ParametersLength];
|
||||
LittleEndianWriter.WriteUInt16(parameters, 0, ReadDataAvailable);
|
||||
|
@ -45,7 +45,7 @@ namespace SMBLibrary.SMB1
|
|||
return parameters;
|
||||
}
|
||||
|
||||
public override byte[] GetData()
|
||||
public override byte[] GetData(bool isUnicode)
|
||||
{
|
||||
return ReadData;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -40,7 +40,7 @@ namespace SMBLibrary.SMB1
|
|||
return setup;
|
||||
}
|
||||
|
||||
public override byte[] GetParameters(bool isUnicode)
|
||||
public override byte[] GetParameters()
|
||||
{
|
||||
return LittleEndianConverter.GetBytes(Level);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -16,7 +16,8 @@ namespace SMBLibrary.SMB1
|
|||
/// </summary>
|
||||
public class TransactionQueryNamedPipeInfoResponse : TransactionSubcommand
|
||||
{
|
||||
// Parameters:
|
||||
public const int ParametersLength = 0;
|
||||
// Data:
|
||||
public ushort OutputBufferSize;
|
||||
public ushort InputBufferSize;
|
||||
public byte MaximumInstances;
|
||||
|
@ -27,18 +28,18 @@ namespace SMBLibrary.SMB1
|
|||
public TransactionQueryNamedPipeInfoResponse() : base()
|
||||
{}
|
||||
|
||||
public TransactionQueryNamedPipeInfoResponse(byte[] parameters, bool isUnicode) : base()
|
||||
public TransactionQueryNamedPipeInfoResponse(byte[] data, bool isUnicode) : base()
|
||||
{
|
||||
OutputBufferSize = LittleEndianConverter.ToUInt16(parameters, 0);
|
||||
InputBufferSize = LittleEndianConverter.ToUInt16(parameters, 2);
|
||||
MaximumInstances = ByteReader.ReadByte(parameters, 4);
|
||||
CurrentInstances = ByteReader.ReadByte(parameters, 5);
|
||||
PipeNameLength = ByteReader.ReadByte(parameters, 6);
|
||||
OutputBufferSize = LittleEndianConverter.ToUInt16(data, 0);
|
||||
InputBufferSize = LittleEndianConverter.ToUInt16(data, 2);
|
||||
MaximumInstances = ByteReader.ReadByte(data, 4);
|
||||
CurrentInstances = ByteReader.ReadByte(data, 5);
|
||||
PipeNameLength = ByteReader.ReadByte(data, 6);
|
||||
// Note: Trans_Parameters is aligned to 4 byte boundary
|
||||
PipeName = SMB1Helper.ReadSMBString(parameters, 8, isUnicode);
|
||||
PipeName = SMB1Helper.ReadSMBString(data, 8, isUnicode);
|
||||
}
|
||||
|
||||
public override byte[] GetParameters(bool isUnicode)
|
||||
public override byte[] GetData(bool isUnicode)
|
||||
{
|
||||
int length = 8;
|
||||
if (isUnicode)
|
||||
|
@ -49,14 +50,14 @@ namespace SMBLibrary.SMB1
|
|||
{
|
||||
length += PipeName.Length + 1;
|
||||
}
|
||||
byte[] parameters = new byte[length];
|
||||
LittleEndianWriter.WriteUInt16(parameters, 0, OutputBufferSize);
|
||||
LittleEndianWriter.WriteUInt16(parameters, 2, InputBufferSize);
|
||||
ByteWriter.WriteByte(parameters, 4, MaximumInstances);
|
||||
ByteWriter.WriteByte(parameters, 5, CurrentInstances);
|
||||
ByteWriter.WriteByte(parameters, 6, PipeNameLength);
|
||||
SMB1Helper.WriteSMBString(parameters, 8, isUnicode, PipeName);
|
||||
return parameters; ;
|
||||
byte[] data = new byte[length];
|
||||
LittleEndianWriter.WriteUInt16(data, 0, OutputBufferSize);
|
||||
LittleEndianWriter.WriteUInt16(data, 2, InputBufferSize);
|
||||
ByteWriter.WriteByte(data, 4, MaximumInstances);
|
||||
ByteWriter.WriteByte(data, 5, CurrentInstances);
|
||||
ByteWriter.WriteByte(data, 6, PipeNameLength);
|
||||
SMB1Helper.WriteSMBString(data, 8, isUnicode, PipeName);
|
||||
return data;
|
||||
}
|
||||
|
||||
public override TransactionSubcommandName SubcommandName
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace SMBLibrary.SMB1
|
|||
return new byte[0];
|
||||
}
|
||||
|
||||
public override byte[] GetParameters(bool isUnicode)
|
||||
public override byte[] GetParameters()
|
||||
{
|
||||
byte[] parameters = new byte[2];
|
||||
NMPipeStatus.WriteBytes(parameters, 0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -29,7 +29,7 @@ namespace SMBLibrary.SMB1
|
|||
BytesRead = data;
|
||||
}
|
||||
|
||||
public override byte[] GetData()
|
||||
public override byte[] GetData(bool isUnicode)
|
||||
{
|
||||
return BytesRead;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -40,7 +40,7 @@ namespace SMBLibrary.SMB1
|
|||
return setup;
|
||||
}
|
||||
|
||||
public override byte[] GetData()
|
||||
public override byte[] GetData(bool isUnicode)
|
||||
{
|
||||
return WriteData;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -29,7 +29,7 @@ namespace SMBLibrary.SMB1
|
|||
BytesWritten = LittleEndianConverter.ToUInt16(parameters, 0);
|
||||
}
|
||||
|
||||
public override byte[] GetParameters(bool isUnicode)
|
||||
public override byte[] GetParameters()
|
||||
{
|
||||
return LittleEndianConverter.GetBytes(BytesWritten);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -29,7 +29,7 @@ namespace SMBLibrary.SMB1
|
|||
ReadData = data;
|
||||
}
|
||||
|
||||
public override byte[] GetData()
|
||||
public override byte[] GetData(bool isUnicode)
|
||||
{
|
||||
return ReadData;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -40,7 +40,7 @@ namespace SMBLibrary.SMB1
|
|||
return setup;
|
||||
}
|
||||
|
||||
public override byte[] GetParameters(bool isUnicode)
|
||||
public override byte[] GetParameters()
|
||||
{
|
||||
return LittleEndianConverter.GetBytes((ushort)PipeState);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -22,12 +22,12 @@ namespace SMBLibrary.SMB1
|
|||
return new byte[0];
|
||||
}
|
||||
|
||||
public virtual byte[] GetParameters(bool isUnicode)
|
||||
public virtual byte[] GetParameters()
|
||||
{
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
public virtual byte[] GetData()
|
||||
public virtual byte[] GetData(bool isUnicode)
|
||||
{
|
||||
return new byte[0];
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -39,7 +39,7 @@ namespace SMBLibrary.SMB1
|
|||
return setup;
|
||||
}
|
||||
|
||||
public override byte[] GetData()
|
||||
public override byte[] GetData(bool isUnicode)
|
||||
{
|
||||
return WriteData;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -29,7 +29,7 @@ namespace SMBLibrary.SMB1
|
|||
ReadData = data;
|
||||
}
|
||||
|
||||
public override byte[] GetData()
|
||||
public override byte[] GetData(bool isUnicode)
|
||||
{
|
||||
return ReadData;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -40,7 +40,7 @@ namespace SMBLibrary.SMB1
|
|||
return setup;
|
||||
}
|
||||
|
||||
public override byte[] GetData()
|
||||
public override byte[] GetData(bool isUnicode)
|
||||
{
|
||||
return WriteData;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -28,7 +28,7 @@ namespace SMBLibrary.SMB1
|
|||
BytesWritten = LittleEndianConverter.ToUInt16(parameters, 0);
|
||||
}
|
||||
|
||||
public override byte[] GetParameters(bool isUnicode)
|
||||
public override byte[] GetParameters()
|
||||
{
|
||||
return LittleEndianConverter.GetBytes(BytesWritten);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||
/* Copyright (C) 2014-2019 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,
|
||||
|
@ -176,8 +176,8 @@ namespace SMBLibrary.Server.SMB1
|
|||
}
|
||||
|
||||
byte[] responseSetup = subcommandResponse.GetSetup();
|
||||
byte[] responseParameters = subcommandResponse.GetParameters(header.UnicodeFlag);
|
||||
byte[] responseData = subcommandResponse.GetData();
|
||||
byte[] responseParameters = subcommandResponse.GetParameters();
|
||||
byte[] responseData = subcommandResponse.GetData(header.UnicodeFlag);
|
||||
return GetTransactionResponse(false, responseSetup, responseParameters, responseData, state.MaxBufferSize);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue