GetThreadContext

From aldeid
Jump to navigation Jump to search

Description

Returns the context structure of a given thread. The context for a thread stores all the thread information, such as the register values and current state.

A 64-bit application can retrieve the context of a WOW64 thread using the Wow64GetThreadContext function.

Syntax

BOOL WINAPI GetThreadContext(
  _In_     HANDLE hThread,
  _Inout_  LPCONTEXT lpContext
);

Parameters

hThread [in]
A handle to the thread whose context is to be retrieved. The handle must have THREAD_GET_CONTEXT access to the thread.
WOW64: The handle must also have THREAD_QUERY_INFORMATION access.
lpContext [in, out]
A pointer to a CONTEXT structure that receives the appropriate context of the specified thread. The value of the ContextFlags member of this structure specifies which portions of a thread's context are retrieved. The CONTEXT structure is highly processor specific. Refer to the WinNT.h header file for processor-specific definitions of this structures and any alignment requirements.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.