Skip to content

Commit

Permalink
Fixed 2.1 (x86) unpacker using the wrong encryption size when the .te…
Browse files Browse the repository at this point in the history
…xt section is encrypted. (Fixes #57)
  • Loading branch information
atom0s committed Sep 24, 2021
1 parent 2a10df6 commit b31c7a1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Steamless.Unpacker.Variant21.x86/Main.cs
Expand Up @@ -395,11 +395,12 @@ private bool Step5()
var aesKey = this.PayloadData.Skip(this.SteamDrmpOffsets[5]).Take(32).ToArray();
var aesIv = this.PayloadData.Skip(this.SteamDrmpOffsets[6]).Take(16).ToArray();
var codeStolen = this.PayloadData.Skip(this.SteamDrmpOffsets[7]).Take(16).ToArray();
var encryptedSize = BitConverter.ToUInt32(this.PayloadData.Skip(this.SteamDrmpOffsets[4]).Take(4).ToArray(), 0);

// Restore the stolen data then read the rest of the section data..
codeSectionData = new byte[mainSection.SizeOfRawData + codeStolen.Length];
codeSectionData = new byte[encryptedSize + codeStolen.Length];
Array.Copy(codeStolen, 0, codeSectionData, 0, codeStolen.Length);
Array.Copy(this.File.FileData, this.File.GetFileOffsetFromRva(mainSection.VirtualAddress), codeSectionData, codeStolen.Length, mainSection.SizeOfRawData);
Array.Copy(this.File.FileData, this.File.GetFileOffsetFromRva(mainSection.VirtualAddress), codeSectionData, codeStolen.Length, encryptedSize);

// Decrypt the code section..
var aes = new AesHelper(aesKey, aesIv);
Expand Down
4 changes: 2 additions & 2 deletions Steamless.Unpacker.Variant21.x86/Properties/AssemblyInfo.cs
Expand Up @@ -36,5 +36,5 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a40154cd-a0fd-4371-8099-ce277e0989af")]
[assembly: AssemblyVersion("1.0.0.7")]
[assembly: AssemblyFileVersion("1.0.0.7")]
[assembly: AssemblyVersion("1.0.0.8")]
[assembly: AssemblyFileVersion("1.0.0.8")]
4 changes: 2 additions & 2 deletions Steamless/Properties/AssemblyInfo.cs
Expand Up @@ -37,5 +37,5 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: AssemblyVersion("3.0.0.11")]
[assembly: AssemblyFileVersion("3.0.0.11")]
[assembly: AssemblyVersion("3.0.0.12")]
[assembly: AssemblyFileVersion("3.0.0.12")]

0 comments on commit b31c7a1

Please sign in to comment.