Windows API reference
SetThreadContext
Sets the register context of a thread, including the instruction pointer.
- Library
- Kernel32.dll
- Category
- Injection, Process Hollowing
- Suspicion
- high
Detection summary
Thread execution hijacking or hollowing: suspend a thread, set RIP to shellcode or a new entry point, then resume; detect ETW-TI context-change events, SuspendThread/SetThreadContext/ResumeThread sequences, a new RIP in private executable memory, and Sysmon 25 image tampering. No direct Sysmon event exists for context changes.
- Sysmon: No Sysmon event mapped
- ETW: Microsoft-Windows-Threat-Intelligence
- Notes: Sysmon does not log SetThreadContext; Sysmon 25 may correlate only when image tampering is detected. Debuggers also use this API heavily.
Sources and documentation
- Microsoft Learn documentation (direct documentation)
Not yet human-reviewed. Page metadata generated .
Legitimate use
Debuggers, crash handlers, profilers, sandbox/EDR instrumentation and runtime exception handling.
Related APIs
- GetThreadContext — Kernel32.dll
- SuspendThread — Kernel32.dll
- ResumeThread — Kernel32.dll