diff --git a/Steamless.API/Model/SteamlessOptions.cs b/Steamless.API/Model/SteamlessOptions.cs index a9494e3..6c98c56 100644 --- a/Steamless.API/Model/SteamlessOptions.cs +++ b/Steamless.API/Model/SteamlessOptions.cs @@ -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; } /// @@ -93,5 +94,14 @@ namespace Steamless.API.Model get => this.Get("DontRealignSections"); set => this.Set("DontRealignSections", value); } + + /// + /// Gets or sets if the DOS stub data should be zeroed. + /// + public bool ZeroDosStubData + { + get => this.Get("ZeroDosStubData"); + set => this.Set("ZeroDosStubData", value); + } } } \ No newline at end of file diff --git a/Steamless.Unpacker.Variant10.x86/Main.cs b/Steamless.Unpacker.Variant10.x86/Main.cs index 4874226..bbc84fe 100644 --- a/Steamless.Unpacker.Variant10.x86/Main.cs +++ b/Steamless.Unpacker.Variant10.x86/Main.cs @@ -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); diff --git a/Steamless.Unpacker.Variant20.x86/Main.cs b/Steamless.Unpacker.Variant20.x86/Main.cs index bf2d540..1abc507 100644 --- a/Steamless.Unpacker.Variant20.x86/Main.cs +++ b/Steamless.Unpacker.Variant20.x86/Main.cs @@ -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); diff --git a/Steamless.Unpacker.Variant21.x86/Main.cs b/Steamless.Unpacker.Variant21.x86/Main.cs index dc17a28..172568c 100644 --- a/Steamless.Unpacker.Variant21.x86/Main.cs +++ b/Steamless.Unpacker.Variant21.x86/Main.cs @@ -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); diff --git a/Steamless.Unpacker.Variant30.x64/Main.cs b/Steamless.Unpacker.Variant30.x64/Main.cs index 79fd7cd..6d96bd5 100644 --- a/Steamless.Unpacker.Variant30.x64/Main.cs +++ b/Steamless.Unpacker.Variant30.x64/Main.cs @@ -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); diff --git a/Steamless.Unpacker.Variant30.x86/Main.cs b/Steamless.Unpacker.Variant30.x86/Main.cs index 8355478..643184f 100644 --- a/Steamless.Unpacker.Variant30.x86/Main.cs +++ b/Steamless.Unpacker.Variant30.x86/Main.cs @@ -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); diff --git a/Steamless.Unpacker.Variant31.x64/Main.cs b/Steamless.Unpacker.Variant31.x64/Main.cs index 6b4151e..bd08f96 100644 --- a/Steamless.Unpacker.Variant31.x64/Main.cs +++ b/Steamless.Unpacker.Variant31.x64/Main.cs @@ -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); diff --git a/Steamless.Unpacker.Variant31.x86/Main.cs b/Steamless.Unpacker.Variant31.x86/Main.cs index 67148cd..9fbf23d 100644 --- a/Steamless.Unpacker.Variant31.x86/Main.cs +++ b/Steamless.Unpacker.Variant31.x86/Main.cs @@ -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); diff --git a/Steamless/View/MainView.xaml b/Steamless/View/MainView.xaml index d36a71f..efcb3c9 100644 --- a/Steamless/View/MainView.xaml +++ b/Steamless/View/MainView.xaml @@ -85,6 +85,7 @@ + @@ -92,6 +93,7 @@ +