Esempio n. 1
0
        private void Execute(AThread Thread)
        {
            AutoResetEvent Wait = new AutoResetEvent(false);

            Thread.ThreadState.Break += (sender, e) => Thread.StopExecution();
            Thread.WorkFinished      += (sender, e) => Wait.Set();

            Wait.Reset();
            Thread.Execute();
            Wait.WaitOne();
        }
Esempio n. 2
0
        protected void ExecuteOpcodes()
        {
            using (ManualResetEvent Wait = new ManualResetEvent(false))
            {
                Thread.ThreadState.Break += (sender, e) => Thread.StopExecution();
                Thread.WorkFinished      += (sender, e) => Wait.Set();

                Thread.Execute();
                Wait.WaitOne();
            }
        }
Esempio n. 3
0
        protected void ExecuteOpcodes()
        {
            using (ManualResetEvent Wait = new ManualResetEvent(false))
            {
                Thread.ThreadState.Break += (sender, e) => Thread.StopExecution();
                Thread.WorkFinished      += (sender, e) => Wait.Set();

                Thread.Execute();
                Wait.WaitOne();
            }

            if (UnicornAvailable)
            {
                UnicornEmu.RunForCount((ulong)(Position - EntryPoint - 8) / 4);
            }
        }
Esempio n. 4
0
        public bool Run()
        {
            if (Executables.Count == 0)
            {
                return(false);
            }

            long StackBot = TlsPageAddr - MaxStackSize;

            Memory.Manager.MapPhys(StackBot, MaxStackSize, (int)MemoryType.Normal, AMemoryPerm.RW);

            int Handle = MakeThread(Executables[0].ImageBase, TlsPageAddr, 0, 48, 0);

            if (Handle == -1)
            {
                return(false);
            }

            MainThread = Ns.Os.Handles.GetData <HThread>(Handle).Thread;

            MainThread.Execute();

            return(true);
        }