Beispiel #1
0
 public override void OnBeforeAddingResources(MetadataBuilder builder)
 {
     if (!options.DecryptMethods)
     {
         return;
     }
     methodsDecrypter.encryptNativeMethods(builder);
 }
Beispiel #2
0
        public override void OnWriterEvent(ModuleWriterBase writer, ModuleWriterEvent evt)
        {
            if (!options.DecryptMethods || !methodsDecrypter.HasNativeMethods)
            {
                return;
            }
            switch (evt)
            {
            case ModuleWriterEvent.Begin:
                // The decrypter assumes RVAs are unique so don't share any method bodies
                writer.TheOptions.ShareMethodBodies = false;
                break;

            case ModuleWriterEvent.MDBeginAddResources:
                methodsDecrypter.prepareEncryptNativeMethods(writer);
                break;

            case ModuleWriterEvent.BeginWriteChunks:
                methodsDecrypter.encryptNativeMethods(writer);
                break;
            }
        }