コード例 #1
0
        public bool Set(MemoryHandler Memory)
        {
            this.Memory = Memory;
            Memory.RefreshMemory();
            var process = Memory.Process;

            Address = Memory.GetAddress(Pointer);
            if (Address == null)
            {
                return(false);
            }

            foreach (ProcessThread th in process.Threads)
            {
                if (AffectedThreads.ContainsKey(th.Id))
                {
                    continue;
                }

                var hThread = Kernel32.OpenThread(ThreadAccess.THREAD_ALL_ACCESS, false, th.Id);
                if (hThread == IntPtr.Zero)
                {
                    throw new BreakPointException("Can't open thread for access");
                }

                SetToThread(hThread, th.Id);

                if (!Kernel32.CloseHandle(hThread))
                {
                    throw new BreakPointException("Failed to close thread handle");
                }
            }

            return(true);
        }
コード例 #2
0
        public void UnSet(MemoryHandler Memory)
        {
            Memory.RefreshMemory();
            var process = Memory.Process;

            foreach (ProcessThread th in process.Threads)
            {
                if (!AffectedThreads.ContainsKey(th.Id))
                {
                    continue;
                }

                var hThread = Kernel32.OpenThread(ThreadAccess.THREAD_ALL_ACCESS, false, th.Id);
                if (hThread == IntPtr.Zero)
                {
                    throw new BreakPointException("Can't open thread for access");
                }

                UnsetFromThread(hThread, th.Id);

                if (!Kernel32.CloseHandle(hThread))
                {
                    throw new BreakPointException("Failed to close thread handle");
                }
            }

            AffectedThreads.Clear();
        }
コード例 #3
0
        public void Read(MemoryHandler Memory)
        {
            var bytes = new List <byte>();

            for (long i = 0; i < Length; i += readCount)
            {
                bytes.AddRange(Memory.ReadBytes(IntPtr.Add(StartAddress, (int)i), i + readCount >= Length ? (int)(Length - i) : readCount));
            }

            Data = bytes.ToArray();
        }
コード例 #4
0
 public ProcessSuspender(MemoryHandler m)
 {
     this.m = m;
     m.SuspendAllThreads();
 }
コード例 #5
0
 public MemoryDump(MemoryHandler Memory, IntPtr Address, long Length)
     : this(Address, Length)
 {
     Read(Memory);
 }
コード例 #6
0
 public MemoryContainer(MemoryHandler m, IntPtr Address, int Length)
     : this(Address)
 {
     this.Data = m.ReadBytes(Address, Length);
 }
コード例 #7
0
ファイル: Suspender.cs プロジェクト: vjella-c/WhiteMagic
 public ProcessSuspender(MemoryHandler Memory)
 {
     this.Memory = Memory;
     Memory.SuspendAllThreads();
 }