mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-21 02:46:10 +00:00
147 lines
3.6 KiB
C#
147 lines
3.6 KiB
C#
|
// Decompiled with JetBrains decompiler
|
|||
|
// Type: Microsoft.InfoCards.InfoCardBinaryReader
|
|||
|
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
|
|||
|
// MVID: ADE0A079-11DB-4A46-8BDE-D2A592CA8DEA
|
|||
|
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Virus.Win32.Expiro.w-67b630ead60119692b9abbdfd8717c96904ef041127c2cae033c86b718eaa61e.exe
|
|||
|
|
|||
|
using Microsoft.InfoCards.Diagnostics;
|
|||
|
using System;
|
|||
|
using System.IO;
|
|||
|
using System.Runtime.InteropServices;
|
|||
|
using System.Text;
|
|||
|
|
|||
|
namespace Microsoft.InfoCards
|
|||
|
{
|
|||
|
internal sealed class InfoCardBinaryReader : BinaryReader
|
|||
|
{
|
|||
|
private static readonly char[] s_singleChar = new char[1]
|
|||
|
{
|
|||
|
'a'
|
|||
|
};
|
|||
|
private int m_charSize;
|
|||
|
|
|||
|
public InfoCardBinaryReader(Stream stream, Encoding encoding)
|
|||
|
: base(stream, encoding)
|
|||
|
{
|
|||
|
this.m_charSize = encoding.GetByteCount(InfoCardBinaryReader.s_singleChar);
|
|||
|
}
|
|||
|
|
|||
|
public InfoCardBinaryReader(Stream stream)
|
|||
|
: this(stream, Encoding.Unicode)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public override int Read()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds(1L);
|
|||
|
return base.Read();
|
|||
|
}
|
|||
|
|
|||
|
public override int Read(byte[] buffer, int index, int count) => base.Read(buffer, index, count);
|
|||
|
|
|||
|
public override int Read(char[] buffer, int index, int count) => base.Read(buffer, index, count);
|
|||
|
|
|||
|
public override bool ReadBoolean()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds(1L);
|
|||
|
return base.ReadBoolean();
|
|||
|
}
|
|||
|
|
|||
|
public override byte ReadByte()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds(1L);
|
|||
|
return base.ReadByte();
|
|||
|
}
|
|||
|
|
|||
|
public override byte[] ReadBytes(int count)
|
|||
|
{
|
|||
|
this.EnsureBufferBounds((long) count);
|
|||
|
return base.ReadBytes(count);
|
|||
|
}
|
|||
|
|
|||
|
public override char ReadChar()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds((long) this.m_charSize);
|
|||
|
return base.ReadChar();
|
|||
|
}
|
|||
|
|
|||
|
public override char[] ReadChars(int count)
|
|||
|
{
|
|||
|
this.EnsureBufferBounds(Convert.ToInt64(this.m_charSize * count));
|
|||
|
return base.ReadChars(count);
|
|||
|
}
|
|||
|
|
|||
|
public override Decimal ReadDecimal()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds(Convert.ToInt64(Marshal.SizeOf(typeof (Decimal))));
|
|||
|
return base.ReadDecimal();
|
|||
|
}
|
|||
|
|
|||
|
public override double ReadDouble()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds(8L);
|
|||
|
return base.ReadDouble();
|
|||
|
}
|
|||
|
|
|||
|
public override short ReadInt16()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds(2L);
|
|||
|
return base.ReadInt16();
|
|||
|
}
|
|||
|
|
|||
|
public override int ReadInt32()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds(4L);
|
|||
|
return base.ReadInt32();
|
|||
|
}
|
|||
|
|
|||
|
public override long ReadInt64()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds(8L);
|
|||
|
return base.ReadInt64();
|
|||
|
}
|
|||
|
|
|||
|
public override sbyte ReadSByte()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds(1L);
|
|||
|
return base.ReadSByte();
|
|||
|
}
|
|||
|
|
|||
|
public override float ReadSingle()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds(4L);
|
|||
|
return base.ReadSingle();
|
|||
|
}
|
|||
|
|
|||
|
public override string ReadString()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds((long) (this.m_charSize * this.PeekChar() + 4));
|
|||
|
return base.ReadString();
|
|||
|
}
|
|||
|
|
|||
|
public override ushort ReadUInt16()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds(4L);
|
|||
|
return base.ReadUInt16();
|
|||
|
}
|
|||
|
|
|||
|
public override uint ReadUInt32()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds(4L);
|
|||
|
return base.ReadUInt32();
|
|||
|
}
|
|||
|
|
|||
|
public override ulong ReadUInt64()
|
|||
|
{
|
|||
|
this.EnsureBufferBounds(8L);
|
|||
|
return base.ReadUInt64();
|
|||
|
}
|
|||
|
|
|||
|
private void EnsureBufferBounds(long offset)
|
|||
|
{
|
|||
|
if ((ulong) (this.BaseStream.Position + offset) > (ulong) this.BaseStream.Length)
|
|||
|
throw InfoCardTrace.ThrowHelperError((Exception) new InfoCardArgumentException(SR.GetString("InvalidOrCorruptArgumentStream")));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|