Skip to content

Commit 88b94fd

Browse files
committed
1.41
+ Changed NET version to .NET Framework 4.8 (compatability error, look "C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.11") + Fixed errors in Utils class where log error prevents patcher + Increased and extended subscriptions + Minor (manifest, killing overwolf)
1 parent dde20cc commit 88b94fd

14 files changed

+244
-24
lines changed

OverwolfPatcher/Classes/Overwolf.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class Overwolf
1515

1616
public DirectoryInfo ExtensionsFolder => DataFolder.Combine("Extensions");
1717
public List<DirectoryInfo> ProgramVersionFolders => ProgramFolder.GetDirectories(searchPattern: "*.*.*.*").ToList(); // C:\Program Files (x86)\Overwolf\0.258.1.7\
18+
// public DirectoryInfo WindowsDesktopApp => new DirectoryInfo(@"C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.11");
1819
public List<Process> Processes => Process.GetProcessesByName(ProcessName).ToList();
1920
}
2021
}

OverwolfPatcher/OverwolfPatcher.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net8.0-windows10.0.26100.0</TargetFramework>
3+
<TargetFramework>net48</TargetFramework>
4+
<LangVersion>10.0</LangVersion>
45
<OutputType>Exe</OutputType>
56
<RootNamespace>OverwolfPatcher</RootNamespace>
67
<AssemblyName>OverwolfPatcher</AssemblyName>
@@ -27,7 +28,7 @@
2728
<ApplicationIcon>icon.ico</ApplicationIcon>
2829
<GenerateDocumentationFile>False</GenerateDocumentationFile>
2930
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
30-
<PublishTrimmed>True</PublishTrimmed>
31+
<PublishTrimmed>False</PublishTrimmed>
3132
<Title>Overwolf Patcher</Title>
3233
<Authors>Decode, Bluscream</Authors>
3334
<Description>Patcher for Overwolf</Description>
@@ -40,7 +41,7 @@
4041
<NeutralLanguage>en-US</NeutralLanguage>
4142
<IncludeSymbols>True</IncludeSymbols>
4243
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
43-
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
44+
<ApplicationManifest>app.manifest</ApplicationManifest>
4445
</PropertyGroup>
4546
<ItemGroup>
4647
<BootstrapperPackage Include=".NETFramework,Version=v4.8">

OverwolfPatcher/Patches/ClientBL.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public bool TryPatch(Overwolf ow, out Exception error)
2828
}
2929
this.PrintHeader();
3030
var resolver = new DefaultAssemblyResolver();
31+
// resolver.AddSearchDirectory(ow.WindowsDesktopApp.FullName);
3132
resolver.AddSearchDirectory(versionFolder.FullName);
3233
var reader = new ReaderParameters { AssemblyResolver = resolver, ReadWrite = true, ReadingMode = ReadingMode.Immediate, InMemory = true };
3334

@@ -69,7 +70,7 @@ public bool TryPatch(Overwolf ow, out Exception error)
6970
Console.WriteLine(e);
7071
}
7172
resolver.Dispose();
72-
Console.WriteLine("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
73+
Console.WriteLine(Utils.Fill('|'));
7374
} catch (Exception ex)
7475
{
7576
error = ex;

OverwolfPatcher/Patches/ClientCommonUtils.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public bool TryPatch(Overwolf ow, out Exception error)
2828
}
2929
this.PrintHeader();
3030
var resolver = new DefaultAssemblyResolver();
31+
// resolver.AddSearchDirectory(ow.WindowsDesktopApp.FullName);
3132
resolver.AddSearchDirectory(versionFolder.FullName);
3233
var reader = new ReaderParameters { AssemblyResolver = resolver, ReadWrite = true, ReadingMode = ReadingMode.Immediate, InMemory = true };
3334

@@ -40,13 +41,15 @@ public bool TryPatch(Overwolf ow, out Exception error)
4041
if (enableDevToolsForQA != null)
4142
{
4243
enableDevToolsForQA.PatchReturnBool(true);
43-
} else
44+
}
45+
else
4446
{
4547
Console.WriteLine(Utils.Pad("EnableDevToolsForQA not found!"));
4648
Console.WriteLine("");
4749
}
4850

49-
} else
51+
}
52+
else
5053
{
5154
Console.WriteLine(Utils.Pad("OverWolf.Client.CommonUtils.Features.CommonFeatures type not found!"));
5255
}
@@ -56,14 +59,17 @@ public bool TryPatch(Overwolf ow, out Exception error)
5659
fullPath.Backup(true);
5760
overwolfCore.Write(fullPath.FullName);
5861
Console.WriteLine(Utils.Pad("Patched successfully"));
59-
} catch (UnauthorizedAccessException) { Console.WriteLine($"Permission denied for file {fileString}"); } catch (Exception e)
62+
}
63+
catch (UnauthorizedAccessException) { Console.WriteLine($"Permission denied for file {fileString}"); }
64+
catch (Exception e)
6065
{
6166
fullPath.Restore();
6267
Console.WriteLine(e);
6368
}
6469
resolver.Dispose();
65-
Console.WriteLine("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
66-
} catch (Exception ex)
70+
Console.WriteLine(Utils.Fill('|'));
71+
}
72+
catch (Exception ex)
6773
{
6874
error = ex;
6975
return false;

OverwolfPatcher/Patches/ClientCore.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public bool TryPatch(Overwolf ow, out Exception error)
3131
}
3232
this.PrintHeader();
3333
var resolver = new DefaultAssemblyResolver();
34+
// resolver.AddSearchDirectory(ow.WindowsDesktopApp.FullName);
3435
resolver.AddSearchDirectory(versionFolder.FullName);
3536
var reader = new ReaderParameters { AssemblyResolver = resolver, ReadWrite = true, ReadingMode = ReadingMode.Immediate, InMemory = true };
3637

@@ -119,7 +120,7 @@ public bool TryPatch(Overwolf ow, out Exception error)
119120
Console.WriteLine(e);
120121
}
121122
resolver.Dispose();
122-
Console.WriteLine("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
123+
Console.WriteLine(Utils.Fill('|'));
123124
} catch (Exception ex)
124125
{
125126
error = ex;

OverwolfPatcher/Patches/Extensions.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public bool TryPatch(Overwolf ow, out Exception error)
2828
}
2929
this.PrintHeader();
3030
var resolver = new DefaultAssemblyResolver();
31+
// resolver.AddSearchDirectory(ow.WindowsDesktopApp.FullName);
3132
resolver.AddSearchDirectory(versionFolder.FullName);
3233
var reader = new ReaderParameters { AssemblyResolver = resolver, ReadWrite = true, ReadingMode = ReadingMode.Immediate, InMemory = true };
3334

@@ -45,7 +46,8 @@ public bool TryPatch(Overwolf ow, out Exception error)
4546
{
4647
VerifyFileSync.PatchReturnBool(false);
4748
}
48-
} else
49+
}
50+
else
4951
{
5052
Console.WriteLine(Utils.Pad("OverWolf.Extensions.Validation type not found!"));
5153
}
@@ -55,18 +57,25 @@ public bool TryPatch(Overwolf ow, out Exception error)
5557
fullPath.Backup(true);
5658
overwolfExtensions.Write(fullPath.FullName);
5759
Console.WriteLine(Utils.Pad("Patched successfully"));
58-
} catch (UnauthorizedAccessException) { Console.WriteLine($"Permission denied for file {fileString}"); } catch (Exception e)
60+
}
61+
catch (UnauthorizedAccessException) { Console.WriteLine($"Permission denied for file {fileString}"); }
62+
catch (Exception e)
5963
{
6064
fullPath.Restore();
6165
Console.WriteLine(e);
6266
}
6367
resolver.Dispose();
64-
Console.WriteLine("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
65-
} catch (Exception ex)
68+
69+
}
70+
catch (Exception ex)
6671
{
6772
error = ex;
6873
return false;
6974
}
75+
finally
76+
{
77+
Console.WriteLine(Utils.Fill('|'));
78+
}
7079
}
7180
return true;
7281
}

OverwolfPatcher/Patches/Subscriptions.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public bool TryPatch(Overwolf ow, out Exception error)
3131
}
3232
this.PrintHeader();
3333
var resolver = new DefaultAssemblyResolver();
34+
// resolver.AddSearchDirectory(ow.WindowsDesktopApp.FullName);
3435
resolver.AddSearchDirectory(versionFolder.FullName);
3536
var reader = new ReaderParameters { AssemblyResolver = resolver, ReadWrite = true, ReadingMode = ReadingMode.Immediate, InMemory = true };
3637

@@ -71,7 +72,8 @@ public bool TryPatch(Overwolf ow, out Exception error)
7172
try
7273
{
7374
overwolfCoreGES = OverwolfSubscriptionsGetExtensionSubscriptions(ref overwolfSubscriptions, overwolfCoreGES);
74-
} catch (Exception e)
75+
}
76+
catch (Exception e)
7577
{
7678
Console.WriteLine("Error, Overwolf.Subscriptions will not be patched: ");
7779
Console.WriteLine(e);
@@ -85,14 +87,17 @@ public bool TryPatch(Overwolf ow, out Exception error)
8587
fullPath.Backup(true);
8688
overwolfSubscriptions.Write(fullPath.FullName);
8789
Console.WriteLine(Utils.Pad("Patched successfully"));
88-
} catch (UnauthorizedAccessException) { Console.WriteLine($"Permission denied for file {fileString}"); } catch (Exception e)
90+
}
91+
catch (UnauthorizedAccessException) { Console.WriteLine($"Permission denied for file {fileString}"); }
92+
catch (Exception e)
8993
{
9094
fullPath.Restore();
9195
Console.WriteLine(e);
9296
}
9397
resolver.Dispose();
94-
Console.WriteLine("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
95-
} catch (Exception ex)
98+
Console.WriteLine(Utils.Fill('|'));
99+
}
100+
catch (Exception ex)
96101
{
97102
error = ex;
98103
return false;
@@ -164,7 +169,7 @@ public static MethodDefinition OverwolfSubscriptionsGetExtensionSubscriptions(re
164169
overwolfCoreGES.Body.Instructions[25] = Instruction.Create(OpCodes.Ldloc_0);
165170
overwolfCoreGES.Body.Instructions[26] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription").Methods.First(x => x.Name == "set_PlanId"));
166171
overwolfCoreGES.Body.Instructions[27] = Instruction.Create(OpCodes.Ldloc_1);
167-
overwolfCoreGES.Body.Instructions[28] = Instruction.Create(OpCodes.Ldc_I8, 1735682400000);
172+
overwolfCoreGES.Body.Instructions[28] = Instruction.Create(OpCodes.Ldc_I8, 1893530343000);
168173
overwolfCoreGES.Body.Instructions[29] = Instruction.Create(OpCodes.Callvirt, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription").Methods.First(x => x.Name == "set_Expiry"));
169174
overwolfCoreGES.Body.Instructions[30] = Instruction.Create(OpCodes.Ldloc_1);
170175
overwolfCoreGES.Body.Instructions[31] = Instruction.Create(OpCodes.Newobj, overwolfSubscriptions.MainModule.GetType("Overwolf.Subscriptions.Model.Subscription/Info").Methods.First(x => x.Name == ".ctor"));
@@ -207,7 +212,7 @@ public static MethodDefinition OverwolfSubscriptionsGetExtensionSubscriptions(re
207212
overwolfCoreGES.Body.Instructions[66] = Instruction.Create(OpCodes.Add);
208213
overwolfCoreGES.Body.Instructions[67] = Instruction.Create(OpCodes.Stloc_0);
209214
overwolfCoreGES.Body.Instructions[68] = Instruction.Create(OpCodes.Ldloc_0);
210-
overwolfCoreGES.Body.Instructions[69] = Instruction.Create(OpCodes.Ldc_I4, 9999);
215+
overwolfCoreGES.Body.Instructions[69] = Instruction.Create(OpCodes.Ldc_I4, 99999);
211216
overwolfCoreGES.Body.Instructions[70] = Instruction.Create(OpCodes.Blt, overwolfCoreGES.Body.Instructions[19]);
212217

213218
overwolfCoreGES.Body.Instructions[71] = Instruction.Create(OpCodes.Ldc_I4_1);

OverwolfPatcher/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static void Main(string[] args)
3232
{
3333
Console.WriteLine("Overwolf app is running, do you want to close it now? (y/n)");
3434
var key = Console.ReadKey();
35-
if (key.Key == ConsoleKey.Y) ow.Processes.ForEach(p => p.Kill());
35+
if (key.Key == ConsoleKey.Y) ow.Processes.ForEach(p => { p.Kill(); p.WaitForExit(); });
3636
else
3737
{
3838
Console.WriteLine("Cannot continue, press any key to exit");

OverwolfPatcher/Utils/Utils.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,33 @@
44
using System.Linq;
55
using System.Reflection;
66
using System.Security.Principal;
7+
using System.Threading;
78

89
namespace Bluscream;
910

1011
internal static class Utils
1112
{
12-
internal static List<int> GetPadding(string input, int minWidth = 80, int padding = 10)
13+
const int defaultMinWidth = 80;
14+
const int defaultPadding = 10;
15+
16+
internal static List<int> GetPadding(string input, int minWidth = defaultMinWidth, int padding = defaultPadding)
1317
{
1418
int totalWidth = minWidth + padding * 2;
1519
int leftPadding = (totalWidth - input.Length) / 2;
1620
int rightPadding = totalWidth - input.Length - leftPadding;
1721
return new List<int> { leftPadding, rightPadding, totalWidth };
1822
}
19-
internal static string Pad(string input, string outer = "||", int minWidth = 80, int padding = 10)
23+
internal static string Pad(string input, string outer = "||", int minWidth = defaultMinWidth, int padding = defaultPadding)
2024
{
2125
var padded = GetPadding(input, minWidth, padding);
22-
return $"{outer}{new string(' ', padded[index: 0])}{input}{new string(' ', padded[1])}{outer}";
26+
return $"{outer}{new string(' ', Math.Max(padded[index: 0], 0))}{input}{new string(' ', Math.Max(padded[1], 0))}{outer}";
2327
}
28+
29+
internal static string Fill(char c, int width = defaultMinWidth, int padding = defaultPadding)
30+
{
31+
return new string(c, width + padding * 2 + 4);
32+
}
33+
2434
internal static string Log(string text, int length = 73)
2535
{
2636
text = "|| " + text;

OverwolfPatcher/app.manifest

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
3+
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
4+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
5+
<security>
6+
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
7+
<!-- UAC Manifest Options
8+
If you want to change the Windows User Account Control level replace the
9+
requestedExecutionLevel node with one of the following.
10+
11+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
12+
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
13+
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
14+
15+
Specifying requestedExecutionLevel element will disable file and registry virtualization.
16+
Remove this element if your application requires this virtualization for backwards
17+
compatibility.
18+
-->
19+
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
20+
</requestedPrivileges>
21+
</security>
22+
</trustInfo>
23+
24+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
25+
<application>
26+
<!-- A list of the Windows versions that this application has been tested on
27+
and is designed to work with. Uncomment the appropriate elements
28+
and Windows will automatically select the most compatible environment. -->
29+
30+
<!-- Windows Vista -->
31+
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
32+
33+
<!-- Windows 7 -->
34+
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
35+
36+
<!-- Windows 8 -->
37+
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
38+
39+
<!-- Windows 8.1 -->
40+
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
41+
42+
<!-- Windows 10 -->
43+
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
44+
45+
</application>
46+
</compatibility>
47+
48+
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
49+
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
50+
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
51+
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
52+
53+
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
54+
<!--
55+
<application xmlns="urn:schemas-microsoft-com:asm.v3">
56+
<windowsSettings>
57+
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
58+
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
59+
</windowsSettings>
60+
</application>
61+
-->
62+
63+
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
64+
<!--
65+
<dependency>
66+
<dependentAssembly>
67+
<assemblyIdentity
68+
type="win32"
69+
name="Microsoft.Windows.Common-Controls"
70+
version="6.0.0.0"
71+
processorArchitecture="*"
72+
publicKeyToken="6595b64144ccf1df"
73+
language="*"
74+
/>
75+
</dependentAssembly>
76+
</dependency>
77+
-->
78+
79+
</assembly>
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>

0 commit comments

Comments
 (0)