#ifndef _NTPSAPI_H
//
// Threads
//
#if (PHNT_MODE != PHNT_MODE_KERNEL)
/**
* Retrieves the context of the specified thread.
*
* \param ThreadHandle A handle to the thread.
* \param ThreadContext A pointer to a CONTEXT structure that receives the thread context.
* \return NTSTATUS Successful or errant status.
* \remarks Requires THREAD_GET_CONTEXT (0x8); ContextFlags selects the register groups. The context representation and
* alignment depend on the architecture, with a distinct Wow64NtGetContextThread path for 32-bit callers. A
* live running thread context is not a stable snapshot; synchronize or suspend an owned target before
* inspecting execution state.
*/
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
NtGetContextThread(
_In_ HANDLE ThreadHandle,
_Inout_ PCONTEXT ThreadContext
);
View code on GitHub#ifndef _NTZWAPI_H
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwGetContextThread(
_In_ HANDLE ThreadHandle,
_Inout_ PCONTEXT ThreadContext
);
View code on GitHubRetrieves the context (set of registers) of the specified thread.
ThreadHandle - a handle to a thread granting THREAD_GET_CONTEXT access.ThreadContext - a pointer to a CONTEXT structure that receives the state of registers. Note: make sure to initialize the ContextFlags field of the structure with the bit mask defining which portion of the context to query.See <ntddk.h> for information about CONTEXT structure usage.