mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-14 13:25:03 +02:00
NDRParser / NDRWriter: Added ability to read/write arbitrary number of bytes
This commit is contained in:
parent
28549bb6ac
commit
eda6f4c2dd
2 changed files with 12 additions and 2 deletions
|
@ -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
|
* 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,
|
* 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;
|
m_offset += (4 - (m_offset % 4)) % 4;
|
||||||
return LittleEndianReader.ReadUInt32(m_buffer, ref m_offset);
|
return LittleEndianReader.ReadUInt32(m_buffer, ref m_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte[] ReadBytes(int count)
|
||||||
|
{
|
||||||
|
return ByteReader.ReadBytes(m_buffer, ref m_offset, count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* 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,
|
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||||
|
@ -121,6 +121,11 @@ namespace SMBLibrary.RPC
|
||||||
LittleEndianWriter.WriteUInt32(m_stream, value);
|
LittleEndianWriter.WriteUInt32(m_stream, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void WriteBytes(byte[] value)
|
||||||
|
{
|
||||||
|
ByteWriter.WriteBytes(m_stream, value);
|
||||||
|
}
|
||||||
|
|
||||||
public byte[] GetBytes()
|
public byte[] GetBytes()
|
||||||
{
|
{
|
||||||
byte[] buffer = new byte[m_stream.Length];
|
byte[] buffer = new byte[m_stream.Length];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue