avatar_Барклай

Как раскодировать *.enc файлы игр

Автор Барклай, 2010 Окт. 25, 12:41

« назад - далее »

0 Пользователи и 1 гость просматривают эту тему.

Ключевые слова [SEO] delphicabal онлайнартемид

Барклай

const
Xorkey: array
  • of Byte = ($92, $65, $67, $57);


Спойлер
procedure DecompressFile(const SourceFile, DestFile: string);
var
SourceStream: TStream;
ZLibStream: TStream;
DestStream: TStream;
DecSize: Cardinal;
Ms: TStream;
i: Integer;
Data: TBytes;
MsOut: TStream;
begin
SourceStream := TFileStream.Create(SourceFile, fmOpenRead);
Ms := TMemoryStream.Create;
MsOut := TMemoryStream.Create;

Ms.CopyFrom(SourceStream, SourceStream.Size);
Ms.Position := 0;

SetLength(Data, Ms.Size);
Ms.Read(Data
  • , Ms.Size);
DecSize := PDword(@Data
  • )^;

for i := 0 to 3 do
Data[i + 4] := Data[i + 4] xor Xorkey[i mod 4];

MsOut.Size := Length(Data);
MsOut.Write(Data
  • , Length(Data));
MsOut.Position := 4;
try
ZLibStream := TZDecompressionStream.Create(MsOut, -15);
try
DestStream := TFileStream.Create(DestFile, fmCreate or fmShareExclusive);
try
ZLibStream.Read(Data
  • , SizeOf(DecSize));
DestStream.Write(Data
  • ,SizeOf(DecSize));
DestStream.CopyFrom(ZLibStream, DecSize -4);
finally
DestStream.Free;
end;
finally
ZLibStream.Free;
end;
finally
SourceStream.Free;
Ms.Free;
MsOut.Free;
end;
end;
[свернуть]

Спойлер
procedure CompressFile(const SourceFile, DestFile: string);
var
SourceStream: TStream;
ZLibStream: TStream;
DestStream: TStream;
DecSize, FixShit: Integer;
i: Integer;
Data: TBytes;
begin
SourceStream := TFileStream.Create(SourceFile, fmOpenRead);
try
DecSize := SourceStream.Size;
DestStream := TFileStream.Create(DestFile, fmCreate or fmShareExclusive);

DestStream.Write(DecSize,SizeOf(DecSize));
try
ZLibStream := TZCompressionStream.Create(DestStream, zcFastest , -15, 8, zsDefault);
try
repeat
FixShit := SourceStream.Read(DecSize, SizeOf(DecSize));
ZLibStream.Write(DecSize, FixShit);
until FixShit = 0;
finally
ZLibStream.Free;
end;

SetLength(Data, DestStream.Size);
DestStream.Position := 0;
DestStream.Read(Data
  • ,Length(Data));
DestStream.Position := 0;

for i := 0 to 3 do
Data[i + 4] := Data[i + 4] xor Xorkey[i mod 4];

DestStream.Write(Data
  • ,Length(Data));
finally
DestStream.Free;
end;
finally
SourceStream.Free;
end;
end;
[свернуть]

uses
ZLibEx;

https://www.base2ti.com/?id=delphi.zlib



Клик


Похожие темы (5)