mirror of
https://github.com/atom0s/Steamless.git
synced 2024-12-19 23:07:41 +01:00
API: Add new option to zero the DOS stub data when unpacking.
Core: Add UI option to enable/disable the new zero DOS stub data option. Unpackers: Add support for new zero DOS stub data option. API: `DontRealignSections` and `ZeroDosStubData` are now default enabled as this is the general 'correct' way to handle most files. (Some files do require the section alignment to happen and some files may use the DOS stub for self-validation and such. Adjust accordingly when using Steamless.)
This commit is contained in:
parent
18c389ce3c
commit
12c312b4db
9 changed files with 44 additions and 1 deletions
|
@ -37,7 +37,8 @@ namespace Steamless.API.Model
|
|||
this.DumpPayloadToDisk = false;
|
||||
this.DumpSteamDrmpToDisk = false;
|
||||
this.UseExperimentalFeatures = false;
|
||||
this.DontRealignSections = false;
|
||||
this.DontRealignSections = true;
|
||||
this.ZeroDosStubData = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -93,5 +94,14 @@ namespace Steamless.API.Model
|
|||
get => this.Get<bool>("DontRealignSections");
|
||||
set => this.Set("DontRealignSections", value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets if the DOS stub data should be zeroed.
|
||||
/// </summary>
|
||||
public bool ZeroDosStubData
|
||||
{
|
||||
get => this.Get<bool>("ZeroDosStubData");
|
||||
set => this.Set("ZeroDosStubData", value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -34,6 +34,7 @@ namespace Steamless.Unpacker.Variant10.x86
|
|||
using Classes;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
[SteamlessApiVersion(1, 0)]
|
||||
|
@ -248,6 +249,10 @@ namespace Steamless.Unpacker.Variant10.x86
|
|||
|
||||
try
|
||||
{
|
||||
// Zero the DosStubData if desired..
|
||||
if (this.Options.ZeroDosStubData && this.File.DosStubSize > 0)
|
||||
this.File.DosStubData = Enumerable.Repeat((byte)0, (int)this.File.DosStubSize).ToArray();
|
||||
|
||||
// Rebuild the file sections..
|
||||
this.File.RebuildSections(this.Options.DontRealignSections == false);
|
||||
|
||||
|
|
|
@ -309,6 +309,10 @@ namespace Steamless.Unpacker.Variant20.x86
|
|||
|
||||
try
|
||||
{
|
||||
// Zero the DosStubData if desired..
|
||||
if (this.Options.ZeroDosStubData && this.File.DosStubSize > 0)
|
||||
this.File.DosStubData = Enumerable.Repeat((byte)0, (int)this.File.DosStubSize).ToArray();
|
||||
|
||||
// Open the unpacked file for writing..
|
||||
var unpackedPath = this.File.FilePath + ".unpacked.exe";
|
||||
fStream = new FileStream(unpackedPath, FileMode.Create, FileAccess.ReadWrite);
|
||||
|
|
|
@ -432,6 +432,10 @@ namespace Steamless.Unpacker.Variant21.x86
|
|||
|
||||
try
|
||||
{
|
||||
// Zero the DosStubData if desired..
|
||||
if (this.Options.ZeroDosStubData && this.File.DosStubSize > 0)
|
||||
this.File.DosStubData = Enumerable.Repeat((byte)0, (int)this.File.DosStubSize).ToArray();
|
||||
|
||||
// Rebuild the file sections..
|
||||
this.File.RebuildSections(this.Options.DontRealignSections == false);
|
||||
|
||||
|
|
|
@ -482,6 +482,10 @@ namespace Steamless.Unpacker.Variant30.x64
|
|||
|
||||
try
|
||||
{
|
||||
// Zero the DosStubData if desired..
|
||||
if (this.Options.ZeroDosStubData && this.File.DosStubSize > 0)
|
||||
this.File.DosStubData = Enumerable.Repeat((byte)0, (int)this.File.DosStubSize).ToArray();
|
||||
|
||||
// Rebuild the file sections..
|
||||
this.File.RebuildSections(this.Options.DontRealignSections == false);
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace Steamless.Unpacker.Variant30.x86
|
|||
using Classes;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
|
@ -437,6 +438,10 @@ namespace Steamless.Unpacker.Variant30.x86
|
|||
|
||||
try
|
||||
{
|
||||
// Zero the DosStubData if desired..
|
||||
if (this.Options.ZeroDosStubData && this.File.DosStubSize > 0)
|
||||
this.File.DosStubData = Enumerable.Repeat((byte)0, (int)this.File.DosStubSize).ToArray();
|
||||
|
||||
// Rebuild the file sections..
|
||||
this.File.RebuildSections(this.Options.DontRealignSections == false);
|
||||
|
||||
|
|
|
@ -434,6 +434,10 @@ namespace Steamless.Unpacker.Variant31.x64
|
|||
|
||||
try
|
||||
{
|
||||
// Zero the DosStubData if desired..
|
||||
if (this.Options.ZeroDosStubData && this.File.DosStubSize > 0)
|
||||
this.File.DosStubData = Enumerable.Repeat((byte)0, (int)this.File.DosStubSize).ToArray();
|
||||
|
||||
// Rebuild the file sections..
|
||||
this.File.RebuildSections(this.Options.DontRealignSections == false);
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace Steamless.Unpacker.Variant31.x86
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
|
@ -433,6 +434,10 @@ namespace Steamless.Unpacker.Variant31.x86
|
|||
|
||||
try
|
||||
{
|
||||
// Zero the DosStubData if desired..
|
||||
if (this.Options.ZeroDosStubData && this.File.DosStubSize > 0)
|
||||
this.File.DosStubData = Enumerable.Repeat((byte)0, (int)this.File.DosStubSize).ToArray();
|
||||
|
||||
// Rebuild the file sections..
|
||||
this.File.RebuildSections(this.Options.DontRealignSections == false);
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<CheckBox Grid.Row="0" Content="Verbose Output" Margin="2" ToolTip="If enabled, Steamless will allow logging of debug messages." IsChecked="{Binding Options.VerboseOutput}" />
|
||||
<CheckBox Grid.Row="1" Content="Keep Bind Section" Margin="2" ToolTip="The bind section should be kept within the file after unpacking." IsChecked="{Binding Options.KeepBindSection}" />
|
||||
|
@ -92,6 +93,7 @@
|
|||
<CheckBox Grid.Row="3" Content="Dump SteamDRMP.dll To Disk" Margin="2" ToolTip="Dumps the SteamDRMP.dll to disk where the target file is located." IsChecked="{Binding Options.DumpSteamDrmpToDisk}" />
|
||||
<CheckBox Grid.Row="4" Content="Use Experimental Features" Margin="2" ToolTip="Enables the use of experimental features." IsChecked="{Binding Options.UseExperimentalFeatures}" />
|
||||
<CheckBox Grid.Row="5" Content="Don't Realign Sections" Margin="2" ToolTip="Disables realignment of sections when unpacking." IsChecked="{Binding Options.DontRealignSections}" />
|
||||
<CheckBox Grid.Row="6" Content="Zero DOS Stub Data" Margin="2" ToolTip="Sets the DOS stub data to 00's." IsChecked="{Binding Options.DontRealignSections}" />
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
|
|
Loading…
Reference in a new issue