GetThreadContext

  BOOL GetThreadContext(hThread, lpContext)    
  HANDLE hThread;    
  LPCONTEXT lpContext;    

The GetThreadContext function retrieves the context of the specified thread.

Parameters

hThread

Supplies an open handle to a thread whose context is to be retrieved. The handle must have been created with THREAD_GET_CONTEXT access to the thread.

lpContext

Supplies the address of a CONTEXT structure that receives the appropriate context of the specified thread. The value of the ContextFlags field of this structure specifies which portions of a threads context are to be retrieved. The context structure is highly machine specific. There are currently two versions of the context structure. One version exists for x86 processors, and another exists for MIPS processors.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

This function is used to retrieve the context of the specified thread. The function allows selective context to be retrieved based on the value of the ContextFlags member of the CONTEXT structure. The specified thread does not have to be being debugged in order for this function to operate. The caller must simply have a handle to the thread that was created with THREAD_GET_CONTEXT access.

See Also

SetThreadContext