Edit

Share via


Wow64SetThreadContext function (wow64apiset.h)

Sets the context of the specified WOW64 thread.

Syntax

BOOL Wow64SetThreadContext(
  [in] HANDLE              hThread,
  [in] const WOW64_CONTEXT *lpContext
);

Parameters

[in] hThread

A handle to the thread whose context is to be set.

[in] lpContext

A WOW64_CONTEXT structure. The caller must initialize the ContextFlags member of this structure.

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.

Remarks

This function allows the selective context to be set based on the value of the ContextFlags member of the context structure. The thread handle identified by the hThread parameter is typically being debugged, but the function can also operate even when it is not being debugged.

This function is intended for 64-bit applications. It is not supported on 32-bit Windows; such calls fail and set the last error code to ERROR_INVALID_FUNCTION. A 32-bit application can call this function on a WOW64 thread; the result is the same as calling the SetThreadContext function.

Do not try to set the context for a running thread; the results are unpredictable. Use the Wow64SuspendThread function to suspend the thread before calling Wow64SetThreadContext.

Requirements

Requirement Value
Minimum supported client Windows 10 version 1903
Minimum supported server Windows Server, version 1903
Header wow64apiset.h
Library Kernel32.lib
DLL Kernel32.dll

See also

Debugging Functions

GetXStateFeaturesMask

SetThreadContext

SetXStateFeaturesMask

WOW64_CONTEXT

Wow64GetThreadContext