线程context

线程切换的时候,要保存当前运行状态,以便后续切换回来

CONTEXT结构体保存的是一堆寄存器

两个函数

//You cannot get a valid context for a running thread. Use the SuspendThread function to suspend the thread before calling GetThreadContext.
//If you call GetThreadContext for the current thread, the function returns successfully; however, the context returned is not valid.
BOOL SetThreadContext(HANDLE hThread,const CONTEXT *lpContext);

//Do not try to set the context for a running thread; the results are unpredictable. 
//Use the SuspendThread function to suspend the thread before calling SetThreadContext.
BOOL GetThreadContext(HANDLE hThread,LPCONTEXT lpContext);
原文地址:https://www.cnblogs.com/a-s-m/p/12349816.html