mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[RTL] Move ReactOS specific actctx init code into it's own function
This commit is contained in:
parent
711fa80fa1
commit
d58a040eb2
2 changed files with 40 additions and 27 deletions
|
@ -93,7 +93,7 @@ ULONG RtlpDisableHeapLookaside; // TODO: Move to heap.c
|
||||||
ULONG RtlpShutdownProcessFlags; // TODO: Use it
|
ULONG RtlpShutdownProcessFlags; // TODO: Use it
|
||||||
|
|
||||||
NTSTATUS LdrPerformRelocations(PIMAGE_NT_HEADERS NTHeaders, PVOID ImageBase);
|
NTSTATUS LdrPerformRelocations(PIMAGE_NT_HEADERS NTHeaders, PVOID ImageBase);
|
||||||
void actctx_init(PVOID* pOldShimData);
|
NTSTATUS NTAPI RtlpInitializeActCtx(PVOID* pOldShimData);
|
||||||
extern BOOLEAN RtlpUse16ByteSLists;
|
extern BOOLEAN RtlpUse16ByteSLists;
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
|
@ -2265,7 +2265,7 @@ LdrpInitializeProcess(IN PCONTEXT Context,
|
||||||
&LdrpNtDllDataTableEntry->InInitializationOrderLinks);
|
&LdrpNtDllDataTableEntry->InInitializationOrderLinks);
|
||||||
|
|
||||||
/* Initialize Wine's active context implementation for the current process */
|
/* Initialize Wine's active context implementation for the current process */
|
||||||
actctx_init(&OldShimData);
|
RtlpInitializeActCtx(&OldShimData);
|
||||||
|
|
||||||
/* Set the current directory */
|
/* Set the current directory */
|
||||||
Status = RtlSetCurrentDirectory_U(&CurrentDirectory);
|
Status = RtlSetCurrentDirectory_U(&CurrentDirectory);
|
||||||
|
|
|
@ -5076,12 +5076,10 @@ static const WCHAR *find_app_settings( ACTIVATION_CONTEXT *actctx, const WCHAR *
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize the activation context for the current process */
|
/* initialize the activation context for the current process */
|
||||||
void actctx_init(PVOID* pOldShimData)
|
void actctx_init(void)
|
||||||
{
|
{
|
||||||
ACTCTXW ctx;
|
ACTCTXW ctx;
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
WCHAR buffer[1024];
|
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
ctx.cbSize = sizeof(ctx);
|
ctx.cbSize = sizeof(ctx);
|
||||||
ctx.lpSource = NULL;
|
ctx.lpSource = NULL;
|
||||||
|
@ -5094,28 +5092,6 @@ void actctx_init(PVOID* pOldShimData)
|
||||||
process_actctx = check_actctx(handle);
|
process_actctx = check_actctx(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ReactOS specific:
|
|
||||||
Now that we have found the process_actctx we can initialize the process compat subsystem */
|
|
||||||
LdrpInitializeProcessCompat(process_actctx, pOldShimData);
|
|
||||||
|
|
||||||
|
|
||||||
ctx.dwFlags = 0;
|
|
||||||
ctx.hModule = NULL;
|
|
||||||
ctx.lpResourceName = NULL;
|
|
||||||
ctx.lpSource = buffer;
|
|
||||||
RtlStringCchCopyW(buffer, RTL_NUMBER_OF(buffer), SharedUserData->NtSystemRoot);
|
|
||||||
RtlStringCchCatW(buffer, RTL_NUMBER_OF(buffer), L"\\winsxs\\manifests\\systemcompatible.manifest");
|
|
||||||
|
|
||||||
Status = RtlCreateActivationContext(0, (PVOID)&ctx, 0, NULL, NULL, &handle);
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
implicit_actctx = check_actctx(handle);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DPRINT1("Failed to create the implicit act ctx. Status: 0x%x!!!\n", Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
NtCurrentTeb()->ProcessEnvironmentBlock->ActivationContextData = process_actctx->ActivationContextData;
|
NtCurrentTeb()->ProcessEnvironmentBlock->ActivationContextData = process_actctx->ActivationContextData;
|
||||||
#else
|
#else
|
||||||
|
@ -6067,4 +6043,41 @@ RtlDeactivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CON
|
||||||
Frame->Frame.Flags |= RTL_ACTIVATION_CONTEXT_STACK_FRAME_FLAG_DEACTIVATED;
|
Frame->Frame.Flags |= RTL_ACTIVATION_CONTEXT_STACK_FRAME_FLAG_DEACTIVATED;
|
||||||
return NewFrame->Previous;
|
return NewFrame->Previous;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
RtlpInitializeActCtx(PVOID* pOldShimData)
|
||||||
|
{
|
||||||
|
ACTCTXW ctx;
|
||||||
|
HANDLE handle;
|
||||||
|
WCHAR buffer[1024];
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
actctx_init();
|
||||||
|
|
||||||
|
/* ReactOS specific:
|
||||||
|
Now that we have found the process_actctx we can initialize the process compat subsystem */
|
||||||
|
LdrpInitializeProcessCompat(process_actctx, pOldShimData);
|
||||||
|
|
||||||
|
ctx.cbSize = sizeof(ctx);
|
||||||
|
ctx.dwFlags = 0;
|
||||||
|
ctx.hModule = NULL;
|
||||||
|
ctx.lpResourceName = NULL;
|
||||||
|
ctx.lpSource = buffer;
|
||||||
|
RtlStringCchCopyW(buffer, RTL_NUMBER_OF(buffer), SharedUserData->NtSystemRoot);
|
||||||
|
RtlStringCchCatW(buffer, RTL_NUMBER_OF(buffer), L"\\winsxs\\manifests\\systemcompatible.manifest");
|
||||||
|
|
||||||
|
Status = RtlCreateActivationContext(0, (PVOID)&ctx, 0, NULL, NULL, &handle);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
implicit_actctx = check_actctx(handle);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to create the implicit act ctx. Status: 0x%x!!!\n", Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // __REACTOS__
|
#endif // __REACTOS__
|
||||||
|
|
Loading…
Reference in a new issue