https://git.reactos.org/?p=reactos.git;a=commitdiff;h=029b8f2cf9912b148f3e60be0472652f26a1adb9

commit 029b8f2cf9912b148f3e60be0472652f26a1adb9
Author:     Mark Jansen <[email protected]>
AuthorDate: Sun Dec 23 18:36:59 2018 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Wed Aug 21 18:57:52 2019 +0200

    [NTDLL] Use the embedded manifest from the process to check compatibility.
---
 dll/ntdll/ldr/ldrinit.c | 11 ++++-------
 sdk/lib/rtl/actctx.c    |  7 ++++++-
 sdk/lib/rtl/rtlp.h      |  6 ++++++
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/dll/ntdll/ldr/ldrinit.c b/dll/ntdll/ldr/ldrinit.c
index c23783a77ce..37e731c5960 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(void);
+void actctx_init(PVOID* pOldShimData);
 extern BOOLEAN RtlpUse16ByteSLists;
 
 #ifdef _WIN64
@@ -1539,7 +1539,7 @@ LdrpValidateImageForMp(IN PLDR_DATA_TABLE_ENTRY 
LdrDataTableEntry)
 
 VOID
 NTAPI
-LdrpInitializeProcessCompat(PVOID* pOldShimData)
+LdrpInitializeProcessCompat(PVOID pProcessActctx, PVOID* pOldShimData)
 {
     static const struct
     {
@@ -1584,7 +1584,7 @@ LdrpInitializeProcessCompat(PVOID* pOldShimData)
 
     SizeRequired = sizeof(Buffer);
     Status = 
RtlQueryInformationActivationContext(RTL_QUERY_ACTIVATION_CONTEXT_FLAG_NO_ADDREF,
-                                                  NULL,
+                                                  pProcessActctx,
                                                   NULL,
                                                   
CompatibilityInformationInActivationContext,
                                                   Buffer,
@@ -2187,10 +2187,7 @@ LdrpInitializeProcess(IN PCONTEXT Context,
                    &LdrpNtDllDataTableEntry->InInitializationOrderLinks);
 
     /* Initialize Wine's active context implementation for the current process 
*/
-    actctx_init();
-
-    /* ReactOS specific */
-    LdrpInitializeProcessCompat(&OldShimData);
+    actctx_init(&OldShimData);
 
     /* Set the current directory */
     Status = RtlSetCurrentDirectory_U(&CurrentDirectory);
diff --git a/sdk/lib/rtl/actctx.c b/sdk/lib/rtl/actctx.c
index 62a6af88c8d..e51e7c43421 100644
--- a/sdk/lib/rtl/actctx.c
+++ b/sdk/lib/rtl/actctx.c
@@ -5000,7 +5000,7 @@ static NTSTATUS find_guid(ACTIVATION_CONTEXT* actctx, 
ULONG section_kind,
 }
 
 /* initialize the activation context for the current process */
-void actctx_init(void)
+void actctx_init(PVOID* pOldShimData)
 {
     ACTCTXW ctx;
     HANDLE handle;
@@ -5018,6 +5018,11 @@ void actctx_init(void)
         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;
diff --git a/sdk/lib/rtl/rtlp.h b/sdk/lib/rtl/rtlp.h
index 1d13f7a61b5..c1cc8dc7ebf 100644
--- a/sdk/lib/rtl/rtlp.h
+++ b/sdk/lib/rtl/rtlp.h
@@ -243,4 +243,10 @@ WCHAR
 NTAPI
 RtlpDowncaseUnicodeChar(IN WCHAR Source);
 
+/* ReactOS only */
+VOID
+NTAPI
+LdrpInitializeProcessCompat(PVOID pProcessActctx, PVOID* pOldShimData);
+
+
 /* EOF */

Reply via email to