-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
71 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,42 @@ | ||
using System; | ||
using Mono.Cecil; | ||
using System; | ||
using System.IO; | ||
|
||
namespace GuidPatch | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine("Hello World!"); | ||
if (args.Length != 2) | ||
{ | ||
Console.WriteLine($"Expected to be given two arguments. Given {args.Length}"); | ||
} | ||
else | ||
{ | ||
/* The first argument given is the .dll to patch | ||
The second argument is the folder to look for winrt.runtime in */ | ||
var resolver = new DefaultAssemblyResolver(); | ||
|
||
/* | ||
var resolver = new DefaultAssemblyResolver(); | ||
resolver.AddSearchDirectory("TestData"); | ||
resolver.AddSearchDirectory("C:/Program Files/dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0/ref/net5.0"); | ||
var guidPatcher = new GuidPatcher( | ||
"TestData/Windows.dll", | ||
resolver); | ||
int numPatches = guidPatcher.ProcessAssembly(); | ||
Directory.CreateDirectory("Output"); | ||
guidPatcher.SaveAssembly("Output"); | ||
Console.WriteLine($"{numPatches} IID calculations/fetches patched"); | ||
*/ | ||
try | ||
{ | ||
resolver.AddSearchDirectory(args[1]); | ||
AssemblyDefinition winRTRuntimeAssembly = resolver.Resolve(new AssemblyNameReference("WinRT.Runtime", default)); | ||
var guidPatcher = new GuidPatcher( | ||
args[0], | ||
resolver, | ||
winRTRuntimeAssembly); | ||
int numPatches = guidPatcher.ProcessAssembly(); | ||
Directory.CreateDirectory("GuidPatcherOutput"); | ||
guidPatcher.SaveAssembly("GuidPatcherOutput"); | ||
Console.WriteLine($"{numPatches} IID calculations/fetches patched"); | ||
} | ||
catch (AssemblyResolutionException) | ||
{ | ||
Console.WriteLine("Failed to resolve WinRT.Runtime, shutting down."); | ||
return; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters