Skip to content

Commit 89d0b2b

Browse files
committed
Initial commit
0 parents  commit 89d0b2b

74 files changed

Lines changed: 1021 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
59 KB
Binary file not shown.

OverwolfInsiderPatcher.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31424.327
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OverwolfInsiderPatcher", "OverwolfInsiderPatcher\OverwolfInsiderPatcher.csproj", "{53370A50-3DC8-45C9-A300-D396D8731DE8}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{53370A50-3DC8-45C9-A300-D396D8731DE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{53370A50-3DC8-45C9-A300-D396D8731DE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{53370A50-3DC8-45C9-A300-D396D8731DE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{53370A50-3DC8-45C9-A300-D396D8731DE8}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {B7A842E7-2A42-46E5-940E-ADE7B1B6A3E0}
24+
EndGlobalSection
25+
EndGlobal

OverwolfInsiderPatcher/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
5+
</startup>
6+
</configuration>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<!-- -->
5+
<!-- ILMerge project-specific settings. Almost never need to be set explicitly. -->
6+
<!-- for details, see http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx -->
7+
<!-- -->
8+
<!-- *** set this file to Type=None, CopyToOutput=Never *** -->
9+
10+
<!-- If True, all copy local dependencies will also be merged from referenced projects whether they are referenced in the current project explicitly or not -->
11+
<ILMergeTransitive>true</ILMergeTransitive>
12+
13+
<!-- Extra ILMerge library paths (semicolon-separated). Dont put your package dependencies here, they will be added automagically -->
14+
<ILMergeLibraryPath></ILMergeLibraryPath>
15+
16+
<!-- The solution NuGet package directory if not standard 'SOLUTION\packages' -->
17+
<ILMergePackagesPath></ILMergePackagesPath>
18+
19+
<!-- The merge order file name if differs from standard 'ILMergeOrder.txt' -->
20+
<ILMergeOrderFile></ILMergeOrderFile>
21+
22+
<!-- The strong key file name if not specified in the project -->
23+
<ILMergeKeyFile></ILMergeKeyFile>
24+
25+
<!-- The assembly version if differs for the version of the main assembly -->
26+
<ILMergeAssemblyVersion></ILMergeAssemblyVersion>
27+
28+
<!-- added in Version 1.0.4 -->
29+
<ILMergeFileAlignment></ILMergeFileAlignment>
30+
31+
<!-- added in Version 1.0.4, default=none -->
32+
<ILMergeAllowDuplicateType></ILMergeAllowDuplicateType>
33+
34+
<!-- If the <see cref="CopyAttributes"/> is also set, any assembly-level attributes names that have the same type are copied over into the target assembly -->
35+
<ILMergeAllowMultipleAssemblyLevelAttributes></ILMergeAllowMultipleAssemblyLevelAttributes>
36+
37+
<!-- See ILMerge documentation -->
38+
<ILMergeAllowZeroPeKind></ILMergeAllowZeroPeKind>
39+
40+
<!-- The assembly level attributes of each input assembly are copied over into the target assembly -->
41+
<ILMergeCopyAttributes></ILMergeCopyAttributes>
42+
43+
<!-- Creates a .pdb file for the output assembly and merges into it any .pdb files found for input assemblies, default=true -->
44+
<ILMergeDebugInfo>false</ILMergeDebugInfo>
45+
46+
<!-- Target assembly will be delay signed -->
47+
<ILMergeDelaySign></ILMergeDelaySign>
48+
49+
<!-- Types in assemblies other than the primary assembly have their visibility modified -->
50+
<ILMergeInternalize></ILMergeInternalize>
51+
52+
<!-- The path name of the file that will be used to identify types that are not to have their visibility modified -->
53+
<ILMergeInternalizeExcludeFile></ILMergeInternalizeExcludeFile>
54+
55+
<!-- XML documentation files are merged to produce an XML documentation file for the target assembly -->
56+
<ILMergeXmlDocumentation></ILMergeXmlDocumentation>
57+
58+
<!-- External assembly references in the manifest of the target assembly will use full public keys (false) or public key tokens (true, default value) -->
59+
<ILMergePublicKeyTokens></ILMergePublicKeyTokens>
60+
61+
<!-- Types with the same name are all merged into a single type in the target assembly -->
62+
<ILMergeUnionMerge></ILMergeUnionMerge>
63+
64+
<!-- The version of the target framework, default 40 (works for 45 too) -->
65+
<ILTargetPlatform></ILTargetPlatform>
66+
</PropertyGroup>
67+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# this file contains the partial list of the merged assemblies in the merge order
2+
# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build
3+
# and finetune merge order to your satisfaction
4+
10.6 KB
Binary file not shown.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<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')" />
5+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
6+
<PropertyGroup>
7+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9+
<ProjectGuid>{53370A50-3DC8-45C9-A300-D396D8731DE8}</ProjectGuid>
10+
<OutputType>Exe</OutputType>
11+
<RootNamespace>OverwolfInsiderPatcher</RootNamespace>
12+
<AssemblyName>OverwolfInsiderPatcher</AssemblyName>
13+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
16+
<Deterministic>true</Deterministic>
17+
<TargetFrameworkProfile />
18+
<NuGetPackageImportStamp>
19+
</NuGetPackageImportStamp>
20+
</PropertyGroup>
21+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
22+
<PlatformTarget>AnyCPU</PlatformTarget>
23+
<DebugSymbols>true</DebugSymbols>
24+
<DebugType>full</DebugType>
25+
<Optimize>false</Optimize>
26+
<OutputPath>bin\Debug\</OutputPath>
27+
<DefineConstants>DEBUG;TRACE</DefineConstants>
28+
<ErrorReport>prompt</ErrorReport>
29+
<WarningLevel>4</WarningLevel>
30+
</PropertyGroup>
31+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
32+
<PlatformTarget>AnyCPU</PlatformTarget>
33+
<DebugType>pdbonly</DebugType>
34+
<Optimize>true</Optimize>
35+
<OutputPath>bin\Release\</OutputPath>
36+
<DefineConstants>TRACE</DefineConstants>
37+
<ErrorReport>prompt</ErrorReport>
38+
<WarningLevel>4</WarningLevel>
39+
</PropertyGroup>
40+
<PropertyGroup>
41+
<ApplicationIcon>IconFileOverwolf_32Bit_16_32_48_256.ico</ApplicationIcon>
42+
</PropertyGroup>
43+
<ItemGroup>
44+
<Reference Include="Mono.Cecil, Version=0.11.4.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
45+
<HintPath>..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.dll</HintPath>
46+
</Reference>
47+
<Reference Include="Mono.Cecil.Mdb, Version=0.11.4.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
48+
<HintPath>..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
49+
</Reference>
50+
<Reference Include="Mono.Cecil.Pdb, Version=0.11.4.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
51+
<HintPath>..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
52+
</Reference>
53+
<Reference Include="Mono.Cecil.Rocks, Version=0.11.4.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
54+
<HintPath>..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
55+
</Reference>
56+
<Reference Include="System" />
57+
<Reference Include="System.Core" />
58+
<Reference Include="System.Xml.Linq" />
59+
<Reference Include="System.Data.DataSetExtensions" />
60+
<Reference Include="Microsoft.CSharp" />
61+
<Reference Include="System.Data" />
62+
<Reference Include="System.Net.Http" />
63+
<Reference Include="System.Xml" />
64+
</ItemGroup>
65+
<ItemGroup>
66+
<Compile Include="Program.cs" />
67+
<Compile Include="Properties\AssemblyInfo.cs" />
68+
</ItemGroup>
69+
<ItemGroup>
70+
<None Include="App.config" />
71+
<None Include="ILMerge.props" />
72+
<None Include="packages.config" />
73+
</ItemGroup>
74+
<ItemGroup>
75+
<Content Include="IconFileOverwolf_32Bit_16_32_48_256.ico" />
76+
<Content Include="ILMergeOrder.txt" />
77+
</ItemGroup>
78+
<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')" />
88+
</Project>

OverwolfInsiderPatcher/Program.cs

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
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;
9+
using Mono.Cecil.Cil;
10+
using System.Threading;
11+
using System.Diagnostics;
12+
13+
namespace OverwolfInsiderPatcher
14+
{
15+
class Program
16+
{
17+
static void Main(string[] args)
18+
{
19+
string overwolfCorePath = "";
20+
21+
bool isElevated;
22+
using (WindowsIdentity identity = WindowsIdentity.GetCurrent())
23+
{
24+
WindowsPrincipal principal = new WindowsPrincipal(identity);
25+
isElevated = principal.IsInRole(WindowsBuiltInRole.Administrator);
26+
}
27+
28+
if (isElevated)
29+
{
30+
Console.WriteLine("Role: Administrator");
31+
}
32+
else
33+
{
34+
Console.WriteLine("Role: User");
35+
Console.WriteLine("Please, run as administrator");
36+
Console.ReadKey();
37+
Environment.Exit(0);
38+
}
39+
40+
Process[] processes = Process.GetProcessesByName("overwolf");
41+
if (processes.Length > 0)
42+
{
43+
Console.WriteLine("Overwolf app is running, please close Overwolf before start this app");
44+
Console.ReadKey();
45+
Environment.Exit(0);
46+
}
47+
48+
49+
string winDir = Path.GetPathRoot(Environment.SystemDirectory);
50+
51+
string[] directories = Directory.GetDirectories(winDir + "Program Files (x86)\\Overwolf");
52+
foreach (string dir in directories)
53+
{
54+
if (File.Exists(dir + "\\OverWolf.Client.Core.dll"))
55+
{
56+
overwolfCorePath = dir + "\\OverWolf.Client.Core.dll";
57+
Console.WriteLine("Overwolf.Client.Core.dll found!");
58+
}
59+
}
60+
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(": ");
67+
68+
69+
string overwolfCoreNewPath = Console.Read().ToString();
70+
if (overwolfCoreNewPath != "" && File.Exists(overwolfCoreNewPath))
71+
{
72+
overwolfCorePath = overwolfCoreNewPath;
73+
}
74+
75+
if (File.Exists(overwolfCorePath))
76+
{
77+
var resolver = new DefaultAssemblyResolver();
78+
resolver.AddSearchDirectory(Path.GetDirectoryName(overwolfCorePath));
79+
ReaderParameters reader = new ReaderParameters { AssemblyResolver = resolver, ReadWrite = true, ReadingMode = ReadingMode.Immediate, InMemory = true };
80+
AssemblyDefinition overwolfCore = AssemblyDefinition.ReadAssembly(overwolfCorePath, reader);
81+
TypeDefinition overwolfCoreWManager = overwolfCore.MainModule.GetType("OverWolf.Client.Core.Managers.WindowsInsiderSupportHelper");
82+
if (overwolfCoreWManager != null)
83+
{
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+
}
98+
if (showInsiderBlockMessageMethod != null)
99+
{
100+
Console.WriteLine("---- ShowInsiderBlockMessage method found!");
101+
showInsiderBlockMessageMethod.Body.Instructions.Clear();
102+
showInsiderBlockMessageMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ldc_I4_0));
103+
showInsiderBlockMessageMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
104+
Console.WriteLine("------ ShowInsiderBlockMessage method patched!");
105+
106+
try
107+
{
108+
string backupFilePath = Path.GetDirectoryName(overwolfCorePath) + "\\" + Path.GetFileNameWithoutExtension(overwolfCorePath) + "_bak.dll";
109+
if (File.Exists(backupFilePath))
110+
File.Delete(backupFilePath);
111+
File.Copy(overwolfCorePath, backupFilePath);
112+
overwolfCore.Write(overwolfCorePath);
113+
Console.WriteLine("-------- Patched successfully");
114+
}
115+
catch (System.UnauthorizedAccessException)
116+
{
117+
Console.WriteLine("Permission denied");
118+
}
119+
catch (Exception e)
120+
{
121+
Console.WriteLine(e);
122+
}
123+
}
124+
125+
}
126+
else
127+
{
128+
Console.WriteLine("OverWolf.Client.Core.Managers.WindowsInsiderSupportHelper type not found!");
129+
}
130+
}
131+
132+
Console.ReadKey();
133+
}
134+
}
135+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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("OverwolfInsiderPatcher")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("OverwolfInsiderPatcher")]
13+
[assembly: AssemblyCopyright("Copyright © 2021")]
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("53370a50-3dc8-45c9-a300-d396d8731de8")]
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")]

0 commit comments

Comments
 (0)