Nikolay Sivov (@nsivov) commented about dlls/ntdll/actctx.c:
- FIXME: function prototype might be wrong
- */
+RTL_ACTIVATION_CONTEXT_STACK_FRAME * FASTCALL RtlActivateActivationContextUnsafeFast( RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED *frame_extended,
PVOID context )
+{
- ACTIVATION_CONTEXT_STACK *actctx_stack = NtCurrentTeb()->ActivationContextStackPointer;
- TRACE( "%p %p\n", frame_extended, context );
- frame_extended->Frame.Previous = actctx_stack->ActiveFrame;
- frame_extended->Frame.ActivationContext = context;
- frame_extended->Frame.Flags = 0x20;
- actctx_stack->ActiveFrame = &frame_extended->Frame;
- RtlAddRefActivationContext( context );
- return &frame_extended->Frame;
+}
Flags magic looks important. We need more tests for regular "safe" API to see what flags are set to for normal frames. Depending on how "unsafe" this is, for frames placed on stack you can't do LdrShutdownThread() in a clean way currently, because it will HeapFree() it.