Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
Bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cerebrate committed Oct 9, 2014
1 parent 3f94f8b commit b9fe3d2
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions x64-unfixer/Program.cs
Expand Up @@ -45,13 +45,6 @@ static void Main (string[] args)

try
{

ModuleDefinition corlib = ModuleDefinition.ReadModule (typeof (object).Module.FullyQualifiedName);
TypeDefinition intDefinition = corlib.GetType ("System.Int32");
TypeDefinition intptrDefinition = corlib.GetType ("System.IntPtr");
PropertyDefinition sizeDefinition = intptrDefinition.Properties.Single (pd => pd.Name == "Size");
MethodDefinition getDefinition = sizeDefinition.GetMethod;

// Iterate through every single type in the module.
foreach (var td in assembly.MainModule.Types)
{
Expand All @@ -74,7 +67,9 @@ static void Main (string[] args)
{
if ((fe.OpCode == OpCodes.Call) &&
(fe.Operand != null) &&
(((MethodReference) fe.Operand).Name == "get_Size"))
(((MethodReference) fe.Operand).Name == "get_Size") &&
(((MethodReference) fe.Operand).DeclaringType.FullName == "System.IntPtr")
)
{
Console.WriteLine (" System.IntPtr reference found, replacing...");

Expand Down Expand Up @@ -105,11 +100,10 @@ static void Main (string[] args)
catch (Exception ex)
{
Console.WriteLine ("Error rewriting assembly: {0}", ex.Message);
return;
}

Console.WriteLine ("Operation completed.");

Console.ReadLine ();
}
}
}

0 comments on commit b9fe3d2

Please sign in to comment.