mirror of
https://github.com/atom0s/Steamless.git
synced 2024-12-19 23:07:41 +01:00
* Unpacker v2.1 (x86) - Updated the header to handle the StubData more correctly.
This commit is contained in:
parent
0b67eab1d1
commit
1bdd96e657
2 changed files with 32 additions and 4 deletions
|
@ -54,8 +54,13 @@ namespace Steamless.Unpacker.Variant21.x86.Classes
|
|||
public uint SteamDRMPDllSize; // The offset inside of the payload data holding the size of the SteamDRMP.dll file data.
|
||||
public uint XTeaKeys; // The offset inside of the payload data holding the address to the Xtea keys to decrypt the SteamDRMP.dll file.
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x2B8)]
|
||||
public byte[] StubData; // Misc stub data, such as strings, error messages, etc.
|
||||
//
|
||||
// The 'StubData' field is dynamically sized based on the needs of the stub version and used options. This is effectively
|
||||
// impossible to 'size' correctly for all header versions, so instead it will be treated separately.
|
||||
//
|
||||
// [MarshalAs(UnmanagedType.ByValArray, SizeConst = ???)]
|
||||
// public byte[] StubData; // Misc stub data, such as strings, error messages, etc.
|
||||
//
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -84,7 +89,12 @@ namespace Steamless.Unpacker.Variant21.x86.Classes
|
|||
public uint SteamDRMPDllSize; // The offset inside of the payload data holding the size of the SteamDRMP.dll file data.
|
||||
public uint XTeaKeys; // The offset inside of the payload data holding the address to the Xtea keys to decrypt the SteamDRMP.dll file.
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x31C)]
|
||||
public byte[] StubData; // Misc stub data, such as strings, error messages, etc.
|
||||
//
|
||||
// The 'StubData' field is dynamically sized based on the needs of the stub version and used options. This is effectively
|
||||
// impossible to 'size' correctly for all header versions, so instead it will be treated separately.
|
||||
//
|
||||
// [MarshalAs(UnmanagedType.ByValArray, SizeConst = ???)]
|
||||
// public byte[] StubData; // Misc stub data, such as strings, error messages, etc.
|
||||
//
|
||||
}
|
||||
}
|
|
@ -187,6 +187,13 @@ namespace Steamless.Unpacker.Variant21.x86
|
|||
/// <returns></returns>
|
||||
private bool Step1()
|
||||
{
|
||||
/**
|
||||
* Note: This version of the stub has a variable length header due to how it builds the
|
||||
* header information. When the stub is generated, the header has additional string data
|
||||
* that can be dynamically built based on the various options of the protection being used
|
||||
* and other needed API imports. Inside of the stub header, this field is 'StubData'.
|
||||
*/
|
||||
|
||||
// Obtain the file entry offset..
|
||||
var fileOffset = this.File.GetFileOffsetFromRva(this.File.NtHeaders.OptionalHeader.AddressOfEntryPoint);
|
||||
|
||||
|
@ -207,9 +214,15 @@ namespace Steamless.Unpacker.Variant21.x86
|
|||
|
||||
// Determine how to handle the header based on the size..
|
||||
if ((structSize / 4) == 0xD0)
|
||||
{
|
||||
this.StubHeader = Pe32Helpers.GetStructure<SteamStub32Var21Header_D0Variant>(headerData);
|
||||
this.StubData = headerData.Skip(Marshal.SizeOf(typeof(SteamStub32Var21Header_D0Variant))).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.StubHeader = Pe32Helpers.GetStructure<SteamStub32Var21Header>(headerData);
|
||||
this.StubData = headerData.Skip(Marshal.SizeOf(typeof(SteamStub32Var21Header))).ToArray();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -755,6 +768,11 @@ namespace Steamless.Unpacker.Variant21.x86
|
|||
/// </summary>
|
||||
private dynamic StubHeader { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the dynamic field 'StubData' from the header.
|
||||
/// </summary>
|
||||
private byte[] StubData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the payload data.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in a new issue