Share via


ICorDebugProcess::SetThreadContext Method

Sets the context for the given thread in this process.

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

Parameters

  • threadID
    [in] The ID of the thread for which to set the context.

  • contextSize
    [in] The size of the context array.

  • context
    [in] 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 SetThreadContext function, 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 for threads in managed code. You should never need to modify the context of a thread during an out-of-band (OOB) debug event.

The data passed must be a context structure for the current platform.

This method can corrupt the runtime if used improperly.

Requirements

Platforms: See .NET Framework System Requirements.

Header: CorDebug.idl

Library: CorGuids.lib

.NET Framework Versions: 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0

See Also

Reference

ICorDebugProcess Interface

ICorDebugProcess2 Interface