Skip to content
This repository has been archived by the owner on Jan 27, 2019. It is now read-only.

Commit

Permalink
Add new pipeline stage
Browse files Browse the repository at this point in the history
  • Loading branch information
yck1509 committed Jul 30, 2014
1 parent 54c32c9 commit 78af582
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 9 deletions.
4 changes: 4 additions & 0 deletions Confuser.Core/ConfuserEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions Confuser.Core/ProtectionPipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ public enum PipelineStage {
/// </summary>
BeginModule,

/// <summary>
/// Confuser engine processes a module.
/// This stage occurs once per module.
/// </summary>
ProcessModule,

/// <summary>
/// Confuser engine optimizes opcodes of the method bodys.
/// This stage occurs once per module.
Expand Down
2 changes: 1 addition & 1 deletion Confuser.Protections/AntiDebugProtection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Confuser.Protections/AntiDumpProtection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Confuser.Protections/AntiILDasmProtection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions Confuser.Protections/Constants/ConstantProtection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}
2 changes: 1 addition & 1 deletion Confuser.Protections/Resources/ResourceProtection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}
4 changes: 2 additions & 2 deletions Confuser.Renamer/NameProtection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}

0 comments on commit 78af582

Please sign in to comment.