https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d58a040eb2756115f6dc02...
commit d58a040eb2756115f6dc02691a0e989d6318b746 Author: Timo Kreuzer timo.kreuzer@reactos.org AuthorDate: Sun May 5 12:28:39 2024 +0300 Commit: Timo Kreuzer timo.kreuzer@reactos.org CommitDate: Tue Nov 5 10:54:21 2024 +0200
[RTL] Move ReactOS specific actctx init code into it's own function --- dll/ntdll/ldr/ldrinit.c | 4 ++-- sdk/lib/rtl/actctx.c | 63 +++++++++++++++++++++++++++++-------------------- 2 files changed, 40 insertions(+), 27 deletions(-)
diff --git a/dll/ntdll/ldr/ldrinit.c b/dll/ntdll/ldr/ldrinit.c index 24730bb80da..991f498dba2 100644 --- a/dll/ntdll/ldr/ldrinit.c +++ b/dll/ntdll/ldr/ldrinit.c @@ -93,7 +93,7 @@ ULONG RtlpDisableHeapLookaside; // TODO: Move to heap.c ULONG RtlpShutdownProcessFlags; // TODO: Use it
NTSTATUS LdrPerformRelocations(PIMAGE_NT_HEADERS NTHeaders, PVOID ImageBase); -void actctx_init(PVOID* pOldShimData); +NTSTATUS NTAPI RtlpInitializeActCtx(PVOID* pOldShimData); extern BOOLEAN RtlpUse16ByteSLists;
#ifdef _WIN64 @@ -2265,7 +2265,7 @@ LdrpInitializeProcess(IN PCONTEXT Context, &LdrpNtDllDataTableEntry->InInitializationOrderLinks);
/* Initialize Wine's active context implementation for the current process */ - actctx_init(&OldShimData); + RtlpInitializeActCtx(&OldShimData);
/* Set the current directory */ Status = RtlSetCurrentDirectory_U(&CurrentDirectory); diff --git a/sdk/lib/rtl/actctx.c b/sdk/lib/rtl/actctx.c index 550110800aa..a2d9080cb85 100644 --- a/sdk/lib/rtl/actctx.c +++ b/sdk/lib/rtl/actctx.c @@ -5076,12 +5076,10 @@ static const WCHAR *find_app_settings( ACTIVATION_CONTEXT *actctx, const WCHAR * }
/* initialize the activation context for the current process */ -void actctx_init(PVOID* pOldShimData) +void actctx_init(void) { ACTCTXW ctx; HANDLE handle; - WCHAR buffer[1024]; - NTSTATUS Status;
ctx.cbSize = sizeof(ctx); ctx.lpSource = NULL; @@ -5094,28 +5092,6 @@ void actctx_init(PVOID* pOldShimData) 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__ NtCurrentTeb()->ProcessEnvironmentBlock->ActivationContextData = process_actctx->ActivationContextData; #else @@ -6067,4 +6043,41 @@ RtlDeactivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CON Frame->Frame.Flags |= RTL_ACTIVATION_CONTEXT_STACK_FRAME_FLAG_DEACTIVATED; 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__