Ejemplo n.º 1
0
        /// <summary>
        /// Compiles all script modules.
        /// </summary>
        /// <param name="Modules">Module project filenames.</param>
        /// <param name="CompiledModuleFilenames">The resulting compiled module assembly filenames.</param>
        private static void CompileModules(List <string> Modules)
        {
            Log.TraceInformation("Building script modules");
            // Make sure DefaultScriptsDLLName is compiled first
            var DefaultScriptsProjName = Path.ChangeExtension(DefaultScriptsDLLName, "csproj");

            foreach (var ModuleName in Modules)
            {
                if (ModuleName.IndexOf(DefaultScriptsProjName, StringComparison.InvariantCultureIgnoreCase) >= 0)
                {
                    Log.TraceInformation("Building script module: {0}", ModuleName);
                    try
                    {
                        CompileScriptModule(ModuleName);
                    }
                    catch (Exception Ex)
                    {
                        CommandUtils.LogError(LogUtils.FormatException(Ex));
                        throw new AutomationException("Failed to compile module {0}", ModuleName);
                    }
                    break;
                }
            }

            // Second pass, compile everything else
            foreach (var ModuleName in Modules)
            {
                if (ModuleName.IndexOf(DefaultScriptsProjName, StringComparison.InvariantCultureIgnoreCase) < 0)
                {
                    Log.TraceInformation("Building script module: {0}", ModuleName);
                    try
                    {
                        CompileScriptModule(ModuleName);
                    }
                    catch (Exception Ex)
                    {
                        CommandUtils.LogError(LogUtils.FormatException(Ex));
                        throw new AutomationException("Failed to compile module {0}", ModuleName);
                    }
                }
            }
        }
Ejemplo n.º 2
0
    public PatchBitEntry(byte [] rawBytes)
    {
        var index = 0x00;

        OpCode      = (PatchBits.OpCode_)BitConverter.ToInt32(rawBytes, index);
        index      += 4;
        ActionSize  = BitConverter.ToInt32(rawBytes, index);
        index      += 4;
        PatternSize = BitConverter.ToInt32(rawBytes, index);
        index      += 4;
        Rva         = BitConverter.ToInt32(rawBytes, index);
        index      += 4;
        UnknownInt  = BitConverter.ToInt32(rawBytes, index);
        index      += 4;
        ModuleName  = Encoding.Unicode.GetString(rawBytes, index, 0x20);

        var nullPos = ModuleName.IndexOf('\0');

        if (nullPos > -1)
        {
            ModuleName = ModuleName.Substring(0, nullPos);
        }

        index += 0x20; // module size

        var buff = new byte[0x20];

        Buffer.BlockCopy(rawBytes, index, buff, 0, 0x20);

        UnknownBytes = buff;

        index += 0x20; //unknown, seen all 0x0

        Pattern = new byte[PatternSize];
        Buffer.BlockCopy(rawBytes, index, Pattern, 0, PatternSize);
        index += PatternSize;

        //Trace.Assert(index==rawBytes.Length,"Remaining bytes in rawBytes");
    }