From 2ebfe6639e0c87c7a20b22b1f178a608b085278c Mon Sep 17 00:00:00 2001 From: RequiDev Date: Fri, 23 Jan 2026 16:17:21 +0100 Subject: [PATCH 01/13] Allow 0x-prefixed hex literals in address parser --- ReClass.NET/AddressParser/Tokenizer.cs | 55 ++++++++++--------- ReClass.NET_Tests/AddressParser/ParserTest.cs | 2 + 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/ReClass.NET/AddressParser/Tokenizer.cs b/ReClass.NET/AddressParser/Tokenizer.cs index a43907ec..052f1912 100644 --- a/ReClass.NET/AddressParser/Tokenizer.cs +++ b/ReClass.NET/AddressParser/Tokenizer.cs @@ -118,41 +118,46 @@ private bool TryReadNumberToken() bool IsHexadecimalDigit(char c) => char.IsDigit(c) || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F'; bool IsHexadecimalIdentifier(char c) => c == 'x' || c == 'X'; - if (IsHexadecimalDigit(currentCharacter)) + if (!IsHexadecimalDigit(currentCharacter)) { - var sb = new StringBuilder(); - var hasHexadecimalIdentifier = false; - - while (IsHexadecimalDigit(currentCharacter) - || IsHexadecimalIdentifier(currentCharacter) && !hasHexadecimalIdentifier && sb.Length == 1 && sb[0] == '0') - { - sb.Append(currentCharacter); + return false; + } - if (!hasHexadecimalIdentifier) - { - hasHexadecimalIdentifier = IsHexadecimalIdentifier(currentCharacter); - } + var sb = new StringBuilder(); - ReadNextCharacter(); - } + if (currentCharacter == '0') + { + sb.Append(currentCharacter); + ReadNextCharacter(); - if (hasHexadecimalIdentifier) + if (IsHexadecimalIdentifier(currentCharacter)) { - sb.Remove(0, 2); + // Consume "0x" or "0X" prefix. + sb.Clear(); + ReadNextCharacter(); } + } - if (!long.TryParse(sb.ToString(), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var number)) - { - throw new ParseException($"Could not parse '{sb}' as number."); - } - Number = number; + while (IsHexadecimalDigit(currentCharacter)) + { + sb.Append(currentCharacter); + ReadNextCharacter(); + } - Token = Token.Number; + if (sb.Length == 0) + { + throw new ParseException("Could not parse empty hexadecimal number."); + } - return true; + if (!long.TryParse(sb.ToString(), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var number)) + { + throw new ParseException($"Could not parse '{sb}' as number."); } - return false; + Number = number; + Token = Token.Number; + + return true; } private bool TryReadIdentifierToken() @@ -186,4 +191,4 @@ private bool TryReadIdentifierToken() return false; } } -} \ No newline at end of file +} diff --git a/ReClass.NET_Tests/AddressParser/ParserTest.cs b/ReClass.NET_Tests/AddressParser/ParserTest.cs index 40a2bfd3..399bcd15 100644 --- a/ReClass.NET_Tests/AddressParser/ParserTest.cs +++ b/ReClass.NET_Tests/AddressParser/ParserTest.cs @@ -45,6 +45,8 @@ public void InvalidExpressionTests(string expression) [Theory] [InlineData("1", typeof(ConstantExpression))] + [InlineData("0x1", typeof(ConstantExpression))] + [InlineData("0X1", typeof(ConstantExpression))] [InlineData("1 + 2", typeof(AddExpression))] [InlineData("1 - 2", typeof(SubtractExpression))] [InlineData("1 * 2", typeof(MultiplyExpression))] From 87b78c94edcad15f05978e03dd4a6b2b15714009 Mon Sep 17 00:00:00 2001 From: RequiDev Date: Fri, 23 Jan 2026 16:35:22 +0100 Subject: [PATCH 02/13] Port to .NET 9 --- README.md | 4 +- ReClass.NET/App.config | 5 +- ReClass.NET/Controls/BannerBox.cs | 4 + ReClass.NET/Controls/ColorBox.cs | 4 +- ReClass.NET/Controls/CustomToolStripItems.cs | 7 + ReClass.NET/Controls/DualValueBox.cs | 5 + ReClass.NET/Controls/HotkeyBox.cs | 2 + ReClass.NET/Controls/IconButton.cs | 6 + ReClass.NET/Controls/MemoryRecordList.cs | 5 + ReClass.NET/Controls/MemoryViewControl.cs | 3 + ReClass.NET/Controls/ProjectView.cs | 8 + ReClass.NET/Extensions/EnumerableExtension.cs | 17 - ReClass.NET/Forms/MainForm.cs | 2 + ReClass.NET/Program.cs | 3 + ReClass.NET/ReClass.NET.csproj | 1035 +---------------- ReClass.NET/Util/PathUtil.cs | 8 +- ReClass.NET_Launcher/App.config | 3 - .../ReClass.NET_Launcher.csproj | 101 +- ReClass.NET_Tests/ReClass.NET_Tests.csproj | 140 +-- 19 files changed, 183 insertions(+), 1179 deletions(-) diff --git a/README.md b/README.md index 82a8a53d..5c5ff8d9 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ Just download the [latest version](https://github.com/ReClassNET/ReClass.NET/rel Valid operations are read ([..]), add (+), sub (-), mul (*) and div (/). Please note that all operations are integer calculations. ## Compiling -If you want to compile ReClass.NET just fork the repository and open the ReClass.NET.sln file with Visual Studio 2019. +If you want to compile ReClass.NET just fork the repository and open the ReClass.NET.sln file with Visual Studio 2022 (or later) and the .NET 9 SDK installed. Compile the project and copy the dependencies to the output folder. To compile the linux native core library, you need WSL [installed and configured](https://learn.microsoft.com/en-us/cpp/build/walkthrough-build-debug-wsl2). If you do not need linux support, simply unload the project in the Solution Explorer. If you want to build cross-platform (x86/x64) you have to install `g++-multilib` too. @@ -135,4 +135,4 @@ Settings - [buddyfavors](https://github.com/buddyfavors) - [DrP3pp3r](https://github.com/DrP3pp3r) - [ko1N](https://github.com/ko1N) -- [Niemand](https://github.com/niemand-sec) (see his talk at [BlackHat Europe 2019 (London) "Unveiling the underground world of Anti-Cheats"](https://www.blackhat.com/eu-19/briefings/schedule/index.html#unveiling-the-underground-world-of-anti-cheats-17358)) \ No newline at end of file +- [Niemand](https://github.com/niemand-sec) (see his talk at [BlackHat Europe 2019 (London) "Unveiling the underground world of Anti-Cheats"](https://www.blackhat.com/eu-19/briefings/schedule/index.html#unveiling-the-underground-world-of-anti-cheats-17358)) diff --git a/ReClass.NET/App.config b/ReClass.NET/App.config index 1b379a17..1a6871b8 100644 --- a/ReClass.NET/App.config +++ b/ReClass.NET/App.config @@ -1,9 +1,6 @@ - - - - \ No newline at end of file + diff --git a/ReClass.NET/Controls/BannerBox.cs b/ReClass.NET/Controls/BannerBox.cs index b3cdab8c..451537aa 100644 --- a/ReClass.NET/Controls/BannerBox.cs +++ b/ReClass.NET/Controls/BannerBox.cs @@ -17,8 +17,12 @@ public class BannerBox : Control, ISupportInitialize private Image image; + [DefaultValue(null)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public Image Icon { get => icon; set { icon = value; UpdateBanner(); } } + [DefaultValue("")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public string Title { get => title; set { title = value ?? string.Empty; UpdateBanner(); } } public override string Text { get => text; set { text = value ?? string.Empty; UpdateBanner(); } } diff --git a/ReClass.NET/Controls/ColorBox.cs b/ReClass.NET/Controls/ColorBox.cs index 9325e645..6fc5592f 100644 --- a/ReClass.NET/Controls/ColorBox.cs +++ b/ReClass.NET/Controls/ColorBox.cs @@ -17,7 +17,9 @@ public partial class ColorBox : UserControl public event EventHandler ColorChanged; - private Color color; + private Color color = Color.Black; + [DefaultValue(typeof(Color), "Black")] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public Color Color { get => color; diff --git a/ReClass.NET/Controls/CustomToolStripItems.cs b/ReClass.NET/Controls/CustomToolStripItems.cs index ea186f17..74ae6f5b 100644 --- a/ReClass.NET/Controls/CustomToolStripItems.cs +++ b/ReClass.NET/Controls/CustomToolStripItems.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Windows.Forms; using System.Windows.Forms.Design; @@ -7,18 +8,24 @@ namespace ReClassNET.Controls [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All)] public class IntegerToolStripMenuItem : ToolStripMenuItem { + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public int Value { get; set; } } [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All)] public class TypeToolStripMenuItem : ToolStripMenuItem { + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public Type Value { get; set; } } [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All)] public class TypeToolStripButton : ToolStripButton { + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public Type Value { get; set; } } } diff --git a/ReClass.NET/Controls/DualValueBox.cs b/ReClass.NET/Controls/DualValueBox.cs index d2b8d264..80440726 100644 --- a/ReClass.NET/Controls/DualValueBox.cs +++ b/ReClass.NET/Controls/DualValueBox.cs @@ -7,6 +7,7 @@ namespace ReClassNET.Controls [Designer(typeof(DualValueControlDesigner))] public partial class DualValueBox : UserControl { + [DefaultValue(false)] public bool ShowSecondInputField { get => tableLayoutPanel.ColumnStyles[0].Width <= 99; @@ -30,12 +31,16 @@ public bool ShowSecondInputField } } + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Value1 { get => value1TextBox.Text; set => value1TextBox.Text = value; } + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Value2 { get => value2TextBox.Text; diff --git a/ReClass.NET/Controls/HotkeyBox.cs b/ReClass.NET/Controls/HotkeyBox.cs index 9a24e7b3..73af93a1 100644 --- a/ReClass.NET/Controls/HotkeyBox.cs +++ b/ReClass.NET/Controls/HotkeyBox.cs @@ -10,6 +10,8 @@ namespace ReClassNET.Controls [Designer(typeof(HotkeyBoxDesigner))] public partial class HotkeyBox : UserControl { + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public KeyboardInput Input { get; set; } public KeyboardHotkey Hotkey { get; } = new KeyboardHotkey(); diff --git a/ReClass.NET/Controls/IconButton.cs b/ReClass.NET/Controls/IconButton.cs index 5d45a198..eabc5eb6 100644 --- a/ReClass.NET/Controls/IconButton.cs +++ b/ReClass.NET/Controls/IconButton.cs @@ -14,9 +14,15 @@ namespace ReClassNET.Controls [DefaultEvent("Click")] public class IconButton : Panel { + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool Pressed { get; set; } + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool Selected { get; set; } + [DefaultValue(null)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public Image Image { get; set; } public Rectangle ImageRectangle { get; } = new Rectangle(3, 3, 16, 16); diff --git a/ReClass.NET/Controls/MemoryRecordList.cs b/ReClass.NET/Controls/MemoryRecordList.cs index b3a06672..e9330277 100644 --- a/ReClass.NET/Controls/MemoryRecordList.cs +++ b/ReClass.NET/Controls/MemoryRecordList.cs @@ -15,30 +15,35 @@ namespace ReClassNET.Controls public partial class MemoryRecordList : UserControl { + [DefaultValue(true)] public bool ShowDescriptionColumn { get => descriptionColumn.Visible; set => descriptionColumn.Visible = value; } + [DefaultValue(true)] public bool ShowAddressColumn { get => addressColumn.Visible; set => addressColumn.Visible = value; } + [DefaultValue(true)] public bool ShowValueTypeColumn { get => valueTypeColumn.Visible; set => valueTypeColumn.Visible = value; } + [DefaultValue(true)] public bool ShowValueColumn { get => valueColumn.Visible; set => valueColumn.Visible = value; } + [DefaultValue(true)] public bool ShowPreviousValueColumn { get => previousValueColumn.Visible; diff --git a/ReClass.NET/Controls/MemoryViewControl.cs b/ReClass.NET/Controls/MemoryViewControl.cs index 64b8dfa4..c7c00952 100644 --- a/ReClass.NET/Controls/MemoryViewControl.cs +++ b/ReClass.NET/Controls/MemoryViewControl.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics.Contracts; using System.Drawing; using System.Linq; @@ -60,6 +61,8 @@ public SelectedNodeInfo(BaseNode node, RemoteProcess process, MemoryBuffer memor private readonly FontEx font; + [DefaultValue(null)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public ContextMenuStrip NodeContextMenuStrip { get; set; } public event DrawContextRequestEventHandler DrawContextRequested; diff --git a/ReClass.NET/Controls/ProjectView.cs b/ReClass.NET/Controls/ProjectView.cs index f1b12261..6b1d6567 100644 --- a/ReClass.NET/Controls/ProjectView.cs +++ b/ReClass.NET/Controls/ProjectView.cs @@ -211,12 +211,20 @@ public bool EnableClassHierarchyView } } + [DefaultValue(null)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public ContextMenuStrip ClassesContextMenuStrip { get; set; } + [DefaultValue(null)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public ContextMenuStrip ClassContextMenuStrip { get; set; } + [DefaultValue(null)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public ContextMenuStrip EnumsContextMenuStrip { get; set; } + [DefaultValue(null)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public ContextMenuStrip EnumContextMenuStrip { get; set; } public ProjectView() diff --git a/ReClass.NET/Extensions/EnumerableExtension.cs b/ReClass.NET/Extensions/EnumerableExtension.cs index 0619c87f..6c0b1c20 100644 --- a/ReClass.NET/Extensions/EnumerableExtension.cs +++ b/ReClass.NET/Extensions/EnumerableExtension.cs @@ -104,23 +104,6 @@ public static IEnumerable TakeWhileInclusive(this IEnumerable< } } - [DebuggerStepThrough] - public static IEnumerable DistinctBy(this IEnumerable source, Func keySelector) - { - Contract.Requires(source != null); - Contract.Requires(keySelector != null); - Contract.Ensures(Contract.Result>() != null); - - var knownKeys = new HashSet(); - foreach (var element in source) - { - if (knownKeys.Add(keySelector(element))) - { - yield return element; - } - } - } - [DebuggerStepThrough] public static bool IsEquivalentTo(this IEnumerable source, IEnumerable other) { diff --git a/ReClass.NET/Forms/MainForm.cs b/ReClass.NET/Forms/MainForm.cs index e771a10d..0198a3a8 100644 --- a/ReClass.NET/Forms/MainForm.cs +++ b/ReClass.NET/Forms/MainForm.cs @@ -45,6 +45,8 @@ public partial class MainForm : IconForm public MenuStrip MainMenu => mainMenuStrip; + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ClassNode CurrentClassNode { get => currentClassNode; diff --git a/ReClass.NET/Program.cs b/ReClass.NET/Program.cs index f28cb0bd..7fce8169 100644 --- a/ReClass.NET/Program.cs +++ b/ReClass.NET/Program.cs @@ -3,6 +3,7 @@ using System.Drawing; using System.Globalization; using System.Windows.Forms; +using System.Text; using Microsoft.SqlServer.MessageBox; using ReClassNET.Core; using ReClassNET.Forms; @@ -41,6 +42,8 @@ static void Main(string[] args) CommandLineArgs = new CommandLineArgs(args); + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + try { DpiUtil.ConfigureProcess(); diff --git a/ReClass.NET/ReClass.NET.csproj b/ReClass.NET/ReClass.NET.csproj index 0c990cc2..a654b0a1 100644 --- a/ReClass.NET/ReClass.NET.csproj +++ b/ReClass.NET/ReClass.NET.csproj @@ -1,1038 +1,113 @@ - - - + - Debug - x86 - {BFB8917D-E9B4-463F-A6E8-612C35728C78} + net9.0-windows10.0.20348.0 WinExe - Properties ReClassNET ReClass.NET - v4.7.2 - 512 - true - - - 0 - + true latest + x86;x64 + Resources\Icon\ReClassNet.ico + False + false + false + App.config + false - + + x86 true full false $(SolutionDir)bin\Debug\x86\ $(SolutionDir)obj\$(Configuration)\x86\$(MSBuildProjectName)\ - TRACE;DEBUG - prompt + $(DefineConstants) 4 - false - False - False - True - False - False - False - True - True - True - True - True - True - True - True - False - True - False - True - False - False - False - False - True - False - True - True - True - False - False - - - - - - - - True - False - False - True - Full - %28none%29 - 3 - + + x86 pdbonly true $(SolutionDir)bin\Release\x86\ $(SolutionDir)obj\$(Configuration)\x86\$(MSBuildProjectName)\ - TRACE;RELEASE - prompt + $(DefineConstants);RELEASE 4 - + + x64 true full false $(SolutionDir)bin\Debug\x64\ $(SolutionDir)obj\$(Configuration)\x64\$(MSBuildProjectName)\ - TRACE;DEBUG;RECLASSNET64 - prompt + $(DefineConstants);RECLASSNET64 4 - false - + + x64 pdbonly true $(SolutionDir)bin\Release\x64\ $(SolutionDir)obj\$(Configuration)\x64\$(MSBuildProjectName)\ - TRACE;RECLASSNET64;RELEASE - prompt + $(DefineConstants);RECLASSNET64;RELEASE 4 - - Resources\Icon\ReClassNet.ico - - + - - False + ..\Dependencies\ColorCode.dll + false ..\Dependencies\Dia2Lib.dll - True + true - - False + ..\Dependencies\Microsoft.ExceptionMessageBox.dll + false - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Form - - - EnumEditorForm.cs - - - Form - - - EnumListForm.cs - - - Form - - - EnumSelectionForm.cs - - - Form - - - Form - - - NamedAddressesForm.cs - - - Form - - - ClassSelectionForm.cs - - - Form - - - FoundCodeForm.cs - - - Form - - - InputBytesForm.cs - - - - Form - - - InputCorrelatorForm.cs - - - Form - - - ScannerForm.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Component - - - True - True - Resources.resx - - - - - - - - - - Form - - - AboutForm.cs - - - - - - - - - UserControl - - - ProjectView.cs - - - Form - - - CodeForm.cs - - - UserControl - - - ColorBox.cs - - - Component - - - Form - - - Form - - - LogForm.cs - - - UserControl - - - DualValueBox.cs - - - Component - - - - UserControl - - - HotkeyBox.cs - - - Component - - - - - Component - - - UserControl - - - MemoryRecordList.cs - - - MemoryViewControl.cs - - - - - Component - - - - - - - - - - - - - - - - - - - - - - - Form - - - PluginForm.cs - - - Form - - - SettingsForm.cs - - - - - Component - - - Form - - - MainForm.cs - - - - - - - - - - - - UserControl - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Form - - - ProcessBrowserForm.cs - - - Form - - - ProcessInfoForm.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AboutForm.cs - - - EnumEditorForm.cs - - - EnumListForm.cs - - - EnumSelectionForm.cs - - - NamedAddressesForm.cs - - - ClassSelectionForm.cs - Designer - - - CodeForm.cs - - - FoundCodeForm.cs - - - InputBytesForm.cs - - - InputCorrelatorForm.cs - - - ScannerForm.cs - - - ProjectView.cs - Designer - - - LogForm.cs - - - MainForm.cs - Designer - - - ColorBox.cs - - - DualValueBox.cs - - - HotkeyBox.cs - - - MemoryRecordList.cs - - - MemoryViewControl.cs - - - PluginForm.cs - - - ProcessBrowserForm.cs - - - ProcessInfoForm.cs - - - SettingsForm.cs - - + + + + + + + + + + + + + + ResXFileCodeGenerator - Designer Resources.Designer.cs - - + SettingsSingleFileGenerator Settings.Designer.cs - + + True + True + Resources.resx + + + True True Settings.settings - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - powershell -Command "((Get-Date).ToUniversalTime()).ToString(\"yyyy\/MM\/dd HH:mm:ss\") | Out-File '$(ProjectDir)Resources\BuildDate.txt'" - date +"%Y/%m/%d %H:%M:%S" > $(ProjectDir)/Resources/BuildDate.txt - - - \ No newline at end of file + diff --git a/ReClass.NET/Util/PathUtil.cs b/ReClass.NET/Util/PathUtil.cs index e8823d5d..f7feec4c 100644 --- a/ReClass.NET/Util/PathUtil.cs +++ b/ReClass.NET/Util/PathUtil.cs @@ -21,8 +21,12 @@ public class PathUtil if (string.IsNullOrEmpty(path)) { - path = Assembly.GetExecutingAssembly().GetName().CodeBase; - path = FileUrlToPath(path); + path = Environment.ProcessPath; + } + + if (string.IsNullOrEmpty(path)) + { + path = Assembly.GetEntryAssembly()?.Location; } return path; diff --git a/ReClass.NET_Launcher/App.config b/ReClass.NET_Launcher/App.config index ecdcf8a5..7de168f0 100644 --- a/ReClass.NET_Launcher/App.config +++ b/ReClass.NET_Launcher/App.config @@ -1,6 +1,3 @@ - - - diff --git a/ReClass.NET_Launcher/ReClass.NET_Launcher.csproj b/ReClass.NET_Launcher/ReClass.NET_Launcher.csproj index 87001366..f040db2c 100644 --- a/ReClass.NET_Launcher/ReClass.NET_Launcher.csproj +++ b/ReClass.NET_Launcher/ReClass.NET_Launcher.csproj @@ -1,97 +1,56 @@ - - - + - Debug - AnyCPU - {16591D29-2370-428A-BA11-87E38D0F3551} + net9.0-windows WinExe ReClassNET_Launcher ReClass.NET_Launcher - v4.7.2 - 512 - true - + true + latest + AnyCPU + ReClassNet.ico + false + false + false + App.config - + + AnyCPU true full false $(SolutionDir)bin\Debug\ $(SolutionDir)obj\$(Configuration)\any\$(MSBuildProjectName)\ - DEBUG;TRACE - prompt + $(DefineConstants) 4 false - latest - + + AnyCPU pdbonly true $(SolutionDir)bin\Release\ $(SolutionDir)obj\$(Configuration)\any\$(MSBuildProjectName)\ - TRACE - prompt + $(DefineConstants);RELEASE 4 false - latest - - ReClassNet.ico - - - - - - - - - - - - - - Constants.cs - - - DataExchange\ReClass\ReClassNetFile.Constants.cs - - - Native\INativeMethods.cs - - - Native\NativeMethods.cs - - - Native\NativeMethods.Unix.cs - - - Native\NativeMethods.Windows.cs - - - Extensions\IntPtrExtensions.cs - - - Util\PathUtil.cs - - - Util\CommandLineArgs.cs - - - Util\WinUtil.cs - - - - - + - + + + + + + + + + + + - + - - - \ No newline at end of file + diff --git a/ReClass.NET_Tests/ReClass.NET_Tests.csproj b/ReClass.NET_Tests/ReClass.NET_Tests.csproj index 02c7ae25..3a79f8da 100644 --- a/ReClass.NET_Tests/ReClass.NET_Tests.csproj +++ b/ReClass.NET_Tests/ReClass.NET_Tests.csproj @@ -1,130 +1,72 @@ - - - + - Debug - x86 - {E2D0424D-738F-41C3-9935-1B282624600F} - Library - Properties - ReClass.NET_Tests - ReClass.NET_Tests - v4.7.2 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - UnitTest - - - latest + net9.0-windows10.0.20348.0 + true + x86;x64 + False + false + false - + + + x86 true full false bin\Debug\ - DEBUG;TRACE - prompt + obj\$(Configuration)\x86\ + $(DefineConstants) 4 - x86 - + + + x86 pdbonly true bin\Release\ - TRACE - prompt + obj\$(Configuration)\x86\ + $(DefineConstants);RELEASE 4 - x86 - + + + x64 true full false bin\Debug\ - TRACE;DEBUG;RECLASSNET64 - prompt + obj\$(Configuration)\x64\ + $(DefineConstants);RECLASSNET64 4 - x64 - + + + x64 pdbonly true bin\Release\ - TRACE;RECLASSNET64 - prompt + obj\$(Configuration)\x64\ + $(DefineConstants);RECLASSNET64;RELEASE 4 - x64 + - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {bfb8917d-e9b4-463f-a6e8-612c35728c78} - ReClass.NET - - - - - 4.10.1 - - - 2.5.0 - - - 2.4.1 - - - 2.4.1 + + + + runtime; build; native; contentfiles; analyzers all - - - \ No newline at end of file + + + + Code + + + From 6e71ca6488a4127bc45a4236935ccecb9c5462c9 Mon Sep 17 00:00:00 2001 From: RequiDev Date: Fri, 23 Jan 2026 17:12:03 +0100 Subject: [PATCH 03/13] Make project Windows-only --- Makefile | 40 +- NativeCore/Unix/CloseRemoteProcess.cpp | 6 - NativeCore/Unix/ControlRemoteProcess.cpp | 19 - NativeCore/Unix/Debugger.cpp | 300 --------------- NativeCore/Unix/DisassembleCode.cpp | 6 - NativeCore/Unix/EnumerateProcesses.cpp | 137 ------- .../EnumerateRemoteSectionsAndModules.cpp | 131 ------- NativeCore/Unix/Input.cpp | 17 - NativeCore/Unix/IsProcessValid.cpp | 9 - NativeCore/Unix/Makefile | 344 ------------------ NativeCore/Unix/NativeCore.Unix.vcxproj | 183 ---------- .../Unix/NativeCore.Unix.vcxproj.filters | 119 ------ NativeCore/Unix/NativeCore.hpp | 49 --- NativeCore/Unix/OpenRemoteProcess.cpp | 6 - NativeCore/Unix/ReadRemoteMemory.cpp | 21 -- NativeCore/Unix/WriteRemoteMemory.cpp | 21 -- README.md | 3 +- ReClass.NET.sln | 12 - ReClass.NET/Core/InternalCoreFunctions.cs | 4 +- ReClass.NET/Forms/MainForm.Functions.cs | 2 + ReClass.NET/Forms/ProcessBrowserForm.cs | 6 +- ReClass.NET/Forms/ProcessInfoForm.cs | 6 +- ReClass.NET/Forms/SettingsForm.cs | 12 +- ReClass.NET/Native/NativeMethods.Unix.cs | 72 ---- ReClass.NET/Native/NativeMethods.cs | 46 +-- ReClass.NET/Plugins/PluginInfo.cs | 2 +- ReClass.NET/Program.cs | 2 +- ReClass.NET/Properties/AssemblyInfo.cs | 4 +- ReClass.NET/Symbols/SymbolStore.cs | 27 -- .../Properties/AssemblyInfo.cs | 4 +- .../ReClass.NET_Launcher.csproj | 1 - 31 files changed, 19 insertions(+), 1592 deletions(-) delete mode 100644 NativeCore/Unix/CloseRemoteProcess.cpp delete mode 100644 NativeCore/Unix/ControlRemoteProcess.cpp delete mode 100644 NativeCore/Unix/Debugger.cpp delete mode 100644 NativeCore/Unix/DisassembleCode.cpp delete mode 100644 NativeCore/Unix/EnumerateProcesses.cpp delete mode 100644 NativeCore/Unix/EnumerateRemoteSectionsAndModules.cpp delete mode 100644 NativeCore/Unix/Input.cpp delete mode 100644 NativeCore/Unix/IsProcessValid.cpp delete mode 100644 NativeCore/Unix/Makefile delete mode 100644 NativeCore/Unix/NativeCore.Unix.vcxproj delete mode 100644 NativeCore/Unix/NativeCore.Unix.vcxproj.filters delete mode 100644 NativeCore/Unix/NativeCore.hpp delete mode 100644 NativeCore/Unix/OpenRemoteProcess.cpp delete mode 100644 NativeCore/Unix/ReadRemoteMemory.cpp delete mode 100644 NativeCore/Unix/WriteRemoteMemory.cpp delete mode 100644 ReClass.NET/Native/NativeMethods.Unix.cs diff --git a/Makefile b/Makefile index 750027d5..e6142258 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all clean debug clean_debug release clean_release update docker_all docker_debug docker_release podman_all podman_debug podman_release dist +.PHONY: all clean debug clean_debug release clean_release update dist all: debug release dist @@ -7,66 +7,28 @@ clean: clean_debug clean_release debug: cd ReClass.NET_Launcher && make debug cd ReClass.NET && make debug - cd NativeCore/Unix && make debug clean_debug: cd ReClass.NET_Launcher && make clean_debug cd ReClass.NET && make clean_debug - cd NativeCore/Unix && make clean_debug rm -rf build/Debug release: cd ReClass.NET_Launcher && make release cd ReClass.NET && make release - cd NativeCore/Unix && make release clean_release: cd ReClass.NET_Launcher && make clean_release cd ReClass.NET && make clean_release - cd NativeCore/Unix && make clean_release rm -rf build/Release update: cd ReClass.NET && make update -docker_all: - make docker_debug - make docker_release - make dist - -docker_debug: - cd ReClass.NET_Launcher && make docker_debug - cd ReClass.NET && make docker_debug - docker container run --rm -v ${PWD}:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) gcc_multilib:latest bash -c "cd NativeCore/Unix && make debug" - -docker_release: - cd ReClass.NET_Launcher && make docker_release - cd ReClass.NET && make docker_release - docker container run --rm -v ${PWD}:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) gcc_multilib:latest bash -c "cd NativeCore/Unix && make release" - -podman_all: - make podman_debug - make podman_release - make dist - -podman_debug: - cd ReClass.NET_Launcher && make podman_debug - cd ReClass.NET && make podman_debug - podman container run --rm -v ${PWD}:/build:z -w /build gcc_multilib:latest bash -c "cd NativeCore/Unix && make debug" - -podman_release: - cd ReClass.NET_Launcher && make podman_release - cd ReClass.NET && make podman_release - podman container run --rm -v ${PWD}:/build:z -w /build gcc_multilib:latest bash -c "cd NativeCore/Unix && make release" - dist: test -d build || mkdir -p build cp -r ReClass.NET/bin/* build/ cp -r ReClass.NET_Launcher/bin/* build/ - cp NativeCore/Unix/build/debug/x86/NativeCore.so build/Debug/x86 - cp NativeCore/Unix/build/debug/x64/NativeCore.so build/Debug/x64 - cp NativeCore/Unix/build/release/x86/NativeCore.so build/Release/x86 - cp NativeCore/Unix/build/release/x64/NativeCore.so build/Release/x64 test -d build/Debug/x86/Plugins || mkdir build/Debug/x86/Plugins test -d build/Debug/x64/Plugins || mkdir build/Debug/x64/Plugins test -d build/Release/x86/Plugins || mkdir build/Release/x86/Plugins diff --git a/NativeCore/Unix/CloseRemoteProcess.cpp b/NativeCore/Unix/CloseRemoteProcess.cpp deleted file mode 100644 index cf5dc94b..00000000 --- a/NativeCore/Unix/CloseRemoteProcess.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "NativeCore.hpp" - -extern "C" void RC_CallConv CloseRemoteProcess(RC_Pointer handle) -{ - -} diff --git a/NativeCore/Unix/ControlRemoteProcess.cpp b/NativeCore/Unix/ControlRemoteProcess.cpp deleted file mode 100644 index 36c86945..00000000 --- a/NativeCore/Unix/ControlRemoteProcess.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//#include -#include - -#include "NativeCore.hpp" - -extern "C" void RC_CallConv ControlRemoteProcess(RC_Pointer handle, ControlRemoteProcessAction action) -{ - int signal = SIGKILL; - if (action == ControlRemoteProcessAction::Suspend) - { - signal = SIGSTOP; - } - else if (action == ControlRemoteProcessAction::Resume) - { - signal = SIGCONT; - } - - kill(static_cast(reinterpret_cast(handle)), signal); -} diff --git a/NativeCore/Unix/Debugger.cpp b/NativeCore/Unix/Debugger.cpp deleted file mode 100644 index a4a74241..00000000 --- a/NativeCore/Unix/Debugger.cpp +++ /dev/null @@ -1,300 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "NativeCore.hpp" - -namespace fs = std::experimental::filesystem; - -int ualarm(unsigned int milliseconds) -{ - struct itimerval nval = { 0 }; - nval.it_value.tv_sec = milliseconds / 1000; - nval.it_value.tv_usec = static_cast(milliseconds % 1000) * 1000; - struct itimerval oval; - if (setitimer(ITIMER_REAL, &nval, &oval) < 0) - return 0; - else - return oval.it_value.tv_sec; -} - -pid_t waitpid_timeout(pid_t pid, int* status, int options, int timeoutInMilliseconds, bool& timedOut) -{ - struct sigaction sig = {}; - sig.sa_flags = 0; - sig.sa_handler = [](int) {}; - sigfillset(&sig.sa_mask); - sigaction(SIGALRM, &sig, nullptr); - - ualarm(timeoutInMilliseconds); - - auto res = waitpid(pid, status, options); - if (res == -1 && errno == EINTR) - { - timedOut = true; - } - else - { - ualarm(0); // Cancel the alarm. - - timedOut = false; - } - return res; -} - -pid_t waitpid_timeout(int* status, int timeoutInMilliseconds, bool& timedOut) -{ - return waitpid_timeout(-1, status, 0, timeoutInMilliseconds, timedOut); -} - -extern "C" bool RC_CallConv AttachDebuggerToProcess(RC_Pointer id) -{ - //TODO: Attach to all threads. - - ptrace(PTRACE_ATTACH, static_cast(reinterpret_cast(id)), nullptr, nullptr); - - waitpid(-1, nullptr, 0); - - ptrace(PTRACE_CONT, static_cast(reinterpret_cast(id)), nullptr, nullptr); - - return false; -} - -extern "C" void RC_CallConv DetachDebuggerFromProcess(RC_Pointer id) -{ - //TODO: Detach to all threads. - - ptrace(PTRACE_DETACH, static_cast(reinterpret_cast(id)), nullptr, nullptr); -} - -extern "C" bool RC_CallConv AwaitDebugEvent(DebugEvent* evt, int timeoutInMilliseconds) -{ - int status; - bool timedOut; - - auto tid = waitpid_timeout(&status, timeoutInMilliseconds, timedOut); - - if (timedOut) - { - return false; - } - - auto result = false; - - if (tid > 0) - { - evt->ThreadId = reinterpret_cast(static_cast(tid)); - - siginfo_t si; - if (ptrace(PTRACE_GETSIGINFO, tid, nullptr, &si) == 0) - { - if (si.si_signo == SIGTRAP) - { - struct user_regs_struct regs; - if (ptrace(PTRACE_GETREGS, tid, nullptr, ®s) == 0) - { - DebugRegister6 dr6; - dr6.Value = ptrace(PTRACE_PEEKUSER, tid, offsetof(struct user, u_debugreg[6]), nullptr); - - // Check if breakpoint was a hardware breakpoint. - if (dr6.DR0) - { - evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::Dr0; - } - else if (dr6.DR1) - { - evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::Dr1; - } - else if (dr6.DR2) - { - evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::Dr2; - } - else if (dr6.DR3) - { - evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::Dr3; - } - else - { - evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::InvalidRegister; - } - - // Copy registers. - auto& reg = evt->ExceptionInfo.Registers; -#ifdef RECLASSNET64 - reg.Rax = reinterpret_cast(regs.rax); - reg.Rbx = reinterpret_cast(regs.rbx); - reg.Rcx = reinterpret_cast(regs.rcx); - reg.Rdx = reinterpret_cast(regs.rdx); - reg.Rdi = reinterpret_cast(regs.rdi); - reg.Rsi = reinterpret_cast(regs.rsi); - reg.Rsp = reinterpret_cast(regs.rsp); - reg.Rbp = reinterpret_cast(regs.rbp); - reg.Rip = reinterpret_cast(regs.rip); - - reg.R8 = reinterpret_cast(regs.r8); - reg.R9 = reinterpret_cast(regs.r9); - reg.R10 = reinterpret_cast(regs.r10); - reg.R11 = reinterpret_cast(regs.r11); - reg.R12 = reinterpret_cast(regs.r12); - reg.R13 = reinterpret_cast(regs.r13); - reg.R14 = reinterpret_cast(regs.r14); - reg.R15 = reinterpret_cast(regs.r15); -#else - reg.Eax = reinterpret_cast(regs.eax); - reg.Ebx = reinterpret_cast(regs.ebx); - reg.Ecx = reinterpret_cast(regs.ecx); - reg.Edx = reinterpret_cast(regs.edx); - reg.Edi = reinterpret_cast(regs.edi); - reg.Esi = reinterpret_cast(regs.esi); - reg.Esp = reinterpret_cast(regs.esp); - reg.Ebp = reinterpret_cast(regs.ebp); - reg.Eip = reinterpret_cast(regs.eip); -#endif - - result = true; - } - } - - if (result == false) - { - ptrace(PTRACE_CONT, tid, nullptr, si.si_signo); - } - } - } - - return result; -} - -extern "C" void RC_CallConv HandleDebugEvent(DebugEvent* evt) -{ - auto tid = static_cast(reinterpret_cast(evt->ThreadId)); - - siginfo_t si; - if (ptrace(PTRACE_GETSIGINFO, tid, 0, &si) == 0) - { - auto signal = 0; - switch (evt->ContinueStatus) - { - case DebugContinueStatus::Handled: - signal = 0; - break; - case DebugContinueStatus::NotHandled: - signal = si.si_signo; - break; - } - - if (signal == SIGSTOP) - { - signal = 0; - } - - ptrace(PTRACE_CONT, tid, nullptr, signal); - } -} - -extern "C" bool RC_CallConv SetHardwareBreakpoint(RC_Pointer id, RC_Pointer address, HardwareBreakpointRegister reg, HardwareBreakpointTrigger type, HardwareBreakpointSize size, bool set) -{ - if (reg == HardwareBreakpointRegister::InvalidRegister) - { - return false; - } - - intptr_t addressValue = 0; - auto accessValue = 0; - auto lengthValue = 0; - - if (set) - { - addressValue = reinterpret_cast(address); - - if (type == HardwareBreakpointTrigger::Execute) - accessValue = 0; - else if (type == HardwareBreakpointTrigger::Access) - accessValue = 3; - else if (type == HardwareBreakpointTrigger::Write) - accessValue = 1; - - if (size == HardwareBreakpointSize::Size1) - lengthValue = 0; - else if (size == HardwareBreakpointSize::Size2) - lengthValue = 1; - else if (size == HardwareBreakpointSize::Size4) - lengthValue = 3; - else if (size == HardwareBreakpointSize::Size8) - lengthValue = 2; - } - - auto tasksPath = fs::path("/proc") / std::to_string(reinterpret_cast(id)) / "task"; - if (fs::is_directory(tasksPath)) - { - for (auto& d : fs::directory_iterator(tasksPath)) - { - if (fs::is_directory(d)) - { - auto taskPath = d.path(); - - auto name = taskPath.filename().string(); - if (is_number(name)) - { - auto tid = parse_type(name); - - // Stop the thread. TODO: Check if the thread was already paused. - for (int i = 0; i < 10; ++i) - { - kill(tid, SIGSTOP); - - bool timedOut; - waitpid_timeout(tid, nullptr, 0, 100, timedOut); - if (!timedOut) - { - break; - } - } - - DebugRegister7 dr7; - dr7.Value = ptrace(PTRACE_PEEKUSER, tid, offsetof(struct user, u_debugreg[7]), nullptr); - - intptr_t registerAddress; - switch (reg) - { - case HardwareBreakpointRegister::Dr0: - registerAddress = offsetof(struct user, u_debugreg[0]); - dr7.G0 = true; - dr7.RW0 = accessValue; - dr7.Len0 = lengthValue; - break; - case HardwareBreakpointRegister::Dr1: - registerAddress = offsetof(struct user, u_debugreg[1]); - dr7.G1 = true; - dr7.RW1 = accessValue; - dr7.Len1 = lengthValue; - break; - case HardwareBreakpointRegister::Dr2: - registerAddress = offsetof(struct user, u_debugreg[2]); - dr7.G2 = true; - dr7.RW2 = accessValue; - dr7.Len2 = lengthValue; - break; - case HardwareBreakpointRegister::Dr3: - registerAddress = offsetof(struct user, u_debugreg[3]); - dr7.G3 = true; - dr7.RW3 = accessValue; - dr7.Len3 = lengthValue; - break; - } - - ptrace(PTRACE_POKEUSER, tid, registerAddress, addressValue); - ptrace(PTRACE_POKEUSER, tid, offsetof(struct user, u_debugreg[7]), dr7.Value); - - ptrace(PTRACE_CONT, tid, nullptr, nullptr); - } - } - } - } - - return true; -} diff --git a/NativeCore/Unix/DisassembleCode.cpp b/NativeCore/Unix/DisassembleCode.cpp deleted file mode 100644 index 9c2cc5af..00000000 --- a/NativeCore/Unix/DisassembleCode.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "../Shared/DistormHelper.hpp" - -extern "C" bool RC_CallConv DisassembleCode(RC_Pointer address, RC_Size length, RC_Pointer virtualAddress, bool determineStaticInstructionBytes, EnumerateInstructionCallback callback) -{ - return DisassembleInstructionsImpl(address, length, virtualAddress, determineStaticInstructionBytes, callback); -} diff --git a/NativeCore/Unix/EnumerateProcesses.cpp b/NativeCore/Unix/EnumerateProcesses.cpp deleted file mode 100644 index f04bcaf1..00000000 --- a/NativeCore/Unix/EnumerateProcesses.cpp +++ /dev/null @@ -1,137 +0,0 @@ -#include -#include -#include -#include -#include - -#include "NativeCore.hpp" - -namespace fs = std::experimental::filesystem; - -// std::filesystem library doesn't work @Ubuntu 16.10, read_symlink() always fails. -#define USE_CUSTOM_READ_SYMLINK - -#ifdef USE_CUSTOM_READ_SYMLINK -#include - -fs::path my_read_symlink(const fs::path& p, std::error_code& ec) -{ - fs::path symlink_path; - - std::string temp(64, '\0'); - for (;; temp.resize(temp.size() * 2)) - { - ssize_t result; - if ((result = ::readlink(p.c_str(), /*temp.data()*/ &temp[0], temp.size())) == -1) - { - ec.assign(errno, std::system_category()); - break; - } - else - { - if (result != static_cast(temp.size())) - { - symlink_path = fs::path(std::string(temp.begin(), temp.begin() + result)); - - ec.clear(); - - break; - } - } - } - - return symlink_path; -} - -#endif - -enum class Platform -{ - Unknown, - X86, - X64 -}; - -Platform GetProcessPlatform(const std::string& auxvPath) -{ - auto platform = Platform::Unknown; - - std::ifstream file(auxvPath); - if (file) - { - char buffer[16]; - while (true) - { - file.read(buffer, 16); - - if (!file) - { - return Platform::X64; - } - - if (buffer[4] != 0 || buffer[5] != 0 || buffer[6] != 0 || buffer[7] != 0) - { - return Platform::X86; - } - } - } - - return platform; -} - -extern "C" void RC_CallConv EnumerateProcesses(EnumerateProcessCallback callbackProcess) -{ - if (callbackProcess == nullptr) - { - return; - } - - fs::path procPath("/proc"); - if (fs::is_directory(procPath)) - { - for (auto& d : fs::directory_iterator(procPath)) - { - if (fs::is_directory(d)) - { - auto processPath = d.path(); - - auto name = processPath.filename().string(); - if (is_number(name)) - { - auto exeSymLink = processPath / "exe"; - if (fs::is_symlink(fs::symlink_status(exeSymLink))) - { - std::error_code ec; - auto linkPath = -#ifdef USE_CUSTOM_READ_SYMLINK - my_read_symlink -#else - read_symlink -#endif - (exeSymLink, ec).string(); - if (!ec) - { - auto auxvPath = processPath / "auxv"; - - auto platform = GetProcessPlatform(auxvPath.string()); -#ifdef RECLASSNET64 - if (platform == Platform::X64) -#else - if (platform == Platform::X86) -#endif - { - EnumerateProcessData data = {}; - data.Id = parse_type(name); - MultiByteToUnicode(linkPath.c_str(), data.Path, PATH_MAXIMUM_LENGTH); - const auto name = fs::path(data.Path).filename().u16string(); - str16cpy(data.Name, name.c_str(), std::min(name.length(), PATH_MAXIMUM_LENGTH - 1)); - - callbackProcess(&data); - } - } - } - } - } - } - } -} diff --git a/NativeCore/Unix/EnumerateRemoteSectionsAndModules.cpp b/NativeCore/Unix/EnumerateRemoteSectionsAndModules.cpp deleted file mode 100644 index 9d821cfe..00000000 --- a/NativeCore/Unix/EnumerateRemoteSectionsAndModules.cpp +++ /dev/null @@ -1,131 +0,0 @@ -#include -#include -#include - -#include "NativeCore.hpp" - -inline bool operator&(SectionProtection& lhs, SectionProtection rhs) -{ - using T = std::underlying_type_t; - - return (static_cast(lhs) & static_cast(rhs)) == static_cast(rhs); -} - -template -inline std::istream& skip(std::istream& s) -{ - auto f = s.flags(); - s >> std::noskipws; - - T t; - s >> t; - - s.flags(f); - - return s; -} - -std::istream& operator >> (std::istream& s, SectionProtection& protection) -{ - protection = SectionProtection::NoAccess; - - if (s.get() == 'r') protection |= SectionProtection::Read; - if (s.get() == 'w') protection |= SectionProtection::Write; - if (s.get() == 'x') protection |= SectionProtection::Execute; - - return s; -} - -extern "C" void RC_CallConv EnumerateRemoteSectionsAndModules(RC_Pointer handle, EnumerateRemoteSectionsCallback callbackSection, EnumerateRemoteModulesCallback callbackModule) -{ - if (callbackSection == nullptr && callbackModule == nullptr) - { - return; - } - - struct ModuleInfo - { - intptr_t Start = 0; - intptr_t End = 0; - RC_UnicodeChar Path[PATH_MAXIMUM_LENGTH] = {}; - }; - - auto path = std::stringstream(); - path << "/proc/" << reinterpret_cast(handle) << "/maps"; - std::ifstream input(path.str()); - - std::unordered_map modules; - - std::string line; - while (std::getline(input, line)) - { - std::stringstream ss(line); - - intptr_t start; - intptr_t end; - SectionProtection protection; - intptr_t offset; - int dev1, dev2; - int inode; - std::string path; - ss >> std::hex >> start >> skip >> end >> skip >> protection >> skip >> offset >> dev1 >> skip >> dev2 >> std::dec >> inode >> std::skipws >> path; - - EnumerateRemoteSectionData section = {}; - section.BaseAddress = reinterpret_cast(start); - section.Size = end - start; - section.Protection = protection; - - section.Category = SectionCategory::Unknown; - section.Type = SectionType::Unknown; - if (inode != 0) - { - section.Type = SectionType::Image; - - if (protection & SectionProtection::Read && protection & SectionProtection::Execute) - { - section.Category = SectionCategory::CODE; - } - else if (protection & SectionProtection::Read && protection & SectionProtection::Write) - { - section.Category = SectionCategory::DATA; - } - - MultiByteToUnicode(path.c_str(), section.ModulePath, PATH_MAXIMUM_LENGTH); - - auto& module = modules[inode]; - module.Start = module.Start != 0 ? std::min(module.Start, start) : start; - module.End = module.End != 0 ? std::max(module.End, end) : end; - if (module.Path[0] == 0) - { - std::memcpy(module.Path, section.ModulePath, PATH_MAXIMUM_LENGTH); - } - } - else - { - section.Type = SectionType::Mapped; - - if (protection & SectionProtection::Read || protection & SectionProtection::Write) - { - section.Category = SectionCategory::HEAP; - } - } - - if (callbackSection != nullptr) - { - callbackSection(§ion); - } - } - - if (callbackModule != nullptr) - { - for (auto&& kv : modules) - { - EnumerateRemoteModuleData module = {}; - module.BaseAddress = reinterpret_cast(kv.second.Start); - module.Size = kv.second.End - kv.second.Start; - std::memcpy(module.Path, kv.second.Path, PATH_MAXIMUM_LENGTH); - - callbackModule(&module); - } - } -} diff --git a/NativeCore/Unix/Input.cpp b/NativeCore/Unix/Input.cpp deleted file mode 100644 index dc17d856..00000000 --- a/NativeCore/Unix/Input.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "NativeCore.hpp" -#include "../Shared/Keys.hpp" - -RC_Pointer RC_CallConv InitializeInput() -{ - return nullptr; -} - -bool RC_CallConv GetPressedKeys(RC_Pointer handle, Keys* state[], int* count) -{ - return false; -} - -void RC_CallConv ReleaseInput(RC_Pointer handle) -{ - -} diff --git a/NativeCore/Unix/IsProcessValid.cpp b/NativeCore/Unix/IsProcessValid.cpp deleted file mode 100644 index f72b7c90..00000000 --- a/NativeCore/Unix/IsProcessValid.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -#include "NativeCore.hpp" - -extern "C" bool RC_CallConv IsProcessValid(RC_Pointer handle) -{ - return kill(static_cast(reinterpret_cast(handle)), 0) == 0; -} diff --git a/NativeCore/Unix/Makefile b/NativeCore/Unix/Makefile deleted file mode 100644 index f18ff1fb..00000000 --- a/NativeCore/Unix/Makefile +++ /dev/null @@ -1,344 +0,0 @@ -WORKDIR = `pwd` - -CC = gcc -CXX = gcc -AR = ar -LD = g++ -WINDRES = windres - -INC = -I../Dependencies/distorm/include -CFLAGS32 = -Wall -fPIC -m32 -CFLAGS64 = -Wall -fPIC -m64 -DRECLASSNET64=1 -RESINC = -LIBDIR = -LIB = -lstdc++fs -lstdc++ -LDFLAGS32 = -m32 -shared -Wl,--no-undefined -LDFLAGS64 = -m64 -shared -Wl,--no-undefined - -INC_DEBUG = $(INC) -CFLAGS32_DEBUG = $(CFLAGS32) -g -CFLAGS64_DEBUG = $(CFLAGS64) -g -RESINC_DEBUG = $(RESINC) -RCFLAGS_DEBUG = $(RCFLAGS) -LIBDIR_DEBUG = $(LIBDIR) -LIB_DEBUG = $(LIB) -LDFLAGS32_DEBUG = $(LDFLAGS32) -LDFLAGS64_DEBUG = $(LDFLAGS64) -OBJDIR32_DEBUG = obj/debug/x86 -OBJDIR64_DEBUG = obj/debug/x64 -DEP_DEBUG = -OUT32_DEBUG = build/debug/x86/NativeCore.so -OUT64_DEBUG = build/debug/x64/NativeCore.so - -INC_RELEASE = $(INC) -CFLAGS32_RELEASE = $(CFLAGS32) -O2 -CFLAGS64_RELEASE = $(CFLAGS64) -O2 -RESINC_RELEASE = $(RESINC) -RCFLAGS_RELEASE = $(RCFLAGS) -LIBDIR_RELEASE = $(LIBDIR) -LIB_RELEASE = $(LIB) -LDFLAGS32_RELEASE = $(LDFLAGS32) -s -LDFLAGS64_RELEASE = $(LDFLAGS64) -s -OBJDIR32_RELEASE = obj/release/x86 -OBJDIR64_RELEASE = obj/release/x64 -DEP_RELEASE = -OUT32_RELEASE = build/release/x86/NativeCore.so -OUT64_RELEASE = build/release/x64/NativeCore.so - -OBJ32_DEBUG = $(OBJDIR32_DEBUG)/WriteRemoteMemory.o $(OBJDIR32_DEBUG)/ReadRemoteMemory.o $(OBJDIR32_DEBUG)/OpenRemoteProcess.o $(OBJDIR32_DEBUG)/IsProcessValid.o $(OBJDIR32_DEBUG)/Input.o $(OBJDIR32_DEBUG)/EnumerateRemoteSectionsAndModules.o $(OBJDIR32_DEBUG)/EnumerateProcesses.o $(OBJDIR32_DEBUG)/DisassembleCode.o $(OBJDIR32_DEBUG)/DistormHelper.o $(OBJDIR32_DEBUG)/Debugger.o $(OBJDIR32_DEBUG)/ControlRemoteProcess.o $(OBJDIR32_DEBUG)/CloseRemoteProcess.o $(OBJDIR32_DEBUG)/decoder.o $(OBJDIR32_DEBUG)/distorm.o $(OBJDIR32_DEBUG)/instructions.o $(OBJDIR32_DEBUG)/insts.o $(OBJDIR32_DEBUG)/mnemonics.o $(OBJDIR32_DEBUG)/operands.o $(OBJDIR32_DEBUG)/prefix.o $(OBJDIR32_DEBUG)/textdefs.o -OBJ64_DEBUG = $(OBJDIR64_DEBUG)/WriteRemoteMemory.o $(OBJDIR64_DEBUG)/ReadRemoteMemory.o $(OBJDIR64_DEBUG)/OpenRemoteProcess.o $(OBJDIR64_DEBUG)/IsProcessValid.o $(OBJDIR64_DEBUG)/Input.o $(OBJDIR64_DEBUG)/EnumerateRemoteSectionsAndModules.o $(OBJDIR64_DEBUG)/EnumerateProcesses.o $(OBJDIR64_DEBUG)/DisassembleCode.o $(OBJDIR64_DEBUG)/DistormHelper.o $(OBJDIR64_DEBUG)/Debugger.o $(OBJDIR64_DEBUG)/ControlRemoteProcess.o $(OBJDIR64_DEBUG)/CloseRemoteProcess.o $(OBJDIR64_DEBUG)/decoder.o $(OBJDIR64_DEBUG)/distorm.o $(OBJDIR64_DEBUG)/instructions.o $(OBJDIR64_DEBUG)/insts.o $(OBJDIR64_DEBUG)/mnemonics.o $(OBJDIR64_DEBUG)/operands.o $(OBJDIR64_DEBUG)/prefix.o $(OBJDIR64_DEBUG)/textdefs.o - -OBJ32_RELEASE = $(OBJDIR32_RELEASE)/WriteRemoteMemory.o $(OBJDIR32_RELEASE)/ReadRemoteMemory.o $(OBJDIR32_RELEASE)/OpenRemoteProcess.o $(OBJDIR32_RELEASE)/IsProcessValid.o $(OBJDIR32_RELEASE)/Input.o $(OBJDIR32_RELEASE)/EnumerateRemoteSectionsAndModules.o $(OBJDIR32_RELEASE)/EnumerateProcesses.o $(OBJDIR32_RELEASE)/DisassembleCode.o $(OBJDIR32_RELEASE)/DistormHelper.o $(OBJDIR32_RELEASE)/Debugger.o $(OBJDIR32_RELEASE)/ControlRemoteProcess.o $(OBJDIR32_RELEASE)/CloseRemoteProcess.o $(OBJDIR32_RELEASE)/decoder.o $(OBJDIR32_RELEASE)/distorm.o $(OBJDIR32_RELEASE)/instructions.o $(OBJDIR32_RELEASE)/insts.o $(OBJDIR32_RELEASE)/mnemonics.o $(OBJDIR32_RELEASE)/operands.o $(OBJDIR32_RELEASE)/prefix.o $(OBJDIR32_RELEASE)/textdefs.o -OBJ64_RELEASE = $(OBJDIR64_RELEASE)/WriteRemoteMemory.o $(OBJDIR64_RELEASE)/ReadRemoteMemory.o $(OBJDIR64_RELEASE)/OpenRemoteProcess.o $(OBJDIR64_RELEASE)/IsProcessValid.o $(OBJDIR64_RELEASE)/Input.o $(OBJDIR64_RELEASE)/EnumerateRemoteSectionsAndModules.o $(OBJDIR64_RELEASE)/EnumerateProcesses.o $(OBJDIR64_RELEASE)/DisassembleCode.o $(OBJDIR64_RELEASE)/DistormHelper.o $(OBJDIR64_RELEASE)/Debugger.o $(OBJDIR64_RELEASE)/ControlRemoteProcess.o $(OBJDIR64_RELEASE)/CloseRemoteProcess.o $(OBJDIR64_RELEASE)/decoder.o $(OBJDIR64_RELEASE)/distorm.o $(OBJDIR64_RELEASE)/instructions.o $(OBJDIR64_RELEASE)/insts.o $(OBJDIR64_RELEASE)/mnemonics.o $(OBJDIR64_RELEASE)/operands.o $(OBJDIR64_RELEASE)/prefix.o $(OBJDIR64_RELEASE)/textdefs.o - -all: debug release - -clean: clean_debug clean_release - -before_debug: - test -d build/debug/x86 || mkdir -p build/debug/x86 - test -d build/debug/x64 || mkdir -p build/debug/x64 - test -d $(OBJDIR32_DEBUG) || mkdir -p $(OBJDIR32_DEBUG) - test -d $(OBJDIR64_DEBUG) || mkdir -p $(OBJDIR64_DEBUG) - -after_debug: - -debug: before_debug out_debug32 out_debug64 after_debug - -out_debug32: before_debug $(OBJ32_DEBUG) $(DEP_DEBUG) - $(CXX) $(LIBDIR_DEBUG) -o $(OUT32_DEBUG) $(OBJ32_DEBUG) $(LDFLAGS32_DEBUG) $(LIB_DEBUG) - -$(OBJDIR32_DEBUG)/WriteRemoteMemory.o: WriteRemoteMemory.cpp - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c WriteRemoteMemory.cpp -o $(OBJDIR32_DEBUG)/WriteRemoteMemory.o - -$(OBJDIR32_DEBUG)/ReadRemoteMemory.o: ReadRemoteMemory.cpp - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ReadRemoteMemory.cpp -o $(OBJDIR32_DEBUG)/ReadRemoteMemory.o - -$(OBJDIR32_DEBUG)/OpenRemoteProcess.o: OpenRemoteProcess.cpp - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c OpenRemoteProcess.cpp -o $(OBJDIR32_DEBUG)/OpenRemoteProcess.o - -$(OBJDIR32_DEBUG)/IsProcessValid.o: IsProcessValid.cpp - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c IsProcessValid.cpp -o $(OBJDIR32_DEBUG)/IsProcessValid.o - -$(OBJDIR32_DEBUG)/Input.o: Input.cpp - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c Input.cpp -o $(OBJDIR32_DEBUG)/Input.o - -$(OBJDIR32_DEBUG)/EnumerateRemoteSectionsAndModules.o: EnumerateRemoteSectionsAndModules.cpp - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c EnumerateRemoteSectionsAndModules.cpp -o $(OBJDIR32_DEBUG)/EnumerateRemoteSectionsAndModules.o - -$(OBJDIR32_DEBUG)/EnumerateProcesses.o: EnumerateProcesses.cpp - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c EnumerateProcesses.cpp -o $(OBJDIR32_DEBUG)/EnumerateProcesses.o - -$(OBJDIR32_DEBUG)/DisassembleCode.o: DisassembleCode.cpp - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c DisassembleCode.cpp -o $(OBJDIR32_DEBUG)/DisassembleCode.o - -$(OBJDIR32_DEBUG)/DistormHelper.o: ../Shared/DistormHelper.cpp - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Shared/DistormHelper.cpp -o $(OBJDIR32_DEBUG)/DistormHelper.o - -$(OBJDIR32_DEBUG)/Debugger.o: Debugger.cpp - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c Debugger.cpp -o $(OBJDIR32_DEBUG)/Debugger.o - -$(OBJDIR32_DEBUG)/ControlRemoteProcess.o: ControlRemoteProcess.cpp - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ControlRemoteProcess.cpp -o $(OBJDIR32_DEBUG)/ControlRemoteProcess.o - -$(OBJDIR32_DEBUG)/CloseRemoteProcess.o: CloseRemoteProcess.cpp - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c CloseRemoteProcess.cpp -o $(OBJDIR32_DEBUG)/CloseRemoteProcess.o - -$(OBJDIR32_DEBUG)/decoder.o: ../Dependencies/distorm/src/decoder.c - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/decoder.c -o $(OBJDIR32_DEBUG)/decoder.o - -$(OBJDIR32_DEBUG)/distorm.o: ../Dependencies/distorm/src/distorm.c - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/distorm.c -o $(OBJDIR32_DEBUG)/distorm.o - -$(OBJDIR32_DEBUG)/instructions.o: ../Dependencies/distorm/src/instructions.c - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/instructions.c -o $(OBJDIR32_DEBUG)/instructions.o - -$(OBJDIR32_DEBUG)/insts.o: ../Dependencies/distorm/src/insts.c - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/insts.c -o $(OBJDIR32_DEBUG)/insts.o - -$(OBJDIR32_DEBUG)/mnemonics.o: ../Dependencies/distorm/src/mnemonics.c - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/mnemonics.c -o $(OBJDIR32_DEBUG)/mnemonics.o - -$(OBJDIR32_DEBUG)/operands.o: ../Dependencies/distorm/src/operands.c - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/operands.c -o $(OBJDIR32_DEBUG)/operands.o - -$(OBJDIR32_DEBUG)/prefix.o: ../Dependencies/distorm/src/prefix.c - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/prefix.c -o $(OBJDIR32_DEBUG)/prefix.o - -$(OBJDIR32_DEBUG)/textdefs.o: ../Dependencies/distorm/src/textdefs.c - $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/textdefs.c -o $(OBJDIR32_DEBUG)/textdefs.o - -out_debug64: before_debug $(OBJ64_DEBUG) $(DEP_DEBUG) - $(CXX) $(LIBDIR_DEBUG) -o $(OUT64_DEBUG) $(OBJ64_DEBUG) $(LDFLAGS64_DEBUG) $(LIB_DEBUG) - -$(OBJDIR64_DEBUG)/WriteRemoteMemory.o: WriteRemoteMemory.cpp - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c WriteRemoteMemory.cpp -o $(OBJDIR64_DEBUG)/WriteRemoteMemory.o - -$(OBJDIR64_DEBUG)/ReadRemoteMemory.o: ReadRemoteMemory.cpp - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ReadRemoteMemory.cpp -o $(OBJDIR64_DEBUG)/ReadRemoteMemory.o - -$(OBJDIR64_DEBUG)/OpenRemoteProcess.o: OpenRemoteProcess.cpp - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c OpenRemoteProcess.cpp -o $(OBJDIR64_DEBUG)/OpenRemoteProcess.o - -$(OBJDIR64_DEBUG)/IsProcessValid.o: IsProcessValid.cpp - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c IsProcessValid.cpp -o $(OBJDIR64_DEBUG)/IsProcessValid.o - -$(OBJDIR64_DEBUG)/Input.o: Input.cpp - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c Input.cpp -o $(OBJDIR64_DEBUG)/Input.o - -$(OBJDIR64_DEBUG)/EnumerateRemoteSectionsAndModules.o: EnumerateRemoteSectionsAndModules.cpp - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c EnumerateRemoteSectionsAndModules.cpp -o $(OBJDIR64_DEBUG)/EnumerateRemoteSectionsAndModules.o - -$(OBJDIR64_DEBUG)/EnumerateProcesses.o: EnumerateProcesses.cpp - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c EnumerateProcesses.cpp -o $(OBJDIR64_DEBUG)/EnumerateProcesses.o - -$(OBJDIR64_DEBUG)/DisassembleCode.o: DisassembleCode.cpp - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c DisassembleCode.cpp -o $(OBJDIR64_DEBUG)/DisassembleCode.o - -$(OBJDIR64_DEBUG)/DistormHelper.o: ../Shared/DistormHelper.cpp - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Shared/DistormHelper.cpp -o $(OBJDIR64_DEBUG)/DistormHelper.o - -$(OBJDIR64_DEBUG)/Debugger.o: Debugger.cpp - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c Debugger.cpp -o $(OBJDIR64_DEBUG)/Debugger.o - -$(OBJDIR64_DEBUG)/ControlRemoteProcess.o: ControlRemoteProcess.cpp - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ControlRemoteProcess.cpp -o $(OBJDIR64_DEBUG)/ControlRemoteProcess.o - -$(OBJDIR64_DEBUG)/CloseRemoteProcess.o: CloseRemoteProcess.cpp - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c CloseRemoteProcess.cpp -o $(OBJDIR64_DEBUG)/CloseRemoteProcess.o - -$(OBJDIR64_DEBUG)/decoder.o: ../Dependencies/distorm/src/decoder.c - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/decoder.c -o $(OBJDIR64_DEBUG)/decoder.o - -$(OBJDIR64_DEBUG)/distorm.o: ../Dependencies/distorm/src/distorm.c - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/distorm.c -o $(OBJDIR64_DEBUG)/distorm.o - -$(OBJDIR64_DEBUG)/instructions.o: ../Dependencies/distorm/src/instructions.c - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/instructions.c -o $(OBJDIR64_DEBUG)/instructions.o - -$(OBJDIR64_DEBUG)/insts.o: ../Dependencies/distorm/src/insts.c - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/insts.c -o $(OBJDIR64_DEBUG)/insts.o - -$(OBJDIR64_DEBUG)/mnemonics.o: ../Dependencies/distorm/src/mnemonics.c - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/mnemonics.c -o $(OBJDIR64_DEBUG)/mnemonics.o - -$(OBJDIR64_DEBUG)/operands.o: ../Dependencies/distorm/src/operands.c - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/operands.c -o $(OBJDIR64_DEBUG)/operands.o - -$(OBJDIR64_DEBUG)/prefix.o: ../Dependencies/distorm/src/prefix.c - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/prefix.c -o $(OBJDIR64_DEBUG)/prefix.o - -$(OBJDIR64_DEBUG)/textdefs.o: ../Dependencies/distorm/src/textdefs.c - $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/textdefs.c -o $(OBJDIR64_DEBUG)/textdefs.o - -clean_debug: - rm -f $(OBJ32_DEBUG) $(OUT32_DEBUG) - rm -f $(OBJ64_DEBUG) $(OUT64_DEBUG) - rm -rf build/debug - rm -rf $(OBJDIR32_DEBUG) - rm -rf $(OBJDIR64_DEBUG) - -before_release: - test -d build/release/x86 || mkdir -p build/release/x86 - test -d build/release/x64 || mkdir -p build/release/x64 - test -d $(OBJDIR32_RELEASE) || mkdir -p $(OBJDIR32_RELEASE) - test -d $(OBJDIR64_RELEASE) || mkdir -p $(OBJDIR64_RELEASE) - -after_release: - -release: before_release out_release32 out_release64 after_release - -out_release32: before_release $(OBJ32_RELEASE) $(DEP_RELEASE) - $(CXX) $(LIBDIR_RELEASE) -o $(OUT32_RELEASE) $(OBJ32_RELEASE) $(LDFLAGS32_RELEASE) $(LIB_RELEASE) - -$(OBJDIR32_RELEASE)/WriteRemoteMemory.o: WriteRemoteMemory.cpp - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c WriteRemoteMemory.cpp -o $(OBJDIR32_RELEASE)/WriteRemoteMemory.o - -$(OBJDIR32_RELEASE)/ReadRemoteMemory.o: ReadRemoteMemory.cpp - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ReadRemoteMemory.cpp -o $(OBJDIR32_RELEASE)/ReadRemoteMemory.o - -$(OBJDIR32_RELEASE)/OpenRemoteProcess.o: OpenRemoteProcess.cpp - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c OpenRemoteProcess.cpp -o $(OBJDIR32_RELEASE)/OpenRemoteProcess.o - -$(OBJDIR32_RELEASE)/IsProcessValid.o: IsProcessValid.cpp - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c IsProcessValid.cpp -o $(OBJDIR32_RELEASE)/IsProcessValid.o - -$(OBJDIR32_RELEASE)/Input.o: Input.cpp - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c Input.cpp -o $(OBJDIR32_RELEASE)/Input.o - -$(OBJDIR32_RELEASE)/EnumerateRemoteSectionsAndModules.o: EnumerateRemoteSectionsAndModules.cpp - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c EnumerateRemoteSectionsAndModules.cpp -o $(OBJDIR32_RELEASE)/EnumerateRemoteSectionsAndModules.o - -$(OBJDIR32_RELEASE)/EnumerateProcesses.o: EnumerateProcesses.cpp - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c EnumerateProcesses.cpp -o $(OBJDIR32_RELEASE)/EnumerateProcesses.o - -$(OBJDIR32_RELEASE)/DisassembleCode.o: DisassembleCode.cpp - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c DisassembleCode.cpp -o $(OBJDIR32_RELEASE)/DisassembleCode.o - -$(OBJDIR32_RELEASE)/DistormHelper.o: ../Shared/DistormHelper.cpp - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Shared/DistormHelper.cpp -o $(OBJDIR32_RELEASE)/DistormHelper.o - -$(OBJDIR32_RELEASE)/Debugger.o: Debugger.cpp - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c Debugger.cpp -o $(OBJDIR32_RELEASE)/Debugger.o - -$(OBJDIR32_RELEASE)/ControlRemoteProcess.o: ControlRemoteProcess.cpp - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ControlRemoteProcess.cpp -o $(OBJDIR32_RELEASE)/ControlRemoteProcess.o - -$(OBJDIR32_RELEASE)/CloseRemoteProcess.o: CloseRemoteProcess.cpp - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c CloseRemoteProcess.cpp -o $(OBJDIR32_RELEASE)/CloseRemoteProcess.o - -$(OBJDIR32_RELEASE)/decoder.o: ../Dependencies/distorm/src/decoder.c - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/decoder.c -o $(OBJDIR32_RELEASE)/decoder.o - -$(OBJDIR32_RELEASE)/distorm.o: ../Dependencies/distorm/src/distorm.c - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/distorm.c -o $(OBJDIR32_RELEASE)/distorm.o - -$(OBJDIR32_RELEASE)/instructions.o: ../Dependencies/distorm/src/instructions.c - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/instructions.c -o $(OBJDIR32_RELEASE)/instructions.o - -$(OBJDIR32_RELEASE)/insts.o: ../Dependencies/distorm/src/insts.c - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/insts.c -o $(OBJDIR32_RELEASE)/insts.o - -$(OBJDIR32_RELEASE)/mnemonics.o: ../Dependencies/distorm/src/mnemonics.c - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/mnemonics.c -o $(OBJDIR32_RELEASE)/mnemonics.o - -$(OBJDIR32_RELEASE)/operands.o: ../Dependencies/distorm/src/operands.c - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/operands.c -o $(OBJDIR32_RELEASE)/operands.o - -$(OBJDIR32_RELEASE)/prefix.o: ../Dependencies/distorm/src/prefix.c - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/prefix.c -o $(OBJDIR32_RELEASE)/prefix.o - -$(OBJDIR32_RELEASE)/textdefs.o: ../Dependencies/distorm/src/textdefs.c - $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/textdefs.c -o $(OBJDIR32_RELEASE)/textdefs.o - -out_release64: before_release $(OBJ64_RELEASE) $(DEP_RELEASE) - $(CXX) $(LIBDIR_RELEASE) -o $(OUT64_RELEASE) $(OBJ64_RELEASE) $(LDFLAGS64_RELEASE) $(LIB_RELEASE) - -$(OBJDIR64_RELEASE)/WriteRemoteMemory.o: WriteRemoteMemory.cpp - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c WriteRemoteMemory.cpp -o $(OBJDIR64_RELEASE)/WriteRemoteMemory.o - -$(OBJDIR64_RELEASE)/ReadRemoteMemory.o: ReadRemoteMemory.cpp - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ReadRemoteMemory.cpp -o $(OBJDIR64_RELEASE)/ReadRemoteMemory.o - -$(OBJDIR64_RELEASE)/OpenRemoteProcess.o: OpenRemoteProcess.cpp - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c OpenRemoteProcess.cpp -o $(OBJDIR64_RELEASE)/OpenRemoteProcess.o - -$(OBJDIR64_RELEASE)/IsProcessValid.o: IsProcessValid.cpp - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c IsProcessValid.cpp -o $(OBJDIR64_RELEASE)/IsProcessValid.o - -$(OBJDIR64_RELEASE)/Input.o: Input.cpp - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c Input.cpp -o $(OBJDIR64_RELEASE)/Input.o - -$(OBJDIR64_RELEASE)/EnumerateRemoteSectionsAndModules.o: EnumerateRemoteSectionsAndModules.cpp - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c EnumerateRemoteSectionsAndModules.cpp -o $(OBJDIR64_RELEASE)/EnumerateRemoteSectionsAndModules.o - -$(OBJDIR64_RELEASE)/EnumerateProcesses.o: EnumerateProcesses.cpp - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c EnumerateProcesses.cpp -o $(OBJDIR64_RELEASE)/EnumerateProcesses.o - -$(OBJDIR64_RELEASE)/DisassembleCode.o: DisassembleCode.cpp - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c DisassembleCode.cpp -o $(OBJDIR64_RELEASE)/DisassembleCode.o - -$(OBJDIR64_RELEASE)/DistormHelper.o: ../Shared/DistormHelper.cpp - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Shared/DistormHelper.cpp -o $(OBJDIR64_RELEASE)/DistormHelper.o - -$(OBJDIR64_RELEASE)/Debugger.o: Debugger.cpp - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c Debugger.cpp -o $(OBJDIR64_RELEASE)/Debugger.o - -$(OBJDIR64_RELEASE)/ControlRemoteProcess.o: ControlRemoteProcess.cpp - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ControlRemoteProcess.cpp -o $(OBJDIR64_RELEASE)/ControlRemoteProcess.o - -$(OBJDIR64_RELEASE)/CloseRemoteProcess.o: CloseRemoteProcess.cpp - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c CloseRemoteProcess.cpp -o $(OBJDIR64_RELEASE)/CloseRemoteProcess.o - -$(OBJDIR64_RELEASE)/decoder.o: ../Dependencies/distorm/src/decoder.c - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/decoder.c -o $(OBJDIR64_RELEASE)/decoder.o - -$(OBJDIR64_RELEASE)/distorm.o: ../Dependencies/distorm/src/distorm.c - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/distorm.c -o $(OBJDIR64_RELEASE)/distorm.o - -$(OBJDIR64_RELEASE)/instructions.o: ../Dependencies/distorm/src/instructions.c - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/instructions.c -o $(OBJDIR64_RELEASE)/instructions.o - -$(OBJDIR64_RELEASE)/insts.o: ../Dependencies/distorm/src/insts.c - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/insts.c -o $(OBJDIR64_RELEASE)/insts.o - -$(OBJDIR64_RELEASE)/mnemonics.o: ../Dependencies/distorm/src/mnemonics.c - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/mnemonics.c -o $(OBJDIR64_RELEASE)/mnemonics.o - -$(OBJDIR64_RELEASE)/operands.o: ../Dependencies/distorm/src/operands.c - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/operands.c -o $(OBJDIR64_RELEASE)/operands.o - -$(OBJDIR64_RELEASE)/prefix.o: ../Dependencies/distorm/src/prefix.c - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/prefix.c -o $(OBJDIR64_RELEASE)/prefix.o - -$(OBJDIR64_RELEASE)/textdefs.o: ../Dependencies/distorm/src/textdefs.c - $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/textdefs.c -o $(OBJDIR64_RELEASE)/textdefs.o - -clean_release: - rm -f $(OBJ32_RELEASE) $(OUT32_RELEASE) - rm -f $(OBJ64_RELEASE) $(OUT64_RELEASE) - rm -rf build/release - rm -rf $(OBJDIR32_RELEASE) - rm -rf $(OBJDIR64_RELEASE) - -.PHONY: before_debug after_debug clean_debug before_release after_release clean_release diff --git a/NativeCore/Unix/NativeCore.Unix.vcxproj b/NativeCore/Unix/NativeCore.Unix.vcxproj deleted file mode 100644 index 83bff48a..00000000 --- a/NativeCore/Unix/NativeCore.Unix.vcxproj +++ /dev/null @@ -1,183 +0,0 @@ - - - - - Debug - x86 - - - Release - x86 - - - Debug - x64 - - - Release - x64 - - - - {48c5258a-fa49-4173-aee5-0fca5190dff2} - Linux - NativeCore - 14.0 - Linux - 1.0 - Generic - {D51BCBC9-82E9-4017-911E-C93873C4EA2B} - 8.1 - - - - true - DynamicLibrary - WSL2_1_0 - - - false - DynamicLibrary - WSL2_1_0 - - - true - DynamicLibrary - WSL2_1_0 - - - false - DynamicLibrary - WSL2_1_0 - - - - - - - - NativeCore - .so - $(SolutionDir)bin\$(Configuration)\$(PlatformTarget)\ - $(SolutionDir)obj\$(Configuration)\$(PlatformTarget)\$(MSBuildProjectName)\ - - - NativeCore - .so - $(SolutionDir)bin\$(Configuration)\$(PlatformTarget)\ - $(SolutionDir)obj\$(Configuration)\$(PlatformTarget)\$(MSBuildProjectName)\ - - - NativeCore - .so - $(SolutionDir)bin\$(Configuration)\$(PlatformTarget)\ - $(SolutionDir)obj\$(Configuration)\$(PlatformTarget)\$(MSBuildProjectName)\ - - - NativeCore - .so - $(SolutionDir)bin\$(Configuration)\$(PlatformTarget)\ - $(SolutionDir)obj\$(Configuration)\$(PlatformTarget)\$(MSBuildProjectName)\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - c++1y - ../Dependencies/distorm/include;$(Sysroot)\usr\include;$(StlIncludeDirectories);%(AdditionalIncludeDirectories) - RECLASSNET64 - -m64 %(AdditionalOptions) - - - -m64 %(AdditionalOptions) - stdc++fs - - - - - true - c++1y - ../Dependencies/distorm/include;$(Sysroot)\usr\include;$(StlIncludeDirectories);%(AdditionalIncludeDirectories) - RECLASSNET64;%(PreprocessorDefinitions) - -m64 %(AdditionalOptions) - None - true - Disabled - false - - - stdc++fs - -m64 %(AdditionalOptions) - OmitAllSymbolInformation - - - - - true - c++1y - ../Dependencies/distorm/include;$(Sysroot)\usr\include;$(StlIncludeDirectories);%(AdditionalIncludeDirectories) - -m32 %(AdditionalOptions) - - - -m32 %(AdditionalOptions) - stdc++fs - - - - - true - c++1y - ../Dependencies/distorm/include;$(Sysroot)\usr\include;$(StlIncludeDirectories);%(AdditionalIncludeDirectories) - -m32 %(AdditionalOptions) - None - true - false - Disabled - - - -m32 %(AdditionalOptions) - stdc++fs - OmitAllSymbolInformation - - - - - \ No newline at end of file diff --git a/NativeCore/Unix/NativeCore.Unix.vcxproj.filters b/NativeCore/Unix/NativeCore.Unix.vcxproj.filters deleted file mode 100644 index 3076be6b..00000000 --- a/NativeCore/Unix/NativeCore.Unix.vcxproj.filters +++ /dev/null @@ -1,119 +0,0 @@ - - - - - {32941fcb-69a5-43e7-86ba-38eb1ece3de9} - - - {eaf85ecc-eda1-49c6-a3be-14f2f8f4002c} - - - {5b0453e9-b429-4dfd-bcbb-f3756d073e60} - - - {976c6ca6-4172-4080-8162-a7913375df1a} - - - - - Functions - - - Functions - - - Functions - - - Functions - - - Functions - - - Functions - - - Functions - - - Functions - - - Functions - - - Functions - - - Functions - - - Dependencies\distorm - - - Dependencies\distorm - - - Dependencies\distorm - - - Dependencies\distorm - - - Dependencies\distorm - - - Dependencies\distorm - - - Dependencies\distorm - - - Dependencies\distorm - - - Shared - - - - - - - Dependencies\distorm - - - Dependencies\distorm - - - Shared - - - Shared - - - Dependencies\distorm - - - Dependencies\distorm - - - Dependencies\distorm - - - Dependencies\distorm - - - Dependencies\distorm - - - Dependencies\distorm - - - Dependencies\distorm - - - Dependencies\distorm - - - \ No newline at end of file diff --git a/NativeCore/Unix/NativeCore.hpp b/NativeCore/Unix/NativeCore.hpp deleted file mode 100644 index 9939c9b0..00000000 --- a/NativeCore/Unix/NativeCore.hpp +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#include -#include - -#include "../ReClassNET_Plugin.hpp" -#include "../Shared/Keys.hpp" - -extern "C" -{ - void EnumerateProcesses(EnumerateProcessCallback callbackProcess); - void EnumerateRemoteSectionsAndModules(RC_Pointer handle, EnumerateRemoteSectionsCallback callbackSection, EnumerateRemoteModulesCallback callbackModule); - - RC_Pointer OpenRemoteProcess(RC_Pointer id, ProcessAccess desiredAccess); - bool IsProcessValid(RC_Pointer handle); - void CloseRemoteProcess(RC_Pointer handle); - - bool ReadRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size); - bool WriteRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size); - - void ControlRemoteProcess(RC_Pointer handle, ControlRemoteProcessAction action); - - bool AttachDebuggerToProcess(RC_Pointer id); - void DetachDebuggerFromProcess(RC_Pointer id); - bool AwaitDebugEvent(DebugEvent* evt, int timeoutInMilliseconds); - void HandleDebugEvent(DebugEvent* evt); - bool SetHardwareBreakpoint(RC_Pointer id, RC_Pointer address, HardwareBreakpointRegister reg, HardwareBreakpointTrigger type, HardwareBreakpointSize size, bool set); - - RC_Pointer InitializeInput(); - bool GetPressedKeys(RC_Pointer handle, Keys* state[], int* count); - void ReleaseInput(RC_Pointer handle); -} - -inline bool is_number(const std::string& s) -{ - auto it = s.begin(); - for (; it != s.end() && std::isdigit(*it); ++it); - return !s.empty() && it == s.end(); -} - -template -inline T parse_type(const std::string& s) -{ - std::stringstream ss(s); - - T val; - ss >> val; - return val; -} diff --git a/NativeCore/Unix/OpenRemoteProcess.cpp b/NativeCore/Unix/OpenRemoteProcess.cpp deleted file mode 100644 index 6456760e..00000000 --- a/NativeCore/Unix/OpenRemoteProcess.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "NativeCore.hpp" - -extern "C" RC_Pointer RC_CallConv OpenRemoteProcess(RC_Pointer id, ProcessAccess desiredAccess) -{ - return id; -} diff --git a/NativeCore/Unix/ReadRemoteMemory.cpp b/NativeCore/Unix/ReadRemoteMemory.cpp deleted file mode 100644 index 4a647668..00000000 --- a/NativeCore/Unix/ReadRemoteMemory.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -#include "NativeCore.hpp" - -extern "C" bool RC_CallConv ReadRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size) -{ - iovec local[1]; - iovec remote[1]; - - local[0].iov_base = (static_cast(buffer) + offset); - local[0].iov_len = size; - remote[0].iov_base = address; - remote[0].iov_len = size; - - if (process_vm_readv(static_cast(reinterpret_cast(handle)), local, 1, remote, 1, 0) != size) - { - return false; - } - - return true; -} diff --git a/NativeCore/Unix/WriteRemoteMemory.cpp b/NativeCore/Unix/WriteRemoteMemory.cpp deleted file mode 100644 index 4f20717a..00000000 --- a/NativeCore/Unix/WriteRemoteMemory.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -#include "NativeCore.hpp" - -extern "C" bool RC_CallConv WriteRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size) -{ - iovec local[1]; - iovec remote[1]; - - local[0].iov_base = (static_cast(buffer) + offset); - local[0].iov_len = size; - remote[0].iov_base = address; - remote[0].iov_len = size; - - if (process_vm_writev(static_cast(reinterpret_cast(handle)), local, 1, remote, 1, 0) != size) - { - return false; - } - - return true; -} diff --git a/README.md b/README.md index 5c5ff8d9..c6ad9b30 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,6 @@ This is a port of ReClass to the .NET platform with lots of additional features. - Class address calculator - Code Generator (C++ / C#) - Module / Section Dumper -- Linux Support (tested on Ubuntu 18.04) - Debugger with "Find out what writes/accesses this address" support - Plugin Support - Plugins can be written in different languages (example: C++, C++/CLI, C#) @@ -77,7 +76,7 @@ Just download the [latest version](https://github.com/ReClassNET/ReClass.NET/rel If you want to compile ReClass.NET just fork the repository and open the ReClass.NET.sln file with Visual Studio 2022 (or later) and the .NET 9 SDK installed. Compile the project and copy the dependencies to the output folder. -To compile the linux native core library, you need WSL [installed and configured](https://learn.microsoft.com/en-us/cpp/build/walkthrough-build-debug-wsl2). If you do not need linux support, simply unload the project in the Solution Explorer. If you want to build cross-platform (x86/x64) you have to install `g++-multilib` too. +Linux support has been removed; the project targets Windows only. If you use the `Makefile` with `docker` or `podman` you have to build the needed image `gcc_multilib` from the following `Dockerfile` (`docker build -t gcc_multi .`): diff --git a/ReClass.NET.sln b/ReClass.NET.sln index 6345bb67..77809b4a 100644 --- a/ReClass.NET.sln +++ b/ReClass.NET.sln @@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReClass.NET", "ReClass.NET\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NativeCore", "NativeCore\Windows\NativeCore.vcxproj", "{22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NativeCore.Unix", "NativeCore\Unix\NativeCore.Unix.vcxproj", "{48C5258A-FA49-4173-AEE5-0FCA5190DFF2}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReClass.NET_Launcher", "ReClass.NET_Launcher\ReClass.NET_Launcher.csproj", "{16591D29-2370-428A-BA11-87E38D0F3551}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{19CF2B0F-2722-4108-8308-B628D91F7A1E}" @@ -53,16 +51,6 @@ Global {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Release|x64.Build.0 = Release|x64 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Release|x86.ActiveCfg = Release|Win32 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Release|x86.Build.0 = Release|Win32 - {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|Any CPU.ActiveCfg = Debug|x86 - {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|x64.ActiveCfg = Debug|x64 - {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|x64.Build.0 = Debug|x64 - {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|x86.ActiveCfg = Debug|x86 - {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|x86.Build.0 = Debug|x86 - {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|Any CPU.ActiveCfg = Release|x86 - {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|x64.ActiveCfg = Release|x64 - {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|x64.Build.0 = Release|x64 - {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|x86.ActiveCfg = Release|x86 - {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|x86.Build.0 = Release|x86 {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|Any CPU.Build.0 = Debug|Any CPU {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|x64.ActiveCfg = Debug|Any CPU diff --git a/ReClass.NET/Core/InternalCoreFunctions.cs b/ReClass.NET/Core/InternalCoreFunctions.cs index 0e1494b3..7c1825ff 100644 --- a/ReClass.NET/Core/InternalCoreFunctions.cs +++ b/ReClass.NET/Core/InternalCoreFunctions.cs @@ -13,7 +13,6 @@ namespace ReClassNET.Core internal class InternalCoreFunctions : NativeCoreWrapper, IInternalCoreFunctions, IDisposable { private const string CoreFunctionsModuleWindows = "NativeCore.dll"; - private const string CoreFunctionsModuleUnix = "NativeCore.so"; private readonly IntPtr handle; @@ -46,8 +45,7 @@ private InternalCoreFunctions(IntPtr handle) public static InternalCoreFunctions Create() { - var libraryName = NativeMethods.IsUnix() ? CoreFunctionsModuleUnix : CoreFunctionsModuleWindows; - var libraryPath = Path.Combine(PathUtil.ExecutableFolderPath, libraryName); + var libraryPath = Path.Combine(PathUtil.ExecutableFolderPath, CoreFunctionsModuleWindows); var handle = NativeMethods.LoadLibrary(libraryPath); if (handle.IsNull()) diff --git a/ReClass.NET/Forms/MainForm.Functions.cs b/ReClass.NET/Forms/MainForm.Functions.cs index 84f1b53a..4146e81a 100644 --- a/ReClass.NET/Forms/MainForm.Functions.cs +++ b/ReClass.NET/Forms/MainForm.Functions.cs @@ -4,6 +4,7 @@ using System.Diagnostics.Contracts; using System.IO; using System.Linq; +using System.Runtime.Versioning; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -19,6 +20,7 @@ namespace ReClassNET.Forms { + [SupportedOSPlatform("windows")] public partial class MainForm { public void ShowPartialCodeGeneratorForm(IReadOnlyList partialClasses) diff --git a/ReClass.NET/Forms/ProcessBrowserForm.cs b/ReClass.NET/Forms/ProcessBrowserForm.cs index d4ed7cb3..4655a288 100644 --- a/ReClass.NET/Forms/ProcessBrowserForm.cs +++ b/ReClass.NET/Forms/ProcessBrowserForm.cs @@ -33,11 +33,7 @@ public ProcessBrowserForm(string previousProcess) processDataGridView.AutoGenerateColumns = false; - // TODO: Workaround, Mono can't display a DataGridViewImageColumn. - if (NativeMethods.IsUnix()) - { - iconColumn.Visible = false; - } + // Windows-only build keeps icon column visible. previousProcessLinkLabel.Text = string.IsNullOrEmpty(previousProcess) ? NoPreviousProcess : previousProcess; diff --git a/ReClass.NET/Forms/ProcessInfoForm.cs b/ReClass.NET/Forms/ProcessInfoForm.cs index fc56d3eb..ea2d6fe9 100644 --- a/ReClass.NET/Forms/ProcessInfoForm.cs +++ b/ReClass.NET/Forms/ProcessInfoForm.cs @@ -37,11 +37,7 @@ public ProcessInfoForm(IProcessReader process) modulesDataGridView.AutoGenerateColumns = false; sectionsDataGridView.AutoGenerateColumns = false; - // TODO: Workaround, Mono can't display a DataGridViewImageColumn. - if (NativeMethods.IsUnix()) - { - moduleIconDataGridViewImageColumn.Visible = false; - } + // Windows-only build keeps icon column visible. } protected override void OnLoad(EventArgs e) diff --git a/ReClass.NET/Forms/SettingsForm.cs b/ReClass.NET/Forms/SettingsForm.cs index fcc4121e..1f372de7 100644 --- a/ReClass.NET/Forms/SettingsForm.cs +++ b/ReClass.NET/Forms/SettingsForm.cs @@ -41,16 +41,8 @@ public SettingsForm(Settings settings, CppTypeMapping typeMapping) SetColorBindings(); SetTypeDefinitionBindings(); - if (NativeMethods.IsUnix()) - { - fileAssociationGroupBox.Enabled = false; - runAsAdminCheckBox.Enabled = false; - } - else - { - NativeMethodsWindows.SetButtonShield(createAssociationButton, true); - NativeMethodsWindows.SetButtonShield(removeAssociationButton, true); - } + NativeMethodsWindows.SetButtonShield(createAssociationButton, true); + NativeMethodsWindows.SetButtonShield(removeAssociationButton, true); } protected override void OnLoad(EventArgs e) diff --git a/ReClass.NET/Native/NativeMethods.Unix.cs b/ReClass.NET/Native/NativeMethods.Unix.cs deleted file mode 100644 index c1b2e6c4..00000000 --- a/ReClass.NET/Native/NativeMethods.Unix.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Drawing; -using System.Runtime.InteropServices; - -namespace ReClassNET.Native -{ - internal class NativeMethodsUnix : INativeMethods - { - #region Imports - - private const int RTLD_NOW = 2; - - [DllImport("__Internal")] - private static extern IntPtr dlopen(string fileName, int flags); - - [DllImport("__Internal")] - private static extern IntPtr dlsym(IntPtr handle, string symbol); - - [DllImport("__Internal")] - private static extern int dlclose(IntPtr handle); - - #endregion - - public IntPtr LoadLibrary(string fileName) - { - return dlopen(fileName, RTLD_NOW); - } - - public IntPtr GetProcAddress(IntPtr handle, string name) - { - // Warning: dlsym could return IntPtr.Zero to a valid function. - // Error checking with dlerror is needed but we treat IntPtr.Zero as error value... - - return dlsym(handle, name); - } - - public void FreeLibrary(IntPtr handle) - { - dlclose(handle); - } - - public Icon GetIconForFile(string path) - { - return null; - } - - public void EnableDebugPrivileges() - { - - } - - public string UndecorateSymbolName(string name) - { - return name; - } - - public void SetProcessDpiAwareness() - { - - } - - public bool RegisterExtension(string fileExtension, string extensionId, string applicationPath, string applicationName) - { - return false; - } - - public void UnregisterExtension(string fileExtension, string extensionId) - { - - } - } -} diff --git a/ReClass.NET/Native/NativeMethods.cs b/ReClass.NET/Native/NativeMethods.cs index 397fc38b..2621051b 100644 --- a/ReClass.NET/Native/NativeMethods.cs +++ b/ReClass.NET/Native/NativeMethods.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics.Contracts; using System.Drawing; @@ -6,49 +6,7 @@ namespace ReClassNET.Native { public static class NativeMethods { - private static readonly INativeMethods nativeMethods; - - static NativeMethods() - { - if (IsUnix()) - { - nativeMethods = new NativeMethodsUnix(); - } - else - { - nativeMethods = new NativeMethodsWindows(); - } - } - - private static bool? isUnix; - public static bool IsUnix() - { - if (isUnix.HasValue) - { - return isUnix.Value; - } - - var p = GetPlatformId(); - - isUnix = (p == PlatformID.Unix) || (p == PlatformID.MacOSX) || ((int)p == 128); - - return isUnix.Value; - } - - private static PlatformID? plattformId; - public static PlatformID GetPlatformId() - { - if (plattformId.HasValue) - { - return plattformId.Value; - } - - plattformId = Environment.OSVersion.Platform; - - // TODO: Mono returns PlatformID.Unix on Mac OS X - - return plattformId.Value; - } + private static readonly INativeMethods nativeMethods = new NativeMethodsWindows(); public static IntPtr LoadLibrary(string name) { diff --git a/ReClass.NET/Plugins/PluginInfo.cs b/ReClass.NET/Plugins/PluginInfo.cs index c9c9e72f..f17c6d45 100644 --- a/ReClass.NET/Plugins/PluginInfo.cs +++ b/ReClass.NET/Plugins/PluginInfo.cs @@ -40,7 +40,7 @@ public PluginInfo(string filePath, FileVersionInfo versionInfo) Contract.Requires(versionInfo != null); FilePath = filePath; - IsNative = versionInfo.ProductName == null /* Unix */ || versionInfo.ProductName == PluginNativeName; + IsNative = versionInfo.ProductName == PluginNativeName; FileVersion = (versionInfo.FileVersion ?? string.Empty).Trim(); diff --git a/ReClass.NET/Program.cs b/ReClass.NET/Program.cs index 7fce8169..3fda9029 100644 --- a/ReClass.NET/Program.cs +++ b/ReClass.NET/Program.cs @@ -71,7 +71,7 @@ static void Main(string[] args) Settings = SettingsSerializer.Load(); Logger = new GuiLogger(); - if (!NativeMethods.IsUnix() && Settings.RunAsAdmin && !WinUtil.IsAdministrator) + if (Settings.RunAsAdmin && !WinUtil.IsAdministrator) { WinUtil.RunElevated(Process.GetCurrentProcess().MainModule?.FileName, args.Length > 0 ? string.Join(" ", args) : null); return; diff --git a/ReClass.NET/Properties/AssemblyInfo.cs b/ReClass.NET/Properties/AssemblyInfo.cs index 77d83991..864ea1b9 100644 --- a/ReClass.NET/Properties/AssemblyInfo.cs +++ b/ReClass.NET/Properties/AssemblyInfo.cs @@ -1,5 +1,6 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; +using System.Runtime.Versioning; // Allgemeine Informationen über eine Assembly werden über die folgenden // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, @@ -33,3 +34,4 @@ // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.2.0.0")] [assembly: AssemblyFileVersion("1.2.0.0")] +[assembly: SupportedOSPlatform("windows")] diff --git a/ReClass.NET/Symbols/SymbolStore.cs b/ReClass.NET/Symbols/SymbolStore.cs index 80aee721..a7f4b3da 100644 --- a/ReClass.NET/Symbols/SymbolStore.cs +++ b/ReClass.NET/Symbols/SymbolStore.cs @@ -67,13 +67,6 @@ public class SymbolStore public SymbolStore() { - if (NativeMethods.IsUnix()) - { - // TODO: Are there symbol files like on windows? - - return; - } - ResolveSearchPath(); var blacklistPath = Path.Combine(SymbolCachePath, BlackListFile); @@ -114,11 +107,6 @@ public void TryResolveSymbolsForModule(Module module) Contract.Requires(module != null); Contract.Requires(module.Name != null); - if (NativeMethods.IsUnix()) - { - return; - } - var name = module.Name.ToLower(); bool isBlacklisted; @@ -153,11 +141,6 @@ public void LoadSymbolsForModule(Module module) Contract.Requires(module != null); Contract.Requires(module.Name != null); - if (NativeMethods.IsUnix()) - { - return; - } - var moduleName = module.Name.ToLower(); bool createNew; @@ -181,11 +164,6 @@ public void LoadSymbolsFromPDB(string path) { Contract.Requires(path != null); - if (NativeMethods.IsUnix()) - { - return; - } - var moduleName = Path.GetFileName(path)?.ToLower(); if (string.IsNullOrEmpty(moduleName)) { @@ -214,11 +192,6 @@ public SymbolReader GetSymbolsForModule(Module module) Contract.Requires(module != null); Contract.Requires(module.Name != null); - if (NativeMethods.IsUnix()) - { - return null; - } - var name = module.Name.ToLower(); lock (symbolReaders) diff --git a/ReClass.NET_Launcher/Properties/AssemblyInfo.cs b/ReClass.NET_Launcher/Properties/AssemblyInfo.cs index efc03093..7c583712 100644 --- a/ReClass.NET_Launcher/Properties/AssemblyInfo.cs +++ b/ReClass.NET_Launcher/Properties/AssemblyInfo.cs @@ -1,6 +1,7 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Runtime.Versioning; // Allgemeine Informationen über eine Assembly werden über die folgenden // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, @@ -34,3 +35,4 @@ // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: SupportedOSPlatform("windows")] diff --git a/ReClass.NET_Launcher/ReClass.NET_Launcher.csproj b/ReClass.NET_Launcher/ReClass.NET_Launcher.csproj index f040db2c..3d80aec1 100644 --- a/ReClass.NET_Launcher/ReClass.NET_Launcher.csproj +++ b/ReClass.NET_Launcher/ReClass.NET_Launcher.csproj @@ -42,7 +42,6 @@ - From da0cd831a819028ecc19b6a99334da45dbbed5bc Mon Sep 17 00:00:00 2001 From: RequiDev Date: Fri, 23 Jan 2026 17:30:13 +0100 Subject: [PATCH 04/13] Force dark theme --- ReClass.NET/Forms/SettingsForm.cs | 3 + ReClass.NET/Settings.cs | 46 +++++--- ReClass.NET/UI/GlobalWindowManager.cs | 2 + ReClass.NET/UI/Theme.cs | 153 +++++++++++++++++++++++++ ReClass.NET/Util/SettingsSerializer.cs | 2 + 5 files changed, 192 insertions(+), 14 deletions(-) create mode 100644 ReClass.NET/UI/Theme.cs diff --git a/ReClass.NET/Forms/SettingsForm.cs b/ReClass.NET/Forms/SettingsForm.cs index 1f372de7..ca92643d 100644 --- a/ReClass.NET/Forms/SettingsForm.cs +++ b/ReClass.NET/Forms/SettingsForm.cs @@ -43,6 +43,9 @@ public SettingsForm(Settings settings, CppTypeMapping typeMapping) NativeMethodsWindows.SetButtonShield(createAssociationButton, true); NativeMethodsWindows.SetButtonShield(removeAssociationButton, true); + + colorsSettingTabPage.Enabled = false; + colorsSettingTabPage.ToolTipText = "Dark mode is enforced and cannot be changed."; } protected override void OnLoad(EventArgs e) diff --git a/ReClass.NET/Settings.cs b/ReClass.NET/Settings.cs index b5d9268b..a91f56e3 100644 --- a/ReClass.NET/Settings.cs +++ b/ReClass.NET/Settings.cs @@ -46,36 +46,54 @@ public class Settings // Colors - public Color BackgroundColor { get; set; } = Color.FromArgb(255, 255, 255); + public Color BackgroundColor { get; set; } = Color.FromArgb(30, 30, 30); - public Color SelectedColor { get; set; } = Color.FromArgb(240, 240, 240); + public Color SelectedColor { get; set; } = Color.FromArgb(45, 45, 48); - public Color HiddenColor { get; set; } = Color.FromArgb(240, 240, 240); + public Color HiddenColor { get; set; } = Color.FromArgb(60, 60, 60); - public Color OffsetColor { get; set; } = Color.FromArgb(255, 0, 0); + public Color OffsetColor { get; set; } = Color.FromArgb(255, 99, 99); - public Color AddressColor { get; set; } = Color.FromArgb(0, 200, 0); + public Color AddressColor { get; set; } = Color.FromArgb(78, 201, 176); - public Color HexColor { get; set; } = Color.FromArgb(0, 0, 0); + public Color HexColor { get; set; } = Color.FromArgb(220, 220, 220); - public Color TypeColor { get; set; } = Color.FromArgb(0, 0, 255); + public Color TypeColor { get; set; } = Color.FromArgb(86, 156, 214); - public Color NameColor { get; set; } = Color.FromArgb(32, 32, 128); + public Color NameColor { get; set; } = Color.FromArgb(214, 157, 133); - public Color ValueColor { get; set; } = Color.FromArgb(255, 128, 0); + public Color ValueColor { get; set; } = Color.FromArgb(181, 206, 168); - public Color IndexColor { get; set; } = Color.FromArgb(32, 200, 200); + public Color IndexColor { get; set; } = Color.FromArgb(220, 220, 170); - public Color CommentColor { get; set; } = Color.FromArgb(0, 200, 0); + public Color CommentColor { get; set; } = Color.FromArgb(87, 166, 74); - public Color TextColor { get; set; } = Color.FromArgb(0, 0, 255); + public Color TextColor { get; set; } = Color.FromArgb(206, 145, 120); - public Color VTableColor { get; set; } = Color.FromArgb(0, 255, 0); + public Color VTableColor { get; set; } = Color.FromArgb(78, 201, 176); - public Color PluginColor { get; set; } = Color.FromArgb(255, 0, 255); + public Color PluginColor { get; set; } = Color.FromArgb(197, 134, 192); public CustomDataMap CustomData { get; } = new CustomDataMap(); + public void ApplyDarkTheme() + { + BackgroundColor = Color.FromArgb(30, 30, 30); + SelectedColor = Color.FromArgb(45, 45, 48); + HiddenColor = Color.FromArgb(60, 60, 60); + OffsetColor = Color.FromArgb(255, 99, 99); + AddressColor = Color.FromArgb(78, 201, 176); + HexColor = Color.FromArgb(220, 220, 220); + TypeColor = Color.FromArgb(86, 156, 214); + NameColor = Color.FromArgb(214, 157, 133); + ValueColor = Color.FromArgb(181, 206, 168); + IndexColor = Color.FromArgb(220, 220, 170); + CommentColor = Color.FromArgb(87, 166, 74); + TextColor = Color.FromArgb(206, 145, 120); + VTableColor = Color.FromArgb(78, 201, 176); + PluginColor = Color.FromArgb(197, 134, 192); + } + public Settings Clone() => MemberwiseClone() as Settings; } } diff --git a/ReClass.NET/UI/GlobalWindowManager.cs b/ReClass.NET/UI/GlobalWindowManager.cs index 58c7b667..1104ef8d 100644 --- a/ReClass.NET/UI/GlobalWindowManager.cs +++ b/ReClass.NET/UI/GlobalWindowManager.cs @@ -35,6 +35,8 @@ public static void AddWindow(Form form) windows.Add(form); form.TopMost = Program.Settings.StayOnTop; + Theme.ApplyDarkTheme(form); + Theme.ApplyDarkThemeToContextMenus(form); WindowAdded?.Invoke(null, new GlobalWindowManagerEventArgs(form)); } diff --git a/ReClass.NET/UI/Theme.cs b/ReClass.NET/UI/Theme.cs new file mode 100644 index 00000000..6fb5cc16 --- /dev/null +++ b/ReClass.NET/UI/Theme.cs @@ -0,0 +1,153 @@ +using System.Drawing; +using System.Reflection; +using System.Windows.Forms; + +namespace ReClassNET.UI +{ + public static class Theme + { + public static readonly Color Background = Color.FromArgb(30, 30, 30); + public static readonly Color Foreground = Color.FromArgb(220, 220, 220); + public static readonly Color ControlBackground = Color.FromArgb(37, 37, 38); + public static readonly Color ControlBorder = Color.FromArgb(62, 62, 64); + public static readonly Color MenuHoverBackground = Color.FromArgb(62, 62, 64); + public static readonly Color MenuPressedBackground = Color.FromArgb(51, 51, 55); + + public static void ApplyDarkTheme(Control control) + { + if (control == null) + { + return; + } + + ApplyColors(control); + + foreach (Control child in control.Controls) + { + ApplyDarkTheme(child); + } + } + + public static void ApplyDarkThemeToContextMenus(Form form) + { + if (form == null) + { + return; + } + + var flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; + foreach (var field in form.GetType().GetFields(flags)) + { + if (field.GetValue(form) is ToolStrip strip) + { + ApplyToolStrip(strip); + } + } + } + + private static void ApplyColors(Control control) + { + switch (control) + { + case Form form: + form.BackColor = Background; + form.ForeColor = Foreground; + break; + case TabPage _: + case Panel _: + case GroupBox _: + case SplitContainer _: + control.BackColor = Background; + control.ForeColor = Foreground; + break; + case TextBoxBase _: + control.BackColor = ControlBackground; + control.ForeColor = Foreground; + break; + case ButtonBase _: + control.BackColor = ControlBackground; + control.ForeColor = Foreground; + break; + case ListView _: + case TreeView _: + control.BackColor = ControlBackground; + control.ForeColor = Foreground; + break; + case DataGridView grid: + grid.BackgroundColor = Background; + grid.ForeColor = Foreground; + grid.EnableHeadersVisualStyles = false; + grid.ColumnHeadersDefaultCellStyle.BackColor = ControlBackground; + grid.ColumnHeadersDefaultCellStyle.ForeColor = Foreground; + grid.DefaultCellStyle.BackColor = ControlBackground; + grid.DefaultCellStyle.ForeColor = Foreground; + grid.DefaultCellStyle.SelectionBackColor = Color.FromArgb(51, 51, 55); + grid.DefaultCellStyle.SelectionForeColor = Foreground; + grid.GridColor = ControlBorder; + break; + case ToolStrip strip: + ApplyToolStrip(strip); + break; + default: + control.BackColor = Background; + control.ForeColor = Foreground; + break; + } + } + + private static void ApplyToolStrip(ToolStrip strip) + { + strip.BackColor = Background; + strip.ForeColor = Foreground; + strip.Renderer = new DarkToolStripRenderer(); + + if (strip is ToolStripDropDown dropDown) + { + dropDown.BackColor = Background; + dropDown.ForeColor = Foreground; + } + + foreach (ToolStripItem item in strip.Items) + { + item.BackColor = Background; + item.ForeColor = Foreground; + + if (item is ToolStripDropDownItem dropDownItem) + { + ApplyToolStrip(dropDownItem.DropDown); + } + } + } + } + + internal sealed class DarkToolStripRenderer : ToolStripProfessionalRenderer + { + public DarkToolStripRenderer() + : base(new DarkColorTable()) + { + } + + protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e) + { + e.TextColor = Theme.Foreground; + base.OnRenderItemText(e); + } + } + + internal sealed class DarkColorTable : ProfessionalColorTable + { + public override Color MenuBorder => Theme.ControlBorder; + public override Color ToolStripBorder => Theme.ControlBorder; + public override Color MenuItemBorder => Theme.ControlBorder; + public override Color MenuItemSelected => Theme.MenuHoverBackground; + public override Color MenuItemSelectedGradientBegin => Theme.MenuHoverBackground; + public override Color MenuItemSelectedGradientEnd => Theme.MenuHoverBackground; + public override Color MenuItemPressedGradientBegin => Theme.MenuPressedBackground; + public override Color MenuItemPressedGradientMiddle => Theme.MenuPressedBackground; + public override Color MenuItemPressedGradientEnd => Theme.MenuPressedBackground; + public override Color ToolStripDropDownBackground => Theme.Background; + public override Color ImageMarginGradientBegin => Theme.Background; + public override Color ImageMarginGradientMiddle => Theme.Background; + public override Color ImageMarginGradientEnd => Theme.Background; + } +} diff --git a/ReClass.NET/Util/SettingsSerializer.cs b/ReClass.NET/Util/SettingsSerializer.cs index 2a5a4e82..970c4c5b 100644 --- a/ReClass.NET/Util/SettingsSerializer.cs +++ b/ReClass.NET/Util/SettingsSerializer.cs @@ -80,6 +80,8 @@ public static Settings Load() // ignored } + settings.ApplyDarkTheme(); + return settings; } From 4eb5bdfedfa4dd3ae8b8eef8570e362b57d3e213 Mon Sep 17 00:00:00 2001 From: RequiDev Date: Fri, 23 Jan 2026 18:14:44 +0100 Subject: [PATCH 05/13] Add CI build and release workflows --- .github/workflows/ci.yml | 32 ++++++++++++++++ .github/workflows/release.yml | 69 +++++++++++++++++++++++++++++++++++ global.json | 6 +++ 3 files changed, 107 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 global.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..f85a9dfb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: build + +on: + push: + branches: + - "**" + pull_request: + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "9.0.x" + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Restore + run: msbuild ReClass.NET.sln /t:Restore + + - name: Build x86 + run: msbuild ReClass.NET.sln /p:Configuration=Release /p:Platform=x86 /restore + + - name: Build x64 + run: msbuild ReClass.NET.sln /p:Configuration=Release /p:Platform=x64 /restore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..a2404b21 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,69 @@ +name: build-and-release + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "9.0.x" + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Restore + run: msbuild ReClass.NET.sln /t:Restore + + - name: Build x86 + run: msbuild ReClass.NET.sln /p:Configuration=Release /p:Platform=x86 /restore + + - name: Build x64 + run: msbuild ReClass.NET.sln /p:Configuration=Release /p:Platform=x64 /restore + + - name: Package + shell: pwsh + run: | + $ErrorActionPreference = "Stop" + $root = "$PWD" + $out = Join-Path $root "build/Release" + $x86 = Join-Path $out "x86" + $x64 = Join-Path $out "x64" + + New-Item -Force -ItemType Directory $x86, $x64 | Out-Null + + Copy-Item -Recurse -Force "$root/ReClass.NET/bin/Release/x86/*" $x86 + Copy-Item -Recurse -Force "$root/ReClass.NET/bin/Release/x64/*" $x64 + + New-Item -Force -ItemType Directory (Join-Path $x86 "Plugins"), (Join-Path $x64 "Plugins") | Out-Null + + Copy-Item -Recurse -Force "$root/Dependencies/x86/*" $x86 + Copy-Item -Recurse -Force "$root/Dependencies/x64/*" $x64 + + $launcher = Join-Path $out "Launcher" + New-Item -Force -ItemType Directory $launcher | Out-Null + Copy-Item -Recurse -Force "$root/ReClass.NET_Launcher/bin/Release/*" $launcher + + $zipPath = Join-Path $root "ReClass.NET-${{ github.ref_name }}.zip" + if (Test-Path $zipPath) { Remove-Item $zipPath -Force } + Compress-Archive -Path $out\* -DestinationPath $zipPath + + - name: Release + uses: softprops/action-gh-release@v2 + with: + files: | + ReClass.NET-${{ github.ref_name }}.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/global.json b/global.json new file mode 100644 index 00000000..cdbb589e --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "9.0.100", + "rollForward": "latestFeature" + } +} From bcb2561c86e9d68fb20adee6bd0d2c5c34d82ed5 Mon Sep 17 00:00:00 2001 From: RequiDev Date: Fri, 23 Jan 2026 18:28:01 +0100 Subject: [PATCH 06/13] Document and log Load PDB behavior --- ReClass.NET/Forms/MainForm.Designer.cs | 2 +- ReClass.NET/Forms/MainForm.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ReClass.NET/Forms/MainForm.Designer.cs b/ReClass.NET/Forms/MainForm.Designer.cs index e2b2a199..2a7d2e81 100644 --- a/ReClass.NET/Forms/MainForm.Designer.cs +++ b/ReClass.NET/Forms/MainForm.Designer.cs @@ -1253,6 +1253,7 @@ private void InitializeComponent() this.loadSymbolToolStripMenuItem.Name = "loadSymbolToolStripMenuItem"; this.loadSymbolToolStripMenuItem.Size = new System.Drawing.Size(194, 22); this.loadSymbolToolStripMenuItem.Text = "Load Symbol..."; + this.loadSymbolToolStripMenuItem.ToolTipText = "Load symbols from a PDB file (cached for this session)."; this.loadSymbolToolStripMenuItem.Click += new System.EventHandler(this.loadSymbolToolStripMenuItem_Click); // // loadSymbolsToolStripMenuItem @@ -1544,4 +1545,3 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem isLittleEndianToolStripMenuItem; } } - diff --git a/ReClass.NET/Forms/MainForm.cs b/ReClass.NET/Forms/MainForm.cs index 0198a3a8..1b12fb20 100644 --- a/ReClass.NET/Forms/MainForm.cs +++ b/ReClass.NET/Forms/MainForm.cs @@ -13,6 +13,7 @@ using ReClassNET.Core; using ReClassNET.DataExchange.ReClass; using ReClassNET.Extensions; +using ReClassNET.Logger; using ReClassNET.Memory; using ReClassNET.MemoryScanner; using ReClassNET.MemoryScanner.Comparer; @@ -373,6 +374,7 @@ private void loadSymbolToolStripMenuItem_Click(object sender, EventArgs e) try { Program.RemoteProcess.Symbols.LoadSymbolsFromPDB(ofd.FileName); + Program.Logger.Log(LogLevel.Information, $"Loaded PDB symbols from '{ofd.FileName}'."); } catch (Exception ex) { From c6524e5b53e5e15ea16d1fb52b90d420f6fa19df Mon Sep 17 00:00:00 2001 From: RequiDev Date: Fri, 23 Jan 2026 19:04:02 +0100 Subject: [PATCH 07/13] Include symsrv.dll in build outputs --- ReClass.NET/ReClass.NET.csproj | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ReClass.NET/ReClass.NET.csproj b/ReClass.NET/ReClass.NET.csproj index a654b0a1..e30f80b3 100644 --- a/ReClass.NET/ReClass.NET.csproj +++ b/ReClass.NET/ReClass.NET.csproj @@ -85,6 +85,18 @@ + + + PreserveNewest + + + + + + PreserveNewest + + + ResXFileCodeGenerator From 9675ee98526d0a35ab8b92e4c351129ba29cf9c9 Mon Sep 17 00:00:00 2001 From: RequiDev Date: Fri, 23 Jan 2026 19:20:12 +0100 Subject: [PATCH 08/13] Fix CI BuildDate generation --- .github/workflows/ci.yml | 9 +++++++++ .github/workflows/release.yml | 9 +++++++++ ReClass.NET/ReClass.NET.csproj | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f85a9dfb..c4cbfce1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,15 @@ jobs: - name: Setup MSBuild uses: microsoft/setup-msbuild@v2 + - name: Ensure BuildDate file + shell: pwsh + run: | + $path = "ReClass.NET/Resources/BuildDate.txt" + if (!(Test-Path $path)) { + New-Item -Force -ItemType Directory (Split-Path $path) | Out-Null + Get-Date -AsUTC -Format "yyyy/MM/dd HH:mm:ss" | Out-File $path + } + - name: Restore run: msbuild ReClass.NET.sln /t:Restore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a2404b21..24da9a79 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,6 +24,15 @@ jobs: - name: Setup MSBuild uses: microsoft/setup-msbuild@v2 + - name: Ensure BuildDate file + shell: pwsh + run: | + $path = "ReClass.NET/Resources/BuildDate.txt" + if (!(Test-Path $path)) { + New-Item -Force -ItemType Directory (Split-Path $path) | Out-Null + Get-Date -AsUTC -Format "yyyy/MM/dd HH:mm:ss" | Out-File $path + } + - name: Restore run: msbuild ReClass.NET.sln /t:Restore diff --git a/ReClass.NET/ReClass.NET.csproj b/ReClass.NET/ReClass.NET.csproj index e30f80b3..c11f4ca8 100644 --- a/ReClass.NET/ReClass.NET.csproj +++ b/ReClass.NET/ReClass.NET.csproj @@ -119,7 +119,8 @@ + - + From 97f7faac65558f3e0b283c923e9ee4376a6421bc Mon Sep 17 00:00:00 2001 From: RequiDev Date: Fri, 23 Jan 2026 19:31:01 +0100 Subject: [PATCH 09/13] Fix release packaging paths --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 24da9a79..e651658a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,8 +53,8 @@ jobs: New-Item -Force -ItemType Directory $x86, $x64 | Out-Null - Copy-Item -Recurse -Force "$root/ReClass.NET/bin/Release/x86/*" $x86 - Copy-Item -Recurse -Force "$root/ReClass.NET/bin/Release/x64/*" $x64 + Copy-Item -Recurse -Force "$root/bin/Release/x86/*" $x86 + Copy-Item -Recurse -Force "$root/bin/Release/x64/*" $x64 New-Item -Force -ItemType Directory (Join-Path $x86 "Plugins"), (Join-Path $x64 "Plugins") | Out-Null @@ -63,7 +63,7 @@ jobs: $launcher = Join-Path $out "Launcher" New-Item -Force -ItemType Directory $launcher | Out-Null - Copy-Item -Recurse -Force "$root/ReClass.NET_Launcher/bin/Release/*" $launcher + Copy-Item -Recurse -Force "$root/bin/Release/*" $launcher $zipPath = Join-Path $root "ReClass.NET-${{ github.ref_name }}.zip" if (Test-Path $zipPath) { Remove-Item $zipPath -Force } From 4017107c2601b927034a0842f9729ddec32c578c Mon Sep 17 00:00:00 2001 From: RequiDev Date: Fri, 23 Jan 2026 20:03:28 +0100 Subject: [PATCH 10/13] Use build artifacts for releases --- .github/workflows/ci.yml | 37 ++++++++++++++++ .github/workflows/release.yml | 83 ++++++++++++----------------------- 2 files changed, 66 insertions(+), 54 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4cbfce1..ca33dede 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,8 @@ on: push: branches: - "**" + tags: + - "v*" pull_request: jobs: @@ -39,3 +41,38 @@ jobs: - name: Build x64 run: msbuild ReClass.NET.sln /p:Configuration=Release /p:Platform=x64 /restore + + - name: Package release artifact + if: startsWith(github.ref, 'refs/tags/') + shell: pwsh + run: | + $ErrorActionPreference = "Stop" + $root = "$PWD" + $out = Join-Path $root "build/Release" + $x86 = Join-Path $out "x86" + $x64 = Join-Path $out "x64" + + New-Item -Force -ItemType Directory $x86, $x64 | Out-Null + + Copy-Item -Recurse -Force "$root/bin/Release/x86/*" $x86 + Copy-Item -Recurse -Force "$root/bin/Release/x64/*" $x64 + + New-Item -Force -ItemType Directory (Join-Path $x86 "Plugins"), (Join-Path $x64 "Plugins") | Out-Null + + Copy-Item -Recurse -Force "$root/Dependencies/x86/*" $x86 + Copy-Item -Recurse -Force "$root/Dependencies/x64/*" $x64 + + $launcher = Join-Path $out "Launcher" + New-Item -Force -ItemType Directory $launcher | Out-Null + Copy-Item -Recurse -Force "$root/bin/Release/*" $launcher + + $zipPath = Join-Path $root "ReClass.NET-$env:GITHUB_REF_NAME.zip" + if (Test-Path $zipPath) { Remove-Item $zipPath -Force } + Compress-Archive -Path $out\* -DestinationPath $zipPath + + - name: Upload release artifact + if: startsWith(github.ref, 'refs/tags/') + uses: actions/upload-artifact@v4 + with: + name: reclass-release + path: ReClass.NET-${{ github.ref_name }}.zip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e651658a..ce694efb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,78 +1,53 @@ -name: build-and-release +name: release on: - push: - tags: - - "v*" + workflow_run: + workflows: + - build + types: + - completed permissions: contents: write + actions: read jobs: - build: - runs-on: windows-latest + release: + runs-on: ubuntu-latest + if: github.event.workflow_run.conclusion == 'success' steps: - name: Checkout uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 with: - dotnet-version: "9.0.x" - - - name: Setup MSBuild - uses: microsoft/setup-msbuild@v2 + fetch-depth: 0 - - name: Ensure BuildDate file - shell: pwsh + - name: Resolve tag + id: tag run: | - $path = "ReClass.NET/Resources/BuildDate.txt" - if (!(Test-Path $path)) { - New-Item -Force -ItemType Directory (Split-Path $path) | Out-Null - Get-Date -AsUTC -Format "yyyy/MM/dd HH:mm:ss" | Out-File $path - } - - - name: Restore - run: msbuild ReClass.NET.sln /t:Restore + tag=$(git tag --points-at "${{ github.event.workflow_run.head_sha }}" | head -n 1) + echo "tag=$tag" >> "$GITHUB_OUTPUT" - - name: Build x86 - run: msbuild ReClass.NET.sln /p:Configuration=Release /p:Platform=x86 /restore - - - name: Build x64 - run: msbuild ReClass.NET.sln /p:Configuration=Release /p:Platform=x64 /restore - - - name: Package - shell: pwsh + - name: Ensure tag is present + if: steps.tag.outputs.tag == '' run: | - $ErrorActionPreference = "Stop" - $root = "$PWD" - $out = Join-Path $root "build/Release" - $x86 = Join-Path $out "x86" - $x64 = Join-Path $out "x64" - - New-Item -Force -ItemType Directory $x86, $x64 | Out-Null + echo "No tag found for ${{ github.event.workflow_run.head_sha }}. Skipping release." + exit 0 - Copy-Item -Recurse -Force "$root/bin/Release/x86/*" $x86 - Copy-Item -Recurse -Force "$root/bin/Release/x64/*" $x64 - - New-Item -Force -ItemType Directory (Join-Path $x86 "Plugins"), (Join-Path $x64 "Plugins") | Out-Null - - Copy-Item -Recurse -Force "$root/Dependencies/x86/*" $x86 - Copy-Item -Recurse -Force "$root/Dependencies/x64/*" $x64 - - $launcher = Join-Path $out "Launcher" - New-Item -Force -ItemType Directory $launcher | Out-Null - Copy-Item -Recurse -Force "$root/bin/Release/*" $launcher - - $zipPath = Join-Path $root "ReClass.NET-${{ github.ref_name }}.zip" - if (Test-Path $zipPath) { Remove-Item $zipPath -Force } - Compress-Archive -Path $out\* -DestinationPath $zipPath + - name: Download release artifact + if: steps.tag.outputs.tag != '' + uses: dawidd6/action-download-artifact@v3 + with: + name: reclass-release + run_id: ${{ github.event.workflow_run.id }} + path: . - name: Release + if: steps.tag.outputs.tag != '' uses: softprops/action-gh-release@v2 with: + tag_name: ${{ steps.tag.outputs.tag }} files: | - ReClass.NET-${{ github.ref_name }}.zip + ReClass.NET-${{ steps.tag.outputs.tag }}.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a36a6284156eb022725d157be12e8a9c4abde616 Mon Sep 17 00:00:00 2001 From: RequiDev Date: Fri, 23 Jan 2026 20:06:39 +0100 Subject: [PATCH 11/13] Package release from bin/Release --- .github/workflows/ci.yml | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca33dede..d00e15f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,27 +48,9 @@ jobs: run: | $ErrorActionPreference = "Stop" $root = "$PWD" - $out = Join-Path $root "build/Release" - $x86 = Join-Path $out "x86" - $x64 = Join-Path $out "x64" - - New-Item -Force -ItemType Directory $x86, $x64 | Out-Null - - Copy-Item -Recurse -Force "$root/bin/Release/x86/*" $x86 - Copy-Item -Recurse -Force "$root/bin/Release/x64/*" $x64 - - New-Item -Force -ItemType Directory (Join-Path $x86 "Plugins"), (Join-Path $x64 "Plugins") | Out-Null - - Copy-Item -Recurse -Force "$root/Dependencies/x86/*" $x86 - Copy-Item -Recurse -Force "$root/Dependencies/x64/*" $x64 - - $launcher = Join-Path $out "Launcher" - New-Item -Force -ItemType Directory $launcher | Out-Null - Copy-Item -Recurse -Force "$root/bin/Release/*" $launcher - $zipPath = Join-Path $root "ReClass.NET-$env:GITHUB_REF_NAME.zip" if (Test-Path $zipPath) { Remove-Item $zipPath -Force } - Compress-Archive -Path $out\* -DestinationPath $zipPath + Compress-Archive -Path "$root/bin/Release/*" -DestinationPath $zipPath - name: Upload release artifact if: startsWith(github.ref, 'refs/tags/') From 79fc582741d57553951371b049802b7d49075e20 Mon Sep 17 00:00:00 2001 From: RequiDev Date: Fri, 23 Jan 2026 20:17:55 +0100 Subject: [PATCH 12/13] Trim release package contents --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d00e15f0..910fce22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,9 +48,15 @@ jobs: run: | $ErrorActionPreference = "Stop" $root = "$PWD" + $releaseRoot = Join-Path $root "bin/Release" + + Get-ChildItem -Path $releaseRoot -Recurse -Include *.pdb, *.lib, *.exp | Remove-Item -Force + Remove-Item -Force "$releaseRoot/x86/ReClass.NET_Launcher.*" -ErrorAction SilentlyContinue + Remove-Item -Force "$releaseRoot/x64/ReClass.NET_Launcher.*" -ErrorAction SilentlyContinue + $zipPath = Join-Path $root "ReClass.NET-$env:GITHUB_REF_NAME.zip" if (Test-Path $zipPath) { Remove-Item $zipPath -Force } - Compress-Archive -Path "$root/bin/Release/*" -DestinationPath $zipPath + Compress-Archive -Path "$releaseRoot/*" -DestinationPath $zipPath - name: Upload release artifact if: startsWith(github.ref, 'refs/tags/') From 18b3c163a38f41d6c8bd68a23ee9d5ebe38b2bf2 Mon Sep 17 00:00:00 2001 From: RequiDev Date: Fri, 23 Jan 2026 20:26:58 +0100 Subject: [PATCH 13/13] Gate release job on tag builds --- .github/workflows/release.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ce694efb..260e8272 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,9 +12,11 @@ permissions: actions: read jobs: - release: + resolve: runs-on: ubuntu-latest if: github.event.workflow_run.conclusion == 'success' + outputs: + tag: ${{ steps.tag.outputs.tag }} steps: - name: Checkout @@ -27,15 +29,13 @@ jobs: run: | tag=$(git tag --points-at "${{ github.event.workflow_run.head_sha }}" | head -n 1) echo "tag=$tag" >> "$GITHUB_OUTPUT" + release: + runs-on: ubuntu-latest + needs: resolve + if: needs.resolve.outputs.tag != '' - - name: Ensure tag is present - if: steps.tag.outputs.tag == '' - run: | - echo "No tag found for ${{ github.event.workflow_run.head_sha }}. Skipping release." - exit 0 - + steps: - name: Download release artifact - if: steps.tag.outputs.tag != '' uses: dawidd6/action-download-artifact@v3 with: name: reclass-release @@ -43,11 +43,10 @@ jobs: path: . - name: Release - if: steps.tag.outputs.tag != '' uses: softprops/action-gh-release@v2 with: - tag_name: ${{ steps.tag.outputs.tag }} + tag_name: ${{ needs.resolve.outputs.tag }} files: | - ReClass.NET-${{ steps.tag.outputs.tag }}.zip + ReClass.NET-${{ needs.resolve.outputs.tag }}.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}