├── ACEPatcher
├── Resources
│ ├── placeholder.txt
│ ├── patch.ico
│ ├── ACEx32.dll
│ ├── ACEx64.dll
│ ├── 0Harmony.dll
│ ├── Class_16x.png
│ ├── Method_16x.png
│ ├── Module_16x.png
│ ├── Assembly_16x.png
│ ├── DllInjector.exe
│ ├── Property_16x.png
│ ├── ClassFriend_16x.png
│ ├── DllInjector64.exe
│ ├── Namespace_16x.png
│ ├── ClassPrivate_16x.png
│ ├── MethodFriend_16x.png
│ ├── MethodPrivate_16x.png
│ ├── MethodProtect_16x.png
│ ├── ClassProtected_16x.png
│ └── ExtensionMethod_16x.png
├── patch.ico
├── packages.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── App.config
├── Program.cs
├── PatchDialog.cs
├── Controls
│ └── DarkToolStripRenderer.cs
├── ACEFiles.Designer.cs
├── PatchDialog.resx
├── MainFRM.resx
├── DotNetUtils.cs
├── PatchDialog.Designer.cs
├── ACEFiles.resx
├── ACEPatcher.csproj
├── TreeViewLoader.cs
├── Icons.Designer.cs
├── ConfigManager.cs
├── Icons.resx
├── ModuleLoader
│ └── DotNetModuleLoader.cs
├── MainFRM.cs
├── MainFRM.Designer.cs
└── Patcher.cs
├── AceTest
├── Class1.cs
├── Properties
│ └── AssemblyInfo.cs
└── AceTest.csproj
├── ACEPatcher.sln
└── README.md
/ACEPatcher/Resources/placeholder.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/ACEPatcher/patch.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/patch.ico
--------------------------------------------------------------------------------
/ACEPatcher/Resources/patch.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/patch.ico
--------------------------------------------------------------------------------
/ACEPatcher/Resources/ACEx32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/ACEx32.dll
--------------------------------------------------------------------------------
/ACEPatcher/Resources/ACEx64.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/ACEx64.dll
--------------------------------------------------------------------------------
/ACEPatcher/Resources/0Harmony.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/0Harmony.dll
--------------------------------------------------------------------------------
/ACEPatcher/Resources/Class_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/Class_16x.png
--------------------------------------------------------------------------------
/ACEPatcher/Resources/Method_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/Method_16x.png
--------------------------------------------------------------------------------
/ACEPatcher/Resources/Module_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/Module_16x.png
--------------------------------------------------------------------------------
/ACEPatcher/Resources/Assembly_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/Assembly_16x.png
--------------------------------------------------------------------------------
/ACEPatcher/Resources/DllInjector.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/DllInjector.exe
--------------------------------------------------------------------------------
/ACEPatcher/Resources/Property_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/Property_16x.png
--------------------------------------------------------------------------------
/ACEPatcher/Resources/ClassFriend_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/ClassFriend_16x.png
--------------------------------------------------------------------------------
/ACEPatcher/Resources/DllInjector64.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/DllInjector64.exe
--------------------------------------------------------------------------------
/ACEPatcher/Resources/Namespace_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/Namespace_16x.png
--------------------------------------------------------------------------------
/ACEPatcher/Resources/ClassPrivate_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/ClassPrivate_16x.png
--------------------------------------------------------------------------------
/ACEPatcher/Resources/MethodFriend_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/MethodFriend_16x.png
--------------------------------------------------------------------------------
/ACEPatcher/Resources/MethodPrivate_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/MethodPrivate_16x.png
--------------------------------------------------------------------------------
/ACEPatcher/Resources/MethodProtect_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/MethodProtect_16x.png
--------------------------------------------------------------------------------
/ACEPatcher/Resources/ClassProtected_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/ClassProtected_16x.png
--------------------------------------------------------------------------------
/ACEPatcher/Resources/ExtensionMethod_16x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BataBo/ACEPatcher/HEAD/ACEPatcher/Resources/ExtensionMethod_16x.png
--------------------------------------------------------------------------------
/ACEPatcher/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ACEPatcher/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/AceTest/Class1.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Collections.Specialized;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Net;
8 | using System.Security.Cryptography;
9 | using System.Security.Cryptography.X509Certificates;
10 | using System.Text;
11 | using System.Threading.Tasks;
12 |
13 | namespace AceTest
14 | {
15 | public class Program
16 | {
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/ACEPatcher/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ACEPatcher/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace ACEPatcher
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new MainFRM());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/ACEPatcher/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 |
12 | namespace ACEPatcher.Properties
13 | {
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
17 | {
18 |
19 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
20 |
21 | public static Settings Default
22 | {
23 | get
24 | {
25 | return defaultInstance;
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/AceTest/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("AceTest")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("AceTest")]
13 | [assembly: AssemblyCopyright("Copyright © 2022")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("6699f677-f1b1-49eb-bb34-509714188027")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ACEPatcher/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ACEPatcher")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ACEPatcher")]
13 | [assembly: AssemblyCopyright("Copyright © 2022")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("f7f4a377-f96f-4cb6-91f1-bcee82a8de63")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ACEPatcher/PatchDialog.cs:
--------------------------------------------------------------------------------
1 | using dnlib.DotNet;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using System.Data;
6 | using System.Drawing;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows.Forms;
11 |
12 | namespace ACEPatcher
13 | {
14 | public partial class PatchDialog : Form
15 | {
16 | public IMethod SelectedMethod;
17 |
18 | public PatchDialog()
19 | {
20 | InitializeComponent();
21 | treeView1.ImageList = TreeViewLoader.Images;
22 | TreeViewLoader.FillTreeView(Patcher.patchAssembly,null, treeView1);
23 | this.Icon = Icons.patch;
24 | }
25 |
26 | private void button1_Click(object sender, EventArgs e)
27 | {
28 | if(treeView1.SelectedNode == null)
29 | {
30 | MessageBox.Show("Please select a patch method", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
31 | }
32 | else
33 | {
34 | if (treeView1.SelectedNode.Tag.GetType().GetInterfaces().Contains(typeof(IMethodDefOrRef)))
35 | {
36 | SelectedMethod = (IMethod)treeView1.SelectedNode.Tag;
37 | DialogResult = DialogResult.OK;
38 | Close();
39 | }
40 | else
41 | {
42 | MessageBox.Show("Please select a valid method", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
43 | }
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/ACEPatcher.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.31729.503
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACEPatcher", "ACEPatcher\ACEPatcher.csproj", "{F7F4A377-F96F-4CB6-91F1-BCEE82A8DE63}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AceTest", "AceTest\AceTest.csproj", "{6699F677-F1B1-49EB-BB34-509714188027}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {F7F4A377-F96F-4CB6-91F1-BCEE82A8DE63}.Debug|Any CPU.ActiveCfg = Debug|x64
17 | {F7F4A377-F96F-4CB6-91F1-BCEE82A8DE63}.Debug|Any CPU.Build.0 = Debug|x64
18 | {F7F4A377-F96F-4CB6-91F1-BCEE82A8DE63}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {F7F4A377-F96F-4CB6-91F1-BCEE82A8DE63}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {6699F677-F1B1-49EB-BB34-509714188027}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {6699F677-F1B1-49EB-BB34-509714188027}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {6699F677-F1B1-49EB-BB34-509714188027}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {6699F677-F1B1-49EB-BB34-509714188027}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {0208B823-B731-4D3C-96B0-FCCE4E00F5B2}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/AceTest/AceTest.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {6699F677-F1B1-49EB-BB34-509714188027}
8 | Library
9 | Properties
10 | AceTest
11 | AceTest
12 | v4.7.2
13 | 512
14 | true
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/ACEPatcher/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 |
12 | namespace ACEPatcher.Properties
13 | {
14 | ///
15 | /// A strongly-typed resource class, for looking up localized strings, etc.
16 | ///
17 | // This class was auto-generated by the StronglyTypedResourceBuilder
18 | // class via a tool like ResGen or Visual Studio.
19 | // To add or remove a member, edit your .ResX file then rerun ResGen
20 | // with the /str option, or rebuild your VS project.
21 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
22 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
23 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
24 | internal class Resources
25 | {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources()
33 | {
34 | }
35 |
36 | ///
37 | /// Returns the cached ResourceManager instance used by this class.
38 | ///
39 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
40 | internal static global::System.Resources.ResourceManager ResourceManager
41 | {
42 | get
43 | {
44 | if ((resourceMan == null))
45 | {
46 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ACEPatcher.Properties.Resources", typeof(Resources).Assembly);
47 | resourceMan = temp;
48 | }
49 | return resourceMan;
50 | }
51 | }
52 |
53 | ///
54 | /// Overrides the current thread's CurrentUICulture property for all
55 | /// resource lookups using this strongly typed resource class.
56 | ///
57 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
58 | internal static global::System.Globalization.CultureInfo Culture
59 | {
60 | get
61 | {
62 | return resourceCulture;
63 | }
64 | set
65 | {
66 | resourceCulture = value;
67 | }
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/ACEPatcher/Controls/DarkToolStripRenderer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 |
5 | namespace ACEPatcher.Controls
6 | {
7 | public class DarkMenuRenderer : ToolStripRenderer
8 | {
9 | #region Initialisation Region
10 |
11 | protected override void Initialize(ToolStrip toolStrip)
12 | {
13 | base.Initialize(toolStrip);
14 |
15 | toolStrip.BackColor = Color.FromArgb(27, 27, 28);
16 | toolStrip.ForeColor = Color.FromArgb(220, 220, 220);
17 | }
18 |
19 | protected override void InitializeItem(ToolStripItem item)
20 | {
21 | base.InitializeItem(item);
22 |
23 | item.BackColor = Color.FromArgb(27, 27, 28);
24 | item.ForeColor = Color.FromArgb(220, 220, 220);
25 |
26 | if (item.GetType() == typeof(ToolStripSeparator))
27 | {
28 | item.Margin = new Padding(0, 0, 0, 0);
29 | }
30 | }
31 |
32 | #endregion
33 |
34 | #region Render Region
35 |
36 | protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
37 | {
38 | var g = e.Graphics;
39 | using (var b = new SolidBrush(Color.FromArgb(27, 27, 28)))
40 | {
41 | g.FillRectangle(b, e.AffectedBounds);
42 | }
43 | }
44 |
45 | protected override void OnRenderImageMargin(ToolStripRenderEventArgs e)
46 | {
47 | var g = e.Graphics;
48 |
49 | var rect = new Rectangle(0, 0, e.ToolStrip.Width - 1, e.ToolStrip.Height - 1);
50 |
51 | using (var p = new Pen(Color.FromArgb(51, 51, 51)))
52 | {
53 | g.DrawRectangle(p, rect);
54 | }
55 | }
56 |
57 | protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
58 | {
59 | var g = e.Graphics;
60 |
61 | var rect = new Rectangle(e.ImageRectangle.Left - 2, e.ImageRectangle.Top + 2,
62 | e.ImageRectangle.Width + 4, e.ImageRectangle.Height + 4);
63 |
64 | using (var b = new SolidBrush(Color.FromArgb(62, 62, 64)))
65 | {
66 | g.FillRectangle(b, rect);
67 | }
68 |
69 | using (var p = new Pen(Color.FromArgb(0, 0, 56)))
70 | {
71 | var modRect = new Rectangle(rect.Left, rect.Top, rect.Width - 1, rect.Height - 1);
72 | g.DrawRectangle(p, modRect);
73 | }
74 |
75 | }
76 |
77 | protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e)
78 | {
79 | /*var g = e.Graphics;
80 |
81 | var rect = new Rectangle(1, 3, e.Item.Width, 1);
82 |
83 | using (var b = new SolidBrush(Color.FromArgb(81, 81, 81)))
84 | {
85 | g.FillRectangle(b, rect);
86 | }*/
87 | }
88 |
89 | protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
90 | {
91 | e.ArrowColor = Color.FromArgb(220, 220, 220);
92 | e.ArrowRectangle = new Rectangle(new Point(e.ArrowRectangle.Left, e.ArrowRectangle.Top - 1), e.ArrowRectangle.Size);
93 |
94 | base.OnRenderArrow(e);
95 | }
96 |
97 | protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
98 | {
99 | var g = e.Graphics;
100 |
101 | e.Item.ForeColor = e.Item.Enabled ? Color.FromArgb(220, 220, 220) : Color.FromArgb(153, 153, 153);
102 |
103 | if (e.Item.Enabled)
104 | {
105 |
106 | var bgColor = e.Item.Selected ? Color.FromArgb(62, 62, 64) : e.Item.BackColor;
107 |
108 | // Normal item
109 | var rect = new Rectangle(0, 0, e.Item.Width, e.Item.Height);
110 |
111 | using (var b = new SolidBrush(bgColor))
112 | {
113 | g.FillRectangle(b, rect);
114 | }
115 |
116 | // Header item on open menu
117 | if (e.Item.GetType() == typeof(ToolStripMenuItem))
118 | {
119 | if (((ToolStripMenuItem)e.Item).DropDown.Visible && e.Item.IsOnDropDown == false)
120 | {
121 | using (var b = new SolidBrush(Color.FromArgb(27, 27, 28)))
122 | {
123 | g.FillRectangle(b, rect);
124 | }
125 | }
126 | }
127 | }
128 | }
129 |
130 | #endregion
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/ACEPatcher/ACEFiles.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ACEPatcher {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class ACEFiles {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal ACEFiles() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ACEPatcher.ACEFiles", typeof(ACEFiles).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized resource of type System.Byte[].
65 | ///
66 | internal static byte[] _0Harmony {
67 | get {
68 | object obj = ResourceManager.GetObject("_0Harmony", resourceCulture);
69 | return ((byte[])(obj));
70 | }
71 | }
72 |
73 | ///
74 | /// Looks up a localized resource of type System.Byte[].
75 | ///
76 | internal static byte[] ACEx32 {
77 | get {
78 | object obj = ResourceManager.GetObject("ACEx32", resourceCulture);
79 | return ((byte[])(obj));
80 | }
81 | }
82 |
83 | ///
84 | /// Looks up a localized resource of type System.Byte[].
85 | ///
86 | internal static byte[] ACEx64 {
87 | get {
88 | object obj = ResourceManager.GetObject("ACEx64", resourceCulture);
89 | return ((byte[])(obj));
90 | }
91 | }
92 |
93 | ///
94 | /// Looks up a localized resource of type System.Byte[].
95 | ///
96 | internal static byte[] DllInjector {
97 | get {
98 | object obj = ResourceManager.GetObject("DllInjector", resourceCulture);
99 | return ((byte[])(obj));
100 | }
101 | }
102 |
103 | ///
104 | /// Looks up a localized resource of type System.Byte[].
105 | ///
106 | internal static byte[] DllInjector64 {
107 | get {
108 | object obj = ResourceManager.GetObject("DllInjector64", resourceCulture);
109 | return ((byte[])(obj));
110 | }
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ACEPatcher
2 | A simple to use, gui based program for patching .NET assemblies
3 |
4 | 
5 |
6 | ## Features
7 |
8 | * Patches a wide range of methods(static methods, instance methods, constructors, getters, setters, etc.)
9 | * Works on packed assemblies
10 | * Works on a majority of obfuscators(including but not limited to:DnGuard,Eazfuscator,VMProtect,.NET reactor,Babel,Crypto Obfuscator and many more)
11 | * Easy and intuative GUI
12 | * Exports patches
13 | * Exports patches with password
14 | * Imports patches
15 |
16 | ## How to write patch methods
17 |
18 | Firstly you have to analyze the target assembly and see which methods do you want to patch, once you found the methods you want to patch open a new visual studio c# project and write patch methods after you have written patch methods compile the assembly with Release build.
19 |
20 | Patch method must be static and public.
21 |
22 | If the target method is static, the signature of the patch method must match the signature of target method:
23 |
24 | ```cs
25 | //Target method
26 | private static bool TargetMethod(string text,byte[] array)
27 | {
28 | //...
29 | }
30 |
31 | //Patch method
32 | public static bool PatchMethod(string something,byte[] somethingelse)
33 | {
34 | //...
35 | }
36 | ```
37 |
38 | If the target method is not static, patch method must return the same type, first argument of the patch method must be type target method belongs to and the rest of the arguments are copied from the target method:
39 |
40 | ```cs
41 | //Target method
42 | class A
43 | {
44 | private int TargetMethod(string text)
45 | {
46 | //...
47 | }
48 | }
49 |
50 | //Patch method
51 | public static int PatchMethod(A instance,string text)
52 | {
53 | //...
54 | }
55 | ```
56 |
57 | Within the patch method you can modify the return value of the TargetMethod:
58 |
59 | ```cs
60 | //Target method
61 | private static bool TargetMethod(string text)
62 | {
63 | //...
64 | }
65 |
66 | //Patch method
67 | public static bool PatchMethod(string text)
68 | {
69 | return true;
70 | }
71 | ```
72 |
73 | You can execute the original method by calling the patch method from within itself, the values of passed parameters will be ignored to change parameters modify the values of parameters passed to patch method:
74 |
75 | ```cs
76 | //Target method
77 | private static bool TargetMethod(string text)
78 | {
79 | //...
80 | }
81 |
82 | //Patch method
83 | public static bool PatchMethod(string text)
84 | {
85 | //This will change the text parameter in the original method
86 | text = "Something else";
87 | //This will return the execution to the original method
88 | return PatchMethod(text);
89 | }
90 | ```
91 |
92 | Or you could do both:
93 |
94 | ```cs
95 | //Target method
96 | private static bool TargetMethod(string text)
97 | {
98 | //...
99 | }
100 |
101 | //Patch method
102 | public static bool PatchMethod(string text)
103 | {
104 | if(text.Contains("Invalid password"))
105 | return true;
106 | else
107 | return PatchMethod(text);
108 | }
109 | ```
110 |
111 | If the method is not static you can also edit the values of fields and properties on the object associated with target method.
112 |
113 | ## How to patch assembly
114 |
115 | Once you wrote the patch methods and compiled them into a .NET assembly open ACE patcher
116 |
117 | Go to file -> open or click ctrl+o or drag n' drop target assembly onto ACE patcher.
118 | Note: if you are loading in a packed assembly you must use 32 bit ACE patcher for 32 bit assembly and 64 bit ACE patcher for 64 bit assembly.
119 | After the assembly is imported you will see it and it's dependancies in the 'Assembly Tree' panel, this panel has an interface similar to that of DnSpy.
120 | Navigate to the methods you want to patch and double click them, if this is the first patch you are making the program will ask you to load the patch assembly.
121 | A new window will appear that will list all the methods in the patch assembly, choose the one that patches the target method and then click on Add patch button.
122 | Repeat that for all the methods you want to patch and after you've patched all the methods click on the apply patches button.
123 | Then, in the result folder, move all of the files associated with the main assembly(resources ,configurations ,dll dependancies , misc files) and then click on Execute.bat to run patched version of the assembly.
124 |
125 | ## Export patch
126 |
127 | Let's say you have 5 assemblies that use the same auth provider, it would be tedious to manually patch every single one, so that is why export functionality exists to use it first patch one of the assemblies manually then go to file -> Export or click ctrl+E and the patch will be saved as file then load in the seconds assembly go to file -> Import or clicl ctrl+I to import all of the patches, these exports can also be distributed.
128 |
129 | ACE patcher also allows you to password protect patches to export password protected patch go to File -> Secure Export or click ctrl+shift+E, when you try to import password protected patch you will be asked to provide the password and you won't be able to load the patch without the correct password.
130 |
131 | ## Credits
132 | * [dnlib](https://github.com/0xd4d/dnlib) - This is used for .net assembly manipulation
133 | * [Harmony](https://github.com/pardeike/Harmony) - This is used for patching the assemblies
134 | * [JitFreezer](https://github.com/okieeee/JIT-Freezer) - This is used to deal with anti-dump when loading packed files
135 | * [DarkUI](https://github.com/RobinPerris/DarkUI) - This is used for the dark theme
136 |
--------------------------------------------------------------------------------
/ACEPatcher/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/ACEPatcher/PatchDialog.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/ACEPatcher/MainFRM.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/ACEPatcher/DotNetUtils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Collections.Generic;
4 | using dnlib.DotNet;
5 | using dnlib.DotNet.Emit;
6 | using dnlib.PE;
7 |
8 | namespace ACEPatcher
9 | {
10 |
11 | public static class DotNetUtils
12 | {
13 |
14 | public static IDictionary CreateObjectToIndexDictionary(IList objs)
15 | {
16 | var dict = new Dictionary();
17 | for (int i = 0; i < objs.Count; i++)
18 | dict[objs[i]] = i;
19 | return dict;
20 | }
21 | public static void CopyBody(MethodDef method, out IList instructions, out IList exceptionHandlers)
22 | {
23 | if (method == null || !method.HasBody)
24 | {
25 | instructions = new List();
26 | exceptionHandlers = new List();
27 | return;
28 | }
29 |
30 | var oldInstrs = method.Body.Instructions;
31 | var oldExHandlers = method.Body.ExceptionHandlers;
32 | instructions = new List(oldInstrs.Count);
33 | exceptionHandlers = new List(oldExHandlers.Count);
34 | var oldToIndex = CreateObjectToIndexDictionary(oldInstrs);
35 |
36 | foreach (var oldInstr in oldInstrs)
37 | instructions.Add(oldInstr.Clone());
38 |
39 | foreach (var newInstr in instructions)
40 | {
41 | var operand = newInstr.Operand;
42 | if (operand is Instruction)
43 | newInstr.Operand = instructions[oldToIndex[(Instruction)operand]];
44 | else if (operand is IList oldArray)
45 | {
46 | var newArray = new Instruction[oldArray.Count];
47 | for (int i = 0; i < oldArray.Count; i++)
48 | newArray[i] = instructions[oldToIndex[oldArray[i]]];
49 | newInstr.Operand = newArray;
50 | }
51 | }
52 |
53 | foreach (var oldEx in oldExHandlers)
54 | {
55 | var newEx = new ExceptionHandler(oldEx.HandlerType)
56 | {
57 | TryStart = GetInstruction(instructions, oldToIndex, oldEx.TryStart),
58 | TryEnd = GetInstruction(instructions, oldToIndex, oldEx.TryEnd),
59 | FilterStart = GetInstruction(instructions, oldToIndex, oldEx.FilterStart),
60 | HandlerStart = GetInstruction(instructions, oldToIndex, oldEx.HandlerStart),
61 | HandlerEnd = GetInstruction(instructions, oldToIndex, oldEx.HandlerEnd),
62 | CatchType = oldEx.CatchType,
63 | };
64 | exceptionHandlers.Add(newEx);
65 | }
66 | }
67 |
68 | static Instruction GetInstruction(IList instructions, IDictionary instructionToIndex, Instruction instruction)
69 | {
70 | if (instruction == null)
71 | return null;
72 | return instructions[instructionToIndex[instruction]];
73 | }
74 |
75 | public static void RestoreBody(MethodDef method, IEnumerable instructions, IEnumerable exceptionHandlers)
76 | {
77 | if (method == null || method.Body == null)
78 | return;
79 |
80 | var bodyInstrs = method.Body.Instructions;
81 | bodyInstrs.Clear();
82 | foreach (var instr in instructions)
83 | bodyInstrs.Add(instr);
84 |
85 | var bodyExceptionHandlers = method.Body.ExceptionHandlers;
86 | bodyExceptionHandlers.Clear();
87 | foreach (var eh in exceptionHandlers)
88 | bodyExceptionHandlers.Add(eh);
89 | }
90 |
91 | public static void CopyBodyFromTo(MethodDef fromMethod, MethodDef toMethod)
92 | {
93 | if (fromMethod == toMethod)
94 | return;
95 |
96 | CopyBody(fromMethod, out var instructions, out var exceptionHandlers);
97 | RestoreBody(toMethod, instructions, exceptionHandlers);
98 | CopyLocalsFromTo(fromMethod, toMethod);
99 | UpdateInstructionOperands(fromMethod, toMethod);
100 | }
101 |
102 | static void CopyLocalsFromTo(MethodDef fromMethod, MethodDef toMethod)
103 | {
104 | var fromBody = fromMethod.Body;
105 | var toBody = toMethod.Body;
106 |
107 | toBody.Variables.Clear();
108 | foreach (var local in fromBody.Variables)
109 | toBody.Variables.Add(new Local(local.Type));
110 | }
111 |
112 | static void UpdateInstructionOperands(MethodDef fromMethod, MethodDef toMethod)
113 | {
114 | var fromBody = fromMethod.Body;
115 | var toBody = toMethod.Body;
116 |
117 | toBody.InitLocals = fromBody.InitLocals;
118 | toBody.MaxStack = fromBody.MaxStack;
119 |
120 | var newOperands = new Dictionary