PsSetCreateThreadNotifyRoutineEx Initial Thread Context

The documentation on MSDN for PsSetCreateThreadNotifyRoutineEx states that “The callback is executed on the newly created thread, which enables the callback to perform tasks such as setting initial thread context.”

I am familiar with the GetThreadContext and SetThreadContext user apis which allow getting and setting of thread context in user land, but are there also kernel APIs for doing the same? I have been unable to find any documentation on that. If not, what does Microsoft mean when they state that this callback allows you to perform tasks such as setting initial thread context?

The kernel exports an undocumented PsSetContextThread .

NTSTATUS
PsSetContextThread(
__in PETHREAD Thread,
__in PCONTEXT Context,
__in KPROCESSOR_MODE PreviousMode
)