Skip to content

Commit 564631c

Browse files
committed
1.1
++ Добавлен патч для открытия DevTools в любом окне + Стилизован вывод
1 parent 89d0b2b commit 564631c

41 files changed

Lines changed: 151 additions & 662 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
11.5 KB
Binary file not shown.

OverwolfInsiderPatcher/ILMergeOrder.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

OverwolfInsiderPatcher/OverwolfInsiderPatcher.csproj

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props" Condition="Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props')" />
4-
<Import Project="..\packages\ILMerge.3.0.29\build\ILMerge.props" Condition="Exists('..\packages\ILMerge.3.0.29\build\ILMerge.props')" />
53
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
64
<PropertyGroup>
75
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -73,16 +71,6 @@
7371
</ItemGroup>
7472
<ItemGroup>
7573
<Content Include="IconFileOverwolf_32Bit_16_32_48_256.ico" />
76-
<Content Include="ILMergeOrder.txt" />
7774
</ItemGroup>
7875
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
79-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
80-
<PropertyGroup>
81-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
82-
</PropertyGroup>
83-
<Error Condition="!Exists('..\packages\ILMerge.3.0.29\build\ILMerge.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ILMerge.3.0.29\build\ILMerge.props'))" />
84-
<Error Condition="!Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props'))" />
85-
<Error Condition="!Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets'))" />
86-
</Target>
87-
<Import Project="..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets" Condition="Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets')" />
8876
</Project>

OverwolfInsiderPatcher/Program.cs

Lines changed: 131 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
using System.Security.Principal;
7-
using System.IO;
8-
using Mono.Cecil;
1+
using Mono.Cecil;
92
using Mono.Cecil.Cil;
10-
using System.Threading;
3+
using System;
114
using System.Diagnostics;
5+
using System.IO;
6+
using System.Linq;
7+
using System.Security.Principal;
128

139
namespace OverwolfInsiderPatcher
1410
{
1511
class Program
1612
{
17-
static void Main(string[] args)
13+
static void Main()
1814
{
15+
Console.Title = "Overwolf patcher by Decode 1.1";
16+
1917
string overwolfCorePath = "";
18+
string overwolfCoreCUPath = "";
2019

2120
bool isElevated;
2221
using (WindowsIdentity identity = WindowsIdentity.GetCurrent())
@@ -47,7 +46,7 @@ static void Main(string[] args)
4746

4847

4948
string winDir = Path.GetPathRoot(Environment.SystemDirectory);
50-
49+
Console.WriteLine();
5150
string[] directories = Directory.GetDirectories(winDir + "Program Files (x86)\\Overwolf");
5251
foreach (string dir in directories)
5352
{
@@ -56,52 +55,78 @@ static void Main(string[] args)
5655
overwolfCorePath = dir + "\\OverWolf.Client.Core.dll";
5756
Console.WriteLine("Overwolf.Client.Core.dll found!");
5857
}
58+
if (File.Exists(dir + "\\OverWolf.Client.CommonUtils.dll"))
59+
{
60+
overwolfCoreCUPath = dir + "\\OverWolf.Client.CommonUtils.dll";
61+
Console.WriteLine("OverWolf.Client.CommonUtils.dll found!");
62+
}
5963
}
64+
//Console.Write("Enter \"Overwolf.Client.Core.dll\" path");
65+
//if (overwolfCorePath != "")
66+
//{
67+
// Console.Write(" (press enter to use default path)");
68+
//}
69+
//Console.Write(": ");
6070

61-
Console.Write("Enter \"Overwolf.Client.Core.dll\" path");
62-
if (overwolfCorePath != "")
63-
{
64-
Console.Write(" (press enter to use default path)");
65-
}
66-
Console.Write(": ");
6771

72+
//string overwolfCoreNewPath = Console.ReadLine().ToString();
73+
//if (overwolfCoreNewPath != "" && File.Exists(overwolfCoreNewPath))
74+
//{
75+
// overwolfCorePath = overwolfCoreNewPath;
76+
//}
6877

69-
string overwolfCoreNewPath = Console.Read().ToString();
70-
if (overwolfCoreNewPath != "" && File.Exists(overwolfCoreNewPath))
71-
{
72-
overwolfCorePath = overwolfCoreNewPath;
73-
}
78+
//Console.Write("Enter \"OverWolf.Client.CommonUtils.dll\" path");
79+
//if (overwolfCorePath != "")
80+
//{
81+
// Console.Write(" (press enter to use default path)");
82+
//}
83+
//Console.Write(": ");
84+
85+
//string overwolfCoreCUNewPath = Console.ReadLine().ToString();
86+
//if (overwolfCoreCUNewPath != "" && File.Exists(overwolfCoreCUNewPath))
87+
//{
88+
// overwolfCoreCUPath = overwolfCoreCUNewPath;
89+
//}
7490

91+
//Console.WriteLine(overwolfCoreCUNewPath);
7592
if (File.Exists(overwolfCorePath))
7693
{
94+
Console.WriteLine();
95+
Console.WriteLine();
96+
Console.WriteLine("|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
97+
Console.WriteLine("|| OverWolf.Client.Core.dll ||");
7798
var resolver = new DefaultAssemblyResolver();
7899
resolver.AddSearchDirectory(Path.GetDirectoryName(overwolfCorePath));
79100
ReaderParameters reader = new ReaderParameters { AssemblyResolver = resolver, ReadWrite = true, ReadingMode = ReadingMode.Immediate, InMemory = true };
80101
AssemblyDefinition overwolfCore = AssemblyDefinition.ReadAssembly(overwolfCorePath, reader);
81102
TypeDefinition overwolfCoreWManager = overwolfCore.MainModule.GetType("OverWolf.Client.Core.Managers.WindowsInsiderSupportHelper");
82103
if (overwolfCoreWManager != null)
83104
{
84-
Console.WriteLine("-- OverWolf.Client.Core.Managers.WindowsInsiderSupportHelper type found!");
85-
MethodDefinition showInsiderBlockMessageMethod = null;
86-
try
87-
{
88-
showInsiderBlockMessageMethod = overwolfCoreWManager.Methods.Single(x => x.Name == "ShowInsiderBlockMessage");
89-
}
90-
catch (InvalidOperationException e)
91-
{
92-
Console.WriteLine("ShowInsiderBlockMessage1 not found: " + e.Message);
93-
}
94-
catch (Exception e)
95-
{
96-
Console.WriteLine("Error: " + e);
97-
}
105+
Console.WriteLine("|| OverWolf.Client.Core.Managers.WindowsInsiderSupportHelper type found! ||");
106+
MethodDefinition showInsiderBlockMessageMethod = overwolfCoreWManager.Methods.SingleOrDefault(x => x.Name == "ShowInsiderBlockMessage");
98107
if (showInsiderBlockMessageMethod != null)
99108
{
100-
Console.WriteLine("---- ShowInsiderBlockMessage method found!");
109+
Console.WriteLine("|| -- ShowInsiderBlockMessage method found! ||");
101110
showInsiderBlockMessageMethod.Body.Instructions.Clear();
102111
showInsiderBlockMessageMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ldc_I4_0));
103112
showInsiderBlockMessageMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
104-
Console.WriteLine("------ ShowInsiderBlockMessage method patched!");
113+
Console.WriteLine("|| ---- ShowInsiderBlockMessage method patched! ||");
114+
115+
TypeDefinition overwolfCoreIU = overwolfCore.MainModule.GetType("OverWolf.Client.Core.ODKv2.OverwolfInternalUtils");
116+
if (overwolfCoreIU != null)
117+
{
118+
MethodDefinition overwolfCoreGPI = overwolfCoreIU.Methods.SingleOrDefault(x => x.Name == "getProductInformation");
119+
if (overwolfCoreGPI != null)
120+
{
121+
foreach (Instruction instr in overwolfCoreGPI.Body.Instructions)
122+
{
123+
if (instr.Operand != null && instr.Operand.GetType() == typeof(string) && ((string)instr.Operand).StartsWith("Copyright Overwolf © ") && !((string)instr.Operand).EndsWith(" (Patched by Decode)"))
124+
{
125+
instr.Operand = instr.Operand.ToString() + " (Patched by Decode)";
126+
}
127+
}
128+
}
129+
}
105130

106131
try
107132
{
@@ -110,7 +135,7 @@ static void Main(string[] args)
110135
File.Delete(backupFilePath);
111136
File.Copy(overwolfCorePath, backupFilePath);
112137
overwolfCore.Write(overwolfCorePath);
113-
Console.WriteLine("-------- Patched successfully");
138+
Console.WriteLine("|| ------ Patched successfully ||");
114139
}
115140
catch (System.UnauthorizedAccessException)
116141
{
@@ -121,14 +146,81 @@ static void Main(string[] args)
121146
Console.WriteLine(e);
122147
}
123148
}
149+
else
150+
{
151+
Console.WriteLine("|| ShowInsiderBlockMessage not found! ||");
152+
}
124153

125154
}
126155
else
127156
{
128157
Console.WriteLine("OverWolf.Client.Core.Managers.WindowsInsiderSupportHelper type not found!");
129158
}
159+
Console.WriteLine("|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
130160
}
131161

162+
if (File.Exists(overwolfCoreCUPath))
163+
{
164+
Console.WriteLine();
165+
Console.WriteLine();
166+
Console.WriteLine("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
167+
Console.WriteLine("|| OverWolf.Client.CommonUtils.dll ||");
168+
var resolver = new DefaultAssemblyResolver();
169+
resolver.AddSearchDirectory(Path.GetDirectoryName(overwolfCoreCUPath));
170+
ReaderParameters reader = new ReaderParameters { AssemblyResolver = resolver, ReadWrite = true, ReadingMode = ReadingMode.Immediate, InMemory = true };
171+
AssemblyDefinition overwolfCore = AssemblyDefinition.ReadAssembly(overwolfCoreCUPath, reader);
172+
TypeDefinition overwolfCoreCUFeatures = overwolfCore.MainModule.GetType("OverWolf.Client.CommonUtils.Features.CommonFeatures");
173+
if (overwolfCoreCUFeatures != null)
174+
{
175+
Console.WriteLine("|| OverWolf.Client.CommonUtils.Features.CommonFeatures type found! ||");
176+
MethodDefinition enableDevToolsForQA = overwolfCoreCUFeatures.Methods.SingleOrDefault(x => x.Name == "EnableDevToolsForQA");
177+
if (enableDevToolsForQA != null)
178+
{
179+
Console.WriteLine("|| -- EnableDevToolsForQA method found! ||");
180+
enableDevToolsForQA.Body.Variables.Clear();
181+
enableDevToolsForQA.Body.Instructions.Clear();
182+
enableDevToolsForQA.Body.ExceptionHandlers.Clear();
183+
enableDevToolsForQA.Body.Instructions.Add(Instruction.Create(OpCodes.Ldc_I4_1));
184+
enableDevToolsForQA.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
185+
Console.WriteLine("|| ---- EnableDevToolsForQA method patched! ||");
186+
187+
try
188+
{
189+
string backupFilePath = Path.GetDirectoryName(overwolfCoreCUPath) + "\\" + Path.GetFileNameWithoutExtension(overwolfCoreCUPath) + "_bak.dll";
190+
if (File.Exists(backupFilePath))
191+
File.Delete(backupFilePath);
192+
File.Copy(overwolfCoreCUPath, backupFilePath);
193+
overwolfCore.Write(overwolfCoreCUPath);
194+
Console.WriteLine("|| ------ Patched successfully ||");
195+
}
196+
catch (System.UnauthorizedAccessException)
197+
{
198+
Console.WriteLine("Permission denied");
199+
}
200+
catch (Exception e)
201+
{
202+
Console.WriteLine(e);
203+
}
204+
}
205+
else
206+
{
207+
Console.WriteLine("EnableDevToolsForQA not found!");
208+
}
209+
210+
}
211+
else
212+
{
213+
Console.WriteLine("OverWolf.Client.CommonUtils.Features.CommonFeatures type not found!");
214+
}
215+
Console.WriteLine("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
216+
}
217+
218+
219+
Console.WriteLine();
220+
Console.WriteLine();
221+
222+
Console.WriteLine("Complete!");
223+
132224
Console.ReadKey();
133225
}
134226
}

OverwolfInsiderPatcher/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following
14.5 KB
Binary file not shown.
0 Bytes
Binary file not shown.
42 KB
Binary file not shown.
18.7 KB
Binary file not shown.
87.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)