Example #1
0
        public unsafe void GetThreadContext(uint threadId, IntPtr contextBufferPointer, int contextBufferSize)
        {
            ExecuteOnDkmInitializedThread(() =>
            {
                DkmThread thread = GetThread(threadId);

                thread.GetContext(-1, contextBufferPointer.ToPointer(), contextBufferSize);
            });
        }
Example #2
0
        /// <summary>
        /// Gets the thread context for the given thread.
        /// </summary>
        /// <param name="threadID">The OS thread ID to read the context from.</param>
        /// <param name="contextFlags">The requested context flags, or 0 for default flags.</param>
        /// <param name="contextSize">The size (in bytes) of the context parameter.</param>
        /// <param name="context">A pointer to the buffer to write to.</param>
        public unsafe bool GetThreadContext(uint threadID, uint contextFlags, uint contextSize, IntPtr context)
        {
            try
            {
                DkmThread thread = Process.GetThreads().Concat(Process.GetSystemThreads()).First(t => t.SystemPart.Id == threadID);

                thread.GetContext((int)contextFlags, context.ToPointer(), (int)contextSize);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Example #3
0
        /// <summary>
        /// Gets the thread context for the given thread.
        /// </summary>
        /// <param name="threadID">The OS thread ID to read the context from.</param>
        /// <param name="contextFlags">The requested context flags, or 0 for default flags.</param>
        /// <param name="contextSize">The size (in bytes) of the context parameter.</param>
        /// <param name="context">A pointer to the buffer to write to.</param>
        public bool GetThreadContext(uint threadID, uint contextFlags, uint contextSize, byte[] context)
        {
            try
            {
                DkmThread thread = Process.GetThreads().Concat(Process.GetSystemThreads()).First(t => t.SystemPart.Id == threadID);

                thread.GetContext((int)contextFlags, context);
                return(true);
            }
            catch
            {
                return(false);
            }
        }