1
0
Fork 0
mirror of https://github.com/atom0s/Steamless.git synced 2024-12-19 23:07:41 +01:00

Added support for an unknown variant of v2.

This commit is contained in:
atom0s 2018-07-20 19:02:26 -07:00
parent aed8a86020
commit a0f856a050
3 changed files with 34 additions and 12 deletions

View file

@ -134,6 +134,7 @@ namespace Steamless.Unpacker.Variant20.x86
this.PayloadData = null;
this.SteamDrmpData = null;
this.SteamDrmpOffsets = new List<int>();
this.UseFallbackDrmpOffsets = false;
this.XorKey = 0;
// Parse the file..
@ -308,7 +309,15 @@ namespace Steamless.Unpacker.Variant20.x86
// Fall-back pattern scan for certain files that fail with the above pattern..
drmpOffset = Pe32Helpers.FindPattern(this.SteamDrmpData, "8B ?? ?? ?? ?? ?? 89 ?? ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? 89 ?? ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? 89 ?? ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? 89 ?? ?? ?? ?? ?? 8B");
if (drmpOffset == 0)
return false;
{
// Fall-back pattern (2).. (Seen in some v2 variants.)
drmpOffset = Pe32Helpers.FindPattern(this.SteamDrmpData, "8B ?? ?? ?? ?? ?? 89 ?? ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? A3 ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? A3 ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? A3 ?? ?? ?? ?? 8B");
if (drmpOffset == 0)
return false;
// Use fallback offsets if this worked..
this.UseFallbackDrmpOffsets = true;
}
}
// Copy the block of data from the SteamDRMP.dll data..
@ -581,17 +590,25 @@ namespace Steamless.Unpacker.Variant20.x86
/// <returns></returns>
private List<int> GetSteamDrmpOffsets(byte[] data)
{
var offset0 = 2; // Flags
var offset1 = 14; // Steam App Id
var offset2 = this.UseFallbackDrmpOffsets ? 25 : 26; // OEP
var offset3 = this.UseFallbackDrmpOffsets ? 36 : 38; // Code Section Virtual Address
var offset4 = this.UseFallbackDrmpOffsets ? 47 : 50; // Code Section Virtual Size (Encrypted Size)
var offset5 = this.UseFallbackDrmpOffsets ? 61 : 62; // Code Section AES Key
var offset6 = this.UseFallbackDrmpOffsets ? 72 : 67; // Code Section AES Iv
var offsets = new List<int>
{
BitConverter.ToInt32(data, 2), // .... 0 - Flags
BitConverter.ToInt32(data, 14), // ... 1 - Steam App Id
BitConverter.ToInt32(data, 26), // ... 2 - OEP
BitConverter.ToInt32(data, 38), // ... 3 - Code Section Virtual Address
BitConverter.ToInt32(data, 50), // ... 4 - Code Section Virtual Size (Encrypted Size)
BitConverter.ToInt32(data, 62) // .... 5 - Code Section AES Key
BitConverter.ToInt32(data, offset0), // ... 0 - Flags
BitConverter.ToInt32(data, offset1), // ... 1 - Steam App Id
BitConverter.ToInt32(data, offset2), // ... 2 - OEP
BitConverter.ToInt32(data, offset3), // ... 3 - Code Section Virtual Address
BitConverter.ToInt32(data, offset4), // ... 4 - Code Section Virtual Size (Encrypted Size)
BitConverter.ToInt32(data, offset5) // .... 5 - Code Section AES Key
};
var aesIvOffset = BitConverter.ToInt32(data, 67);
var aesIvOffset = BitConverter.ToInt32(data, offset6);
offsets.Add(aesIvOffset); // ................. 6 - Code Section AES Iv
offsets.Add(aesIvOffset + 16); // ............ 7 - Code Section Stolen Bytes
@ -633,6 +650,11 @@ namespace Steamless.Unpacker.Variant20.x86
/// </summary>
public List<int> SteamDrmpOffsets { get; set; }
/// <summary>
/// Gets or sets if the offsets should be read using fallback values.
/// </summary>
private bool UseFallbackDrmpOffsets { get; set; }
/// <summary>
/// Gets or sets the index of the code section.
/// </summary>

View file

@ -36,5 +36,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a40154cd-a0fd-4371-8099-ce277e0989af")]
[assembly: AssemblyVersion("1.0.0.4")]
[assembly: AssemblyFileVersion("1.0.0.4")]
[assembly: AssemblyVersion("1.0.0.5")]
[assembly: AssemblyFileVersion("1.0.0.5")]

View file

@ -37,5 +37,5 @@ using System.Windows;
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: AssemblyVersion("3.0.0.7")]
[assembly: AssemblyFileVersion("3.0.0.7")]
[assembly: AssemblyVersion("3.0.0.8")]
[assembly: AssemblyFileVersion("3.0.0.8")]