Binarysharp.MemoryManagement.Threading.ThreadCore.SetThreadContext C# (CSharp) Method

SetThreadContext() public static method

Sets the context for the specified thread.
public static SetThreadContext ( SafeMemoryHandle threadHandle, ThreadContext context ) : void
threadHandle Binarysharp.MemoryManagement.Native.SafeMemoryHandle A handle to the thread whose context is to be set.
context Binarysharp.MemoryManagement.Native.ThreadContext A pointer to a structure that contains the context to be set in the specified thread.
return void
        public static void SetThreadContext(SafeMemoryHandle threadHandle, ThreadContext context)
        {
            // Check if the handle is valid
            HandleManipulator.ValidateAsArgument(threadHandle, "threadHandle");

            // Set the thread context
            if(!NativeMethods.SetThreadContext(threadHandle, ref context))
                throw new Win32Exception("Couldn't set the thread context.");
        }