ICorDebugProcess::GetThreadContext Method

Gets the context for the given thread in this process.

HRESULT GetThreadContext(
    [in] DWORD threadID,
    [in] ULONG32 contextSize,
    [in, out, length_is(contextSize), size_is(contextSize)]
    BYTE context[]);

Parameters

Parameter Description

threadID

[in] The ID of the thread for which to retrieve the context.

contextSize

[in] The size of the context array.

context

[in, out] An array of bytes that describe the thread's context.

The context specifies the architecture of the processor on which the thread is executing.

Remarks

The debugger should call this method rather than the Win32 GetThreadContext method, because the thread may actually be in a "hijacked" state, in which its context has been temporarily changed. This method should be used only when a thread is in native code. Use ICorDebugRegisterSet Interface for threads in managed code.

The data returned is a context structure for the current platform. Just as with the Win32 GetThreadContext method, the caller should initialize the context parameter before calling this method.

Requirements

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: CorDebug.idl

Library: CorGuids.lib

.NET Framework Version: 2.0

See Also

Reference

ICorDebugProcess Interface
ICorDebugProcess2 Interface