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

AutomaticPlugin - Added support for logging service usage.

AutomaticPlugin - Added detection and logging output to mention if a file is most likely not packed with SteamStub.
Core - Fixed issue with AutomaticPlugin not properly initializing.
Unpacker v2.0 (x86) - Adjusted how the code section RVA is determined. (Moved a second check to 'optional feature' state for now.)
This commit is contained in:
atom0s 2022-09-21 18:55:29 -07:00
parent 1bdd96e657
commit b6d445fda4
No known key found for this signature in database
GPG key ID: 37D5FD3494D79AF8
5 changed files with 70 additions and 8 deletions

View file

@ -223,8 +223,13 @@ namespace Steamless.Unpacker.Variant20.x86
// Determine the code section RVA..
var codeSectionRVA = this.File.NtHeaders.OptionalHeader.BaseOfCode;
if (this.StubHeader.CodeSectionVirtualAddress != 0)
codeSectionRVA = this.File.GetRvaFromVa(this.StubHeader.CodeSectionVirtualAddress);
// TODO: This is not really ideal to do but for now this breaks support for other variants of this version..
if (this.Options.UseExperimentalFeatures)
{
if (this.StubHeader.CodeSectionVirtualAddress != 0)
codeSectionRVA = this.File.GetRvaFromVa(this.StubHeader.CodeSectionVirtualAddress);
}
// Get the code section..
var codeSection = this.File.GetOwnerSection(codeSectionRVA);

View file

@ -36,5 +36,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("4f11f26d-2946-467f-a4e9-9e2a619a1fd3")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]

View file

@ -27,7 +27,10 @@ namespace Steamless.Model
{
using API;
using API.Model;
using API.PE32;
using API.PE64;
using API.Services;
using Steamless.API.Events;
using System;
using System.Linq;
using System.Windows;
@ -36,6 +39,11 @@ namespace Steamless.Model
[SteamlessApiVersion(1, 0)]
internal class AutomaticPlugin : SteamlessPlugin
{
/// <summary>
/// Internal logging service instance.
/// </summary>
private LoggingService m_LoggingService;
/// <summary>
/// Gets the author of this plugin.
/// </summary>
@ -56,6 +64,16 @@ namespace Steamless.Model
/// </summary>
public override Version Version => new Version(1, 0, 0, 0);
/// <summary>
/// Internal wrapper to log a message.
/// </summary>
/// <param name="msg"></param>
/// <param name="type"></param>
private void Log(string msg, LogMessageType type)
{
this.m_LoggingService.OnAddLogMessage(this, new LogMessageEventArgs(msg, type));
}
/// <summary>
/// Initialize function called when this plugin is first loaded.
/// </summary>
@ -63,6 +81,7 @@ namespace Steamless.Model
/// <returns></returns>
public override bool Initialize(LoggingService logService)
{
this.m_LoggingService = logService;
return true;
}
@ -94,7 +113,43 @@ namespace Steamless.Model
return false;
// Query the plugin list for a plugin to process the file..
return (from p in plugins where p != this where p.CanProcessFile(file) select p.ProcessFile(file, options)).FirstOrDefault();
var ret = (from p in plugins where p != this where p.CanProcessFile(file) select p.ProcessFile(file, options)).FirstOrDefault();
if (ret)
return ret;
// Determine if the file was not packed with SteamStub..
try
{
// First attempt to read the file as 32bit..
dynamic f = new Pe32File(file);
if (f.Parse())
{
// Check if the file is 64bit..
if (f.IsFile64Bit())
{
f = new Pe64File(file);
if (!f.Parse())
return false;
}
// Ensure the file had a .bind section..
if (!f.HasSection(".bind"))
{
this.Log("", LogMessageType.Error);
this.Log("This file does not appear to be packed with SteamStub!", LogMessageType.Error);
this.Log("File missing expected '.bind' section!", LogMessageType.Error);
this.Log("", LogMessageType.Error);
return false;
}
}
}
catch
{
return false;
}
return false;
}
}
}

View file

@ -73,7 +73,9 @@ namespace Steamless.Model.Tasks
});
// Add the automatic plugin at the start of the list..
sorted.Insert(0, new AutomaticPlugin());
var auto = new AutomaticPlugin();
auto.Initialize(vml.LoggingService);
sorted.Insert(0, auto);
// Set the plugins..
vml.MainWindow.Plugins = new ObservableCollection<SteamlessPlugin>(sorted);

View file

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