示例#1
0
 internal int GetRegister(
     int index,
     out ulong value)
 {
     if (ThreadService.CurrentThreadId.HasValue)
     {
         IThread thread = ThreadService.GetThreadInfoFromId(ThreadService.CurrentThreadId.Value);
         if (thread != null)
         {
             if (thread.GetRegisterValue(index, out value))
             {
                 return(HResult.S_OK);
             }
         }
     }
     value = 0;
     return(HResult.E_FAIL);
 }
示例#2
0
        public override void Invoke()
        {
            IThread thread = CurrentThread;

            if (thread == null)
            {
                throw new InvalidOperationException($"No current thread");
            }
            foreach (RegisterInfo register in ThreadService.Registers)
            {
                if (thread.GetRegisterValue(register.RegisterIndex, out ulong value))
                {
                    switch (register.RegisterSize)
                    {
                    case 1:
                        WriteLine("{0} = 0x{1:X1}", register.RegisterName, value);
                        break;

                    case 2:
                        WriteLine("{0} = 0x{1:X4}", register.RegisterName, value);
                        break;

                    case 4:
                        WriteLine("{0} = 0x{1:X8}", register.RegisterName, value);
                        break;

                    case 8:
                        WriteLine("{0} = 0x{1:X16}", register.RegisterName, value);
                        break;
                    }
                }
                else
                {
                    WriteLine("{0} = ", register.RegisterName);
                }
            }
        }