Example #1
0
        private static void HookAllExceptions()
        {
            bool useMiniDumps = Program.LaunchParameters.ContainsKey("-minidump");
            bool useFullDumps = Program.LaunchParameters.ContainsKey("-fulldump");

            Console.WriteLine("Error Logging Enabled.");
            CrashDump.Options dumpOptions = CrashDump.Options.WithFullMemory;
            if (useFullDumps)
            {
                Console.WriteLine("Full Dump logs enabled.");
            }
            AppDomain.CurrentDomain.FirstChanceException += (EventHandler <FirstChanceExceptionEventArgs>)((sender, exceptionArgs) =>
            {
                Console.Write("================\r\n" + string.Format("{0}: First-Chance Exception\r\nCulture: {1}\r\nException: {2}\r\n", (object)DateTime.Now, (object)Thread.CurrentThread.CurrentCulture.Name, (object)exceptionArgs.Exception.ToString()) + "================\r\n\r\n");
                if (!useMiniDumps)
                {
                    return;
                }
                CrashDump.WriteException(CrashDump.Options.WithIndirectlyReferencedMemory, Path.Combine(Main.SavePath, "Dumps"));
            });
            AppDomain.CurrentDomain.UnhandledException += (UnhandledExceptionEventHandler)((sender, exceptionArgs) =>
            {
                Console.Write("================\r\n" + string.Format("{0}: Unhandled Exception\r\nCulture: {1}\r\nException: {2}\r\n", (object)DateTime.Now, (object)Thread.CurrentThread.CurrentCulture.Name, (object)exceptionArgs.ExceptionObject.ToString()) + "================\r\n");
                if (!useFullDumps)
                {
                    return;
                }
                CrashDump.WriteException(dumpOptions, Path.Combine(Main.SavePath, "Dumps"));
            });
        }
Example #2
0
        public Vtero(string MemoryDump) : this()
        {
            MemFile = MemoryDump.ToLower();

            if (MemFile.EndsWith(".dmp"))
            {
                var dump = new CrashDump(MemFile);
                if (dump.IsSupportedFormat())
                {
                    DetectedDesc = dump.PhysMemDesc;
                }
            }
            else if (MemFile.EndsWith(".vmss") || MemFile.EndsWith(".vmsn") || MemFile.EndsWith(".vmem"))
            {
                var dump = new VMWare(MemFile);
                if (dump.IsSupportedFormat())
                {
                    DetectedDesc = dump.PhysMemDesc;

                    MemFile = dump.MemFile;
                }
            }

            scan     = new Scanner(MemFile);
            FileSize = new FileInfo(MemFile).Length;
        }