diff --git a/Confuser.Core/ConfuserEngine.cs b/Confuser.Core/ConfuserEngine.cs index a95bdb867..33ecaa6d8 100644 --- a/Confuser.Core/ConfuserEngine.cs +++ b/Confuser.Core/ConfuserEngine.cs @@ -202,6 +202,7 @@ private static void RunPipeline(ProtectionPipeline pipeline, ConfuserContext con context.CurrentModuleWriterListener = null; pipeline.ExecuteStage(PipelineStage.BeginModule, BeginModule, () => getModuleDefs(context.CurrentModule), context); + pipeline.ExecuteStage(PipelineStage.ProcessModule, ProcessModule, () => getModuleDefs(context.CurrentModule), context); pipeline.ExecuteStage(PipelineStage.OptimizeMethods, OptimizeMethods, () => getModuleDefs(context.CurrentModule), context); pipeline.ExecuteStage(PipelineStage.EndModule, EndModule, () => getModuleDefs(context.CurrentModule), context); @@ -318,6 +319,9 @@ private static void BeginModule(ConfuserContext context) { } } + private static void ProcessModule(ConfuserContext context) { + } + private static void OptimizeMethods(ConfuserContext context) { foreach (TypeDef type in context.CurrentModule.GetTypes()) foreach (MethodDef method in type.Methods) { diff --git a/Confuser.Core/ProtectionPipeline.cs b/Confuser.Core/ProtectionPipeline.cs index f4933f655..ff14e0ef2 100644 --- a/Confuser.Core/ProtectionPipeline.cs +++ b/Confuser.Core/ProtectionPipeline.cs @@ -21,6 +21,12 @@ public enum PipelineStage { /// BeginModule, + /// + /// Confuser engine processes a module. + /// This stage occurs once per module. + /// + ProcessModule, + /// /// Confuser engine optimizes opcodes of the method bodys. /// This stage occurs once per module. diff --git a/Confuser.Protections/AntiDebugProtection.cs b/Confuser.Protections/AntiDebugProtection.cs index 41cc3d724..24517bc19 100644 --- a/Confuser.Protections/AntiDebugProtection.cs +++ b/Confuser.Protections/AntiDebugProtection.cs @@ -39,7 +39,7 @@ protected override void Initialize(ConfuserContext context) { } protected override void PopulatePipeline(ProtectionPipeline pipeline) { - pipeline.InsertPostStage(PipelineStage.BeginModule, new AntiDebugPhase(this)); + pipeline.InsertPreStage(PipelineStage.ProcessModule, new AntiDebugPhase(this)); } private class AntiDebugPhase : ProtectionPhase { diff --git a/Confuser.Protections/AntiDumpProtection.cs b/Confuser.Protections/AntiDumpProtection.cs index fc3f065d5..a5980f377 100644 --- a/Confuser.Protections/AntiDumpProtection.cs +++ b/Confuser.Protections/AntiDumpProtection.cs @@ -39,7 +39,7 @@ protected override void Initialize(ConfuserContext context) { } protected override void PopulatePipeline(ProtectionPipeline pipeline) { - pipeline.InsertPostStage(PipelineStage.BeginModule, new AntiDumpPhase(this)); + pipeline.InsertPreStage(PipelineStage.ProcessModule, new AntiDumpPhase(this)); } private class AntiDumpPhase : ProtectionPhase { diff --git a/Confuser.Protections/AntiILDasmProtection.cs b/Confuser.Protections/AntiILDasmProtection.cs index bc6ff6125..be4526291 100644 --- a/Confuser.Protections/AntiILDasmProtection.cs +++ b/Confuser.Protections/AntiILDasmProtection.cs @@ -33,7 +33,7 @@ protected override void Initialize(ConfuserContext context) { } protected override void PopulatePipeline(ProtectionPipeline pipeline) { - pipeline.InsertPostStage(PipelineStage.BeginModule, new AntiILDasmPhase(this)); + pipeline.InsertPreStage(PipelineStage.ProcessModule, new AntiILDasmPhase(this)); } private class AntiILDasmPhase : ProtectionPhase { diff --git a/Confuser.Protections/Constants/ConstantProtection.cs b/Confuser.Protections/Constants/ConstantProtection.cs index 7a1fb5c1a..94086da31 100644 --- a/Confuser.Protections/Constants/ConstantProtection.cs +++ b/Confuser.Protections/Constants/ConstantProtection.cs @@ -44,8 +44,8 @@ protected override void Initialize(ConfuserContext context) { } protected override void PopulatePipeline(ProtectionPipeline pipeline) { - pipeline.InsertPostStage(PipelineStage.BeginModule, new InjectPhase(this)); - pipeline.InsertPreStage(PipelineStage.OptimizeMethods, new EncodePhase(this)); + pipeline.InsertPreStage(PipelineStage.ProcessModule, new InjectPhase(this)); + pipeline.InsertPostStage(PipelineStage.ProcessModule, new EncodePhase(this)); } } } \ No newline at end of file diff --git a/Confuser.Protections/ReferenceProxy/ReferenceProxyProtection.cs b/Confuser.Protections/ReferenceProxy/ReferenceProxyProtection.cs index 3a411ff66..9d7755d49 100644 --- a/Confuser.Protections/ReferenceProxy/ReferenceProxyProtection.cs +++ b/Confuser.Protections/ReferenceProxy/ReferenceProxyProtection.cs @@ -44,7 +44,7 @@ protected override void Initialize(ConfuserContext context) { } protected override void PopulatePipeline(ProtectionPipeline pipeline) { - pipeline.InsertPostStage(PipelineStage.BeginModule, new ReferenceProxyPhase(this)); + pipeline.InsertPreStage(PipelineStage.ProcessModule, new ReferenceProxyPhase(this)); } } } \ No newline at end of file diff --git a/Confuser.Protections/Resources/ResourceProtection.cs b/Confuser.Protections/Resources/ResourceProtection.cs index d9f4df57a..721b7a9d2 100644 --- a/Confuser.Protections/Resources/ResourceProtection.cs +++ b/Confuser.Protections/Resources/ResourceProtection.cs @@ -34,7 +34,7 @@ protected override void Initialize(ConfuserContext context) { } protected override void PopulatePipeline(ProtectionPipeline pipeline) { - pipeline.InsertPostStage(PipelineStage.BeginModule, new InjectPhase(this)); + pipeline.InsertPreStage(PipelineStage.ProcessModule, new InjectPhase(this)); } } } \ No newline at end of file diff --git a/Confuser.Renamer/NameProtection.cs b/Confuser.Renamer/NameProtection.cs index e42d1415e..8b2dc7b2f 100644 --- a/Confuser.Renamer/NameProtection.cs +++ b/Confuser.Renamer/NameProtection.cs @@ -33,8 +33,8 @@ protected override void Initialize(ConfuserContext context) { protected override void PopulatePipeline(ProtectionPipeline pipeline) { pipeline.InsertPostStage(PipelineStage.Inspection, new AnalyzePhase(this)); - pipeline.InsertPreStage(PipelineStage.EndModule, new RenamePhase(this)); - pipeline.InsertPostStage(PipelineStage.EndModule, new PostRenamePhase(this)); + pipeline.InsertPostStage(PipelineStage.BeginModule, new RenamePhase(this)); + pipeline.InsertPreStage(PipelineStage.EndModule, new PostRenamePhase(this)); } } } \ No newline at end of file