Ejemplo n.º 1
0
        private static void PatchApplicationUpdate(TargetDomainCallback callback, string cbDirectory)
        {
            var assembly = LoadAssembly(cbDirectory, "ApplicationUpdate.Client.dll");

            Log.Debug("   - Injecting combined rules location into GetDecryptedStream");
            RedirectPath(assembly);

            AddOverride(callback, assembly, false);
        }
Ejemplo n.º 2
0
        private static void PatchApplication(TargetDomainCallback callback, string cbDirectory, string changelog)
        {
            var assembly = LoadAssembly(cbDirectory, "CharacterBuilder.exe");

            Log.Debug("   - Replacing SmartAssembly exception handler.");
            DisableExceptionHandlers(assembly);
            ReplaceEntryPointHandler(assembly);

            Log.Debug("   - Injecting CBLoader changelog.");
            InjectChangelog(assembly, changelog);

            Log.Debug("   - Removing D&D Compendium links.");
            RemoveCompendiumLinks(assembly);

            AddOverride(callback, assembly, true);
        }
Ejemplo n.º 3
0
        private static void AddOverride(TargetDomainCallback callback, AssemblyDef assembly, bool expectObfusication)
        {
            Log.Debug($" - Adding patched assembly for {assembly.Name}");

            var settings = new ModuleWriterOptions(assembly.ManifestModule);

            if (expectObfusication)
            {
                settings.MetadataOptions.Flags |= MetadataFlags.KeepOldMaxStack;
            }

            var patchedData = new MemoryStream();

            assembly.Write(patchedData, settings);
            callback.AddOverride(assembly.Name, patchedData.ToArray());
            File.WriteAllBytes(assembly.Name, patchedData.ToArray());
        }