[RTL] actctx: Use the new RosGetProcessCompatVersion. 419/head
authorMark Jansen <mark.jansen@reactos.org>
Mon, 9 Apr 2018 16:55:59 +0000 (18:55 +0200)
committerMark Jansen <mark.jansen@reactos.org>
Mon, 9 Apr 2018 17:36:09 +0000 (19:36 +0200)
sdk/lib/rtl/actctx.c

index f4a5f26..2f82808 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <rtl.h>
 #include <ntstrsafe.h>
 
 #include <rtl.h>
 #include <ntstrsafe.h>
+#include <compat_undoc.h>
 
 #define NDEBUG
 #include <debug.h>
 
 #define NDEBUG
 #include <debug.h>
@@ -4935,9 +4936,6 @@ void actctx_init(void)
     HANDLE handle;
     WCHAR buffer[1024];
     NTSTATUS Status;
     HANDLE handle;
     WCHAR buffer[1024];
     NTSTATUS Status;
-    BOOLEAN bForwardCompatible = FALSE;
-    ULONG Buffer[(sizeof(COMPATIBILITY_CONTEXT_ELEMENT) * 10 + sizeof(ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION)) / sizeof(ULONG)]; 
-    SIZE_T SizeRequired;
 
     ctx.cbSize   = sizeof(ctx);
     ctx.lpSource = NULL;
 
     ctx.cbSize   = sizeof(ctx);
     ctx.lpSource = NULL;
@@ -4950,36 +4948,21 @@ void actctx_init(void)
         process_actctx = check_actctx(handle);
     }
 
         process_actctx = check_actctx(handle);
     }
 
-    /* FIXME: use RosGetProcessCompatVersion when PR419 gets merged */
-    Status = RtlQueryInformationActivationContext(RTL_QUERY_ACTIVATION_CONTEXT_FLAG_NO_ADDREF,
-                                                  NULL,
-                                                  NULL,
-                                                  CompatibilityInformationInActivationContext,
-                                                  Buffer,
-                                                  sizeof(Buffer),
-                                                  &SizeRequired);
-    if (NT_SUCCESS(Status))
-    {
-        ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION* ContextCompatInfo;
-        ContextCompatInfo = (ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION*)Buffer;
-        DPRINT("RtlQueryInformationActivationContext for CompatibilityInformationInActivationContext suceeded\n");
-        /* No Compatibility elements present, bail out */
-        if (ContextCompatInfo->ElementCount != 0)
-        {
-            DPRINT1("Found compatibility information in exe manifest (%d). Attempting to activate forward compatibility!\n", ContextCompatInfo->ElementCount);
-            bForwardCompatible = TRUE;
-        }
-    }
-
     ctx.dwFlags  = 0;
     ctx.hModule  = NULL;
     ctx.lpResourceName = NULL;
     ctx.lpSource = buffer;
     ctx.dwFlags  = 0;
     ctx.hModule  = NULL;
     ctx.lpResourceName = NULL;
     ctx.lpSource = buffer;
-    RtlStringCchCopyW(buffer, 1024, SharedUserData->NtSystemRoot);
-    if (!bForwardCompatible)
-        RtlStringCchCatW(buffer, 1024, L"\\winsxs\\manifests\\systemcompatible.manifest");
+    RtlStringCchCopyW(buffer, RTL_NUMBER_OF(buffer), SharedUserData->NtSystemRoot);
+
+    if (RosGetProcessCompatVersion())
+    {
+        RtlStringCchCatW(buffer, RTL_NUMBER_OF(buffer), L"\\winsxs\\manifests\\forwardcompatible.manifest");
+    }
     else
     else
-        RtlStringCchCatW(buffer, 1024, L"\\winsxs\\manifests\\forwardcompatible.manifest");
+    {
+        RtlStringCchCatW(buffer, RTL_NUMBER_OF(buffer), L"\\winsxs\\manifests\\systemcompatible.manifest");
+    }
+
     Status = RtlCreateActivationContext(0, (PVOID)&ctx, 0, NULL, NULL, &handle);
     if (NT_SUCCESS(Status))
     {
     Status = RtlCreateActivationContext(0, (PVOID)&ctx, 0, NULL, NULL, &handle);
     if (NT_SUCCESS(Status))
     {