Skip to content

Commit d58a040

Browse files
committed
[RTL] Move ReactOS specific actctx init code into it's own function
1 parent 711fa80 commit d58a040

File tree

2 files changed

+40
-27
lines changed

2 files changed

+40
-27
lines changed

dll/ntdll/ldr/ldrinit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ ULONG RtlpDisableHeapLookaside; // TODO: Move to heap.c
9393
ULONG RtlpShutdownProcessFlags; // TODO: Use it
9494

9595
NTSTATUS LdrPerformRelocations(PIMAGE_NT_HEADERS NTHeaders, PVOID ImageBase);
96-
void actctx_init(PVOID* pOldShimData);
96+
NTSTATUS NTAPI RtlpInitializeActCtx(PVOID* pOldShimData);
9797
extern BOOLEAN RtlpUse16ByteSLists;
9898

9999
#ifdef _WIN64
@@ -2265,7 +2265,7 @@ LdrpInitializeProcess(IN PCONTEXT Context,
22652265
&LdrpNtDllDataTableEntry->InInitializationOrderLinks);
22662266

22672267
/* Initialize Wine's active context implementation for the current process */
2268-
actctx_init(&OldShimData);
2268+
RtlpInitializeActCtx(&OldShimData);
22692269

22702270
/* Set the current directory */
22712271
Status = RtlSetCurrentDirectory_U(&CurrentDirectory);

sdk/lib/rtl/actctx.c

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5076,12 +5076,10 @@ static const WCHAR *find_app_settings( ACTIVATION_CONTEXT *actctx, const WCHAR *
50765076
}
50775077

50785078
/* initialize the activation context for the current process */
5079-
void actctx_init(PVOID* pOldShimData)
5079+
void actctx_init(void)
50805080
{
50815081
ACTCTXW ctx;
50825082
HANDLE handle;
5083-
WCHAR buffer[1024];
5084-
NTSTATUS Status;
50855083

50865084
ctx.cbSize = sizeof(ctx);
50875085
ctx.lpSource = NULL;
@@ -5094,28 +5092,6 @@ void actctx_init(PVOID* pOldShimData)
50945092
process_actctx = check_actctx(handle);
50955093
}
50965094

5097-
/* ReactOS specific:
5098-
Now that we have found the process_actctx we can initialize the process compat subsystem */
5099-
LdrpInitializeProcessCompat(process_actctx, pOldShimData);
5100-
5101-
5102-
ctx.dwFlags = 0;
5103-
ctx.hModule = NULL;
5104-
ctx.lpResourceName = NULL;
5105-
ctx.lpSource = buffer;
5106-
RtlStringCchCopyW(buffer, RTL_NUMBER_OF(buffer), SharedUserData->NtSystemRoot);
5107-
RtlStringCchCatW(buffer, RTL_NUMBER_OF(buffer), L"\\winsxs\\manifests\\systemcompatible.manifest");
5108-
5109-
Status = RtlCreateActivationContext(0, (PVOID)&ctx, 0, NULL, NULL, &handle);
5110-
if (NT_SUCCESS(Status))
5111-
{
5112-
implicit_actctx = check_actctx(handle);
5113-
}
5114-
else
5115-
{
5116-
DPRINT1("Failed to create the implicit act ctx. Status: 0x%x!!!\n", Status);
5117-
}
5118-
51195095
#ifdef __REACTOS__
51205096
NtCurrentTeb()->ProcessEnvironmentBlock->ActivationContextData = process_actctx->ActivationContextData;
51215097
#else
@@ -6067,4 +6043,41 @@ RtlDeactivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CON
60676043
Frame->Frame.Flags |= RTL_ACTIVATION_CONTEXT_STACK_FRAME_FLAG_DEACTIVATED;
60686044
return NewFrame->Previous;
60696045
}
6046+
6047+
NTSTATUS
6048+
NTAPI
6049+
RtlpInitializeActCtx(PVOID* pOldShimData)
6050+
{
6051+
ACTCTXW ctx;
6052+
HANDLE handle;
6053+
WCHAR buffer[1024];
6054+
NTSTATUS Status;
6055+
6056+
actctx_init();
6057+
6058+
/* ReactOS specific:
6059+
Now that we have found the process_actctx we can initialize the process compat subsystem */
6060+
LdrpInitializeProcessCompat(process_actctx, pOldShimData);
6061+
6062+
ctx.cbSize = sizeof(ctx);
6063+
ctx.dwFlags = 0;
6064+
ctx.hModule = NULL;
6065+
ctx.lpResourceName = NULL;
6066+
ctx.lpSource = buffer;
6067+
RtlStringCchCopyW(buffer, RTL_NUMBER_OF(buffer), SharedUserData->NtSystemRoot);
6068+
RtlStringCchCatW(buffer, RTL_NUMBER_OF(buffer), L"\\winsxs\\manifests\\systemcompatible.manifest");
6069+
6070+
Status = RtlCreateActivationContext(0, (PVOID)&ctx, 0, NULL, NULL, &handle);
6071+
if (NT_SUCCESS(Status))
6072+
{
6073+
implicit_actctx = check_actctx(handle);
6074+
}
6075+
else
6076+
{
6077+
DPRINT1("Failed to create the implicit act ctx. Status: 0x%x!!!\n", Status);
6078+
}
6079+
6080+
return Status;
6081+
}
6082+
60706083
#endif // __REACTOS__

0 commit comments

Comments
 (0)