Skip to content

Commit

Permalink
Slightly tweaked codegen location detection (mscorlib method) to work…
Browse files Browse the repository at this point in the history
… with TLD.
  • Loading branch information
Sam Byass committed Jan 22, 2021
1 parent 75f9cd4 commit c097e6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions LibCpp2IL/PE/PE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,7 @@ public bool PlusSearch(int methodCount, int typeDefinitionsCount)
plusSearch.SetSearch(imageBase, dataSections);
plusSearch.SetDataSections(imageBase, dataSections);
plusSearch.SetExecSections(imageBase, execSections);
if (LibCpp2IlMain.MetadataVersion >= 24.2f)
codeRegistration = plusSearch.FindCodeRegistrationUsingMscorlib();
else
codeRegistration = is32Bit ? plusSearch.FindCodeRegistration() : plusSearch.FindCodeRegistration64Bit();

if (is32Bit)
{
Console.WriteLine("\t(32-bit PE)");
Expand All @@ -356,6 +353,11 @@ public bool PlusSearch(int methodCount, int typeDefinitionsCount)
plusSearch.SetExecSections(imageBase, dataSections);
metadataRegistration = plusSearch.FindMetadataRegistration64Bit();
}

if (LibCpp2IlMain.MetadataVersion >= 24.2f)
codeRegistration = plusSearch.FindCodeRegistrationUsingMscorlib();
else
codeRegistration = is32Bit ? plusSearch.FindCodeRegistration() : plusSearch.FindCodeRegistration64Bit();

#if ALLOW_CODEREG_FALLBACK
if (codeRegistration == 0 || metadataRegistration == 0)
Expand Down
2 changes: 1 addition & 1 deletion LibCpp2IL/PlusSearch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ internal ulong FindCodeRegistrationUsingMscorlib()
&& i.OpCount == 2
&& i.Op0Kind == OpKind.Register
&& i.Op1Kind == OpKind.Memory
&& i.Op0Register == Register.RCX).ToList();
/*&& i.Op0Register == Register.RCX*/).ToList();

var sanity = 0;
while (sanity++ < 500)
Expand Down

0 comments on commit c097e6f

Please sign in to comment.