NDRParser / NDRWriter: Added ability to read/write arbitrary number of bytes

This commit is contained in:
TalAloni 2021-01-11 23:06:31 +02:00
parent 28549bb6ac
commit eda6f4c2dd
2 changed files with 12 additions and 2 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
/* Copyright (C) 2014-2020 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,
@ -135,5 +135,10 @@ namespace SMBLibrary.RPC
m_offset += (4 - (m_offset % 4)) % 4;
return LittleEndianReader.ReadUInt32(m_buffer, ref m_offset);
}
public byte[] ReadBytes(int count)
{
return ByteReader.ReadBytes(m_buffer, ref m_offset, count);
}
}
}

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
/* Copyright (C) 2014-2020 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,
@ -121,6 +121,11 @@ namespace SMBLibrary.RPC
LittleEndianWriter.WriteUInt32(m_stream, value);
}
public void WriteBytes(byte[] value)
{
ByteWriter.WriteBytes(m_stream, value);
}
public byte[] GetBytes()
{
byte[] buffer = new byte[m_stream.Length];