Skip to content

Commit

Permalink
Fixed rewriter for TypeScramber
Browse files Browse the repository at this point in the history
The problem was that the type scrambler injected a reference of the ConfuserEx runtime framework into the target assembly instead of using the framework of the assembly.
  • Loading branch information
mkaring committed Dec 20, 2021
1 parent a12be9e commit a642360
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ internal override void ProcessOperand(TypeService service, MethodDef method, ILi

ModuleDef mod = method.Module;

var gettype = typeof(Type).GetMethod("GetTypeFromHandle");
var createInstance = typeof(Activator).GetMethod("CreateInstance", new Type[] { typeof(Type) });
var corlibType = mod.CorLibTypes.GetTypeRef("System", "Type").ResolveThrow();
var gettype = corlibType.FindMethod("GetTypeFromHandle");
var createInstance = mod.CorLibTypes.GetTypeRef("System", "Activator").ResolveThrow()
.FindMethod("CreateInstance", MethodSig.CreateStatic(mod.CorLibTypes.Object, corlibType.ToTypeSig()));

TypeSig sig = null;

Expand Down

0 comments on commit a642360

Please # to comment.