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

Unpackers: (x86) - Ensure all unpacked files default to a checksum of 0.

This commit is contained in:
atom0s 2022-03-26 02:25:36 -07:00
parent 7cb8eaf613
commit 2380a4bd8a
No known key found for this signature in database
GPG key ID: 37D5FD3494D79AF8
5 changed files with 7 additions and 4 deletions

View file

@ -36,7 +36,6 @@ namespace Steamless.Unpacker.Variant10.x86
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices;
[SteamlessApiVersion(1, 0)] [SteamlessApiVersion(1, 0)]
public class Main : SteamlessPlugin public class Main : SteamlessPlugin
@ -275,7 +274,7 @@ namespace Steamless.Unpacker.Variant10.x86
if (this.File.DosStubSize > 0) if (this.File.DosStubSize > 0)
fStream.WriteBytes(this.File.DosStubData); fStream.WriteBytes(this.File.DosStubData);
// Update the entry point and checksum of the file.. // Update the NT headers..
var ntHeaders = this.File.NtHeaders; var ntHeaders = this.File.NtHeaders;
ntHeaders.OptionalHeader.AddressOfEntryPoint = this.OriginalEntryPoint; ntHeaders.OptionalHeader.AddressOfEntryPoint = this.OriginalEntryPoint;
ntHeaders.OptionalHeader.CheckSum = 0; ntHeaders.OptionalHeader.CheckSum = 0;

View file

@ -335,6 +335,7 @@ namespace Steamless.Unpacker.Variant20.x86
var ntHeaders = this.File.NtHeaders; var ntHeaders = this.File.NtHeaders;
var lastSection = this.File.Sections[this.File.Sections.Count - 1]; var lastSection = this.File.Sections[this.File.Sections.Count - 1];
ntHeaders.OptionalHeader.AddressOfEntryPoint = this.File.GetRvaFromVa(this.StubHeader.OEP); ntHeaders.OptionalHeader.AddressOfEntryPoint = this.File.GetRvaFromVa(this.StubHeader.OEP);
ntHeaders.OptionalHeader.CheckSum = 0;
ntHeaders.OptionalHeader.SizeOfImage = this.File.GetAlignment(lastSection.VirtualAddress + lastSection.VirtualSize, this.File.NtHeaders.OptionalHeader.SectionAlignment); ntHeaders.OptionalHeader.SizeOfImage = this.File.GetAlignment(lastSection.VirtualAddress + lastSection.VirtualSize, this.File.NtHeaders.OptionalHeader.SectionAlignment);
this.File.NtHeaders = ntHeaders; this.File.NtHeaders = ntHeaders;

View file

@ -462,6 +462,7 @@ namespace Steamless.Unpacker.Variant21.x86
var lastSection = this.File.Sections[this.File.Sections.Count - 1]; var lastSection = this.File.Sections[this.File.Sections.Count - 1];
var originalEntry = BitConverter.ToUInt32(this.PayloadData.Skip(this.SteamDrmpOffsets[2]).Take(4).ToArray(), 0); var originalEntry = BitConverter.ToUInt32(this.PayloadData.Skip(this.SteamDrmpOffsets[2]).Take(4).ToArray(), 0);
ntHeaders.OptionalHeader.AddressOfEntryPoint = this.File.GetRvaFromVa(originalEntry); ntHeaders.OptionalHeader.AddressOfEntryPoint = this.File.GetRvaFromVa(originalEntry);
ntHeaders.OptionalHeader.CheckSum = 0;
ntHeaders.OptionalHeader.SizeOfImage = this.File.GetAlignment(lastSection.VirtualAddress + lastSection.VirtualSize, this.File.NtHeaders.OptionalHeader.SectionAlignment); ntHeaders.OptionalHeader.SizeOfImage = this.File.GetAlignment(lastSection.VirtualAddress + lastSection.VirtualSize, this.File.NtHeaders.OptionalHeader.SectionAlignment);
this.File.NtHeaders = ntHeaders; this.File.NtHeaders = ntHeaders;

View file

@ -463,9 +463,10 @@ namespace Steamless.Unpacker.Variant30.x86
if (this.File.DosStubSize > 0) if (this.File.DosStubSize > 0)
fStream.WriteBytes(this.File.DosStubData); fStream.WriteBytes(this.File.DosStubData);
// Update the entry point of the file.. // Update the NT headers..
var ntHeaders = this.File.NtHeaders; var ntHeaders = this.File.NtHeaders;
ntHeaders.OptionalHeader.AddressOfEntryPoint = this.StubHeader.OriginalEntryPoint; ntHeaders.OptionalHeader.AddressOfEntryPoint = this.StubHeader.OriginalEntryPoint;
ntHeaders.OptionalHeader.CheckSum = 0;
this.File.NtHeaders = ntHeaders; this.File.NtHeaders = ntHeaders;
// Write the NT headers to the file.. // Write the NT headers to the file..

View file

@ -459,9 +459,10 @@ namespace Steamless.Unpacker.Variant31.x86
if (this.File.DosStubSize > 0) if (this.File.DosStubSize > 0)
fStream.WriteBytes(this.File.DosStubData); fStream.WriteBytes(this.File.DosStubData);
// Update the entry point of the file.. // Update the NT headers..
var ntHeaders = this.File.NtHeaders; var ntHeaders = this.File.NtHeaders;
ntHeaders.OptionalHeader.AddressOfEntryPoint = (uint)this.StubHeader.OriginalEntryPoint; ntHeaders.OptionalHeader.AddressOfEntryPoint = (uint)this.StubHeader.OriginalEntryPoint;
ntHeaders.OptionalHeader.CheckSum = 0;
this.File.NtHeaders = ntHeaders; this.File.NtHeaders = ntHeaders;
// Write the NT headers to the file.. // Write the NT headers to the file..