- Fix incorrect prototypes and partially implement fast unsafe versions of activation context activation/deactivation, however disable them for now, until the new loader is in place.
- Fix their usage in the new loader code, which by mistake (which got copypasted into three other places) was passing a totally empty activation context to the activate function.

svn path=/trunk/; revision=51281
This commit is contained in:
Aleksey Bragin 2011-04-08 17:49:49 +00:00
parent b63bf768a6
commit a6586c33b1
5 changed files with 72 additions and 26 deletions

View file

@ -419,7 +419,7 @@
@ stdcall RtlAcquireSRWLockShared(ptr)
@ stdcall RtlActivateActivationContext(long ptr ptr)
//@ stdcall RtlActivateActivationContextEx
@ stdcall RtlActivateActivationContextUnsafeFast(ptr ptr)
@ fastcall RtlActivateActivationContextUnsafeFast(ptr ptr)
@ stdcall RtlAddAccessAllowedAce(ptr long long ptr)
@ stdcall RtlAddAccessAllowedAceEx(ptr long long long ptr)
@ stdcall RtlAddAccessAllowedObjectAce(ptr long long long ptr ptr ptr)
@ -532,7 +532,7 @@
@ stdcall RtlCutoverTimeToSystemTime(ptr ptr ptr long)
@ stdcall RtlDeNormalizeProcessParams(ptr)
@ stdcall RtlDeactivateActivationContext(long long)
@ stdcall RtlDeactivateActivationContextUnsafeFast(ptr)
@ fastcall RtlDeactivateActivationContextUnsafeFast(ptr)
//@ stdcall RtlDebugPrintTimes
@ stdcall RtlDecodePointer(ptr)
@ stdcall RtlDecodeSystemPointer(ptr) RtlEncodeSystemPointer

View file

@ -616,8 +616,8 @@ LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL)
/* Set up the Act Ctx */
ActCtx.Size = sizeof(ActCtx);
ActCtx.Frame.Flags = ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID;
RtlZeroMemory(&ActCtx, sizeof(ActCtx));
ActCtx.Format = 1;
RtlZeroMemory(&ActCtx.Frame, sizeof(RTL_ACTIVATION_CONTEXT_STACK_FRAME));
/* Activate the ActCtx */
RtlActivateActivationContextUnsafeFast(&ActCtx,
@ -682,8 +682,8 @@ LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL)
{
/* Set up the Act Ctx */
ActCtx.Size = sizeof(ActCtx);
ActCtx.Frame.Flags = ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID;
RtlZeroMemory(&ActCtx, sizeof(ActCtx));
ActCtx.Format = 1;
RtlZeroMemory(&ActCtx.Frame, sizeof(RTL_ACTIVATION_CONTEXT_STACK_FRAME));
/* Activate the ActCtx */
RtlActivateActivationContextUnsafeFast(&ActCtx,

View file

@ -660,8 +660,8 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL,
DPRINT1("LdrpWalkImportDescriptor('%S' %x)\n", DllPath, LdrEntry);
/* Set up the Act Ctx */
ActCtx.Size = sizeof(ActCtx);
ActCtx.Frame.Flags = ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID;
RtlZeroMemory(&ActCtx, sizeof(ActCtx));
ActCtx.Frame.Flags = 1;
RtlZeroMemory(&ActCtx.Frame, sizeof(RTL_ACTIVATION_CONTEXT_STACK_FRAME));
/* Check if we have a manifest prober routine */
if (LdrpManifestProberRoutine)

View file

@ -3071,8 +3071,8 @@ RtlAddRefActivationContext(
NTSYSAPI
NTSTATUS
NTAPI
PRTL_ACTIVATION_CONTEXT_STACK_FRAME
FASTCALL
RtlActivateActivationContextUnsafeFast(
IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame,
IN PVOID Context
@ -3121,8 +3121,8 @@ NTAPI
RtlFreeThreadActivationContextStack(void);
NTSYSAPI
NTSTATUS
NTAPI
PRTL_ACTIVATION_CONTEXT_STACK_FRAME
FASTCALL
RtlDeactivateActivationContextUnsafeFast(
IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame
);

View file

@ -22,6 +22,8 @@
#include <wine/unicode.h>
BOOLEAN RtlpNotAllowingMultipleActivation;
#define QUERY_ACTCTX_FLAG_ACTIVE (0x00000001)
#define ACTCTX_FLAGS_ALL (\
@ -2730,31 +2732,75 @@ RtlAllocateActivationContextStack(IN PVOID *Context)
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
PRTL_ACTIVATION_CONTEXT_STACK_FRAME
FASTCALL
RtlActivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame,
IN PVOID Context)
{
static int i;
#if NEW_NTDLL_LOADER
RTL_ACTIVATION_CONTEXT_STACK_FRAME *ActiveFrame;
if (i == 0)
UNIMPLEMENTED;
i++;
/* Get the curren active frame */
ActiveFrame = NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame;
return STATUS_NOT_IMPLEMENTED;
DPRINT1("ActiveFrame %p, &Frame->Frame %p, Context %p\n", ActiveFrame, &Frame->Frame, Context);
/* Actually activate it */
Frame->Frame.Previous = ActiveFrame;
Frame->Frame.ActivationContext = Context;
Frame->Frame.Flags = 0;
/* Check if we can activate this context */
if ((ActiveFrame && (ActiveFrame->ActivationContext != Context)) ||
Context)
{
/* Set new active frame */
NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame = &Frame->Frame;
return &Frame->Frame;
}
/* We can get here only one way: it was already activated */
DPRINT1("Trying to activate improper activation context\n");
/* Activate only if we are allowing multiple activation */
if (!RtlpNotAllowingMultipleActivation)
{
NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame = &Frame->Frame;
}
else
{
/* Set flag */
Frame->Frame.Flags = 0x30;
}
/* Return pointer to the activation frame */
return &Frame->Frame;
#else
return NULL;
#endif
}
NTSTATUS
NTAPI
PRTL_ACTIVATION_CONTEXT_STACK_FRAME
FASTCALL
RtlDeactivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame)
{
static int i;
#if NEW_NTDLL_LOADER
RTL_ACTIVATION_CONTEXT_STACK_FRAME *frame, *top;
if (i == 0)
UNIMPLEMENTED;
i++;
/* find the right frame */
top = NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame;
frame = &Frame->Frame;
return STATUS_NOT_IMPLEMENTED;
if (!frame)
RtlRaiseStatus( STATUS_SXS_INVALID_DEACTIVATION );
/* pop everything up to and including frame */
NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame = frame->Previous;
return frame;
#else
return NULL;
#endif
}