Exemplo n.º 1
0
 private void SetThreadContext(IntPtr hThread, ref NativeMethods.CONTEXT context)
 {
     if (!NativeMethods.SetThreadContext(hThread, ref context))
     {
         throw new Win32Exception();
     }
 }
 /// <summary>
 /// Set the thread context event
 /// </summary>
 /// <param name="threadId">Current process thread</param>
 /// <param name="context">Context to set</param>
 private void SetThreadContext(IntPtr hThread, ref NativeMethods.CONTEXT context)
 {
     // set the context event. If it fails throw an exception
     if (!NativeMethods.SetThreadContext(hThread, ref context))
     {
         throw new Win32Exception();
     }
 }
 /// <summary>
 /// Retrieve the thread context event
 /// </summary>
 /// <param name="threadId">Current process thread</param>
 /// <param name="context">Thread context to return</param>
 private void GetThreadContext(IntPtr hThread, ref NativeMethods.CONTEXT context)
 {
     // get the thread context. If it fails, we throw an exception
     if (!NativeMethods.GetThreadContext(hThread, ref context))
     {
         throw new Win32Exception();
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        public BaseSpy()
        {
            m_ContextBuffer = new NativeMethods.CONTEXT();
            m_ContextBuffer.ContextFlags = NativeMethods.ContextFlags.CONTEXT_CONTROL | NativeMethods.ContextFlags.CONTEXT_INTEGER;
            m_EventBuffer = new NativeMethods.DEBUG_EVENT_EXCEPTION();

            m_ToStop  = false;
            m_Stopped = new ManualResetEvent(true);

            m_Dictionary = new Dictionary <uint, byte[]>();
        }
        // --------------------------------------------------------------
        #region CONSTRUCTOR
        // --------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        public BaseSpy()
        {
            // initialize the context buffer
            m_ContextBuffer = new NativeMethods.CONTEXT
            {
                ContextFlags = NativeMethods.ContextFlags.CONTEXT_CONTROL | NativeMethods.ContextFlags.CONTEXT_INTEGER
            };

            // initialize the event buffer
            m_EventBuffer = new NativeMethods.DEBUG_EVENT_EXCEPTION();

            // reset the stop flags
            m_ToStop  = false;
            m_Stopped = new ManualResetEvent(true);

            // initialize the data dictionary
            m_Dictionary = new Dictionary <uint, byte[]>();
        }