[WIN32K] Implement UOI_FLAGS in NtUserGetObjectInformation(). Based from a patch...
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 22 Apr 2018 20:56:16 +0000 (22:56 +0200)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 22 Apr 2018 21:00:55 +0000 (23:00 +0200)
CORE-13447 CORE-14422

This fixes closing nLite 1.4.9.3 (.NET2) application, as well as any
other program that expects that the interactive window station is
reported as being visible. I thank Mark Jansen and Joachim Henze for
help and testing.

win32ss/user/ntuser/winsta.c

index 1187e44..d9ca3ca 100644 (file)
@@ -717,22 +717,49 @@ NtUserGetObjectInformation(
         goto Exit;
     }
 
-    TRACE("WinSta or Desktop opened!!\n");
+    TRACE("WinSta or Desktop opened!\n");
 
     /* Get data */
     switch (nIndex)
     {
         case UOI_FLAGS:
         {
-            /* This is a default implementation that does almost nothing */
-            ObjectFlags.fInherit = FALSE;
+            OBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo;
+            ULONG BytesWritten;
+
             ObjectFlags.fReserved = FALSE;
+
+            /* Check whether this handle is inheritable */
+            Status = ZwQueryObject(hObject,
+                                   ObjectHandleFlagInformation,
+                                   &HandleInfo,
+                                   sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION),
+                                   &BytesWritten);
+            if (!NT_SUCCESS(Status))
+            {
+                ERR("ZwQueryObject failed, Status 0x%08lx\n", Status);
+                break;
+            }
+            ObjectFlags.fInherit = HandleInfo.Inherit;
+
             ObjectFlags.dwFlags = 0;
+            if (WinStaObject != NULL)
+            {
+                if (!(WinStaObject->Flags & WSS_NOIO))
+                    ObjectFlags.dwFlags |= WSF_VISIBLE;
+            }
+            else if (DesktopObject != NULL)
+            {
+                FIXME("Setting DF_ALLOWOTHERACCOUNTHOOK is unimplemented.\n");
+            }
+            else
+            {
+                ERR("No associated WinStaObject nor DesktopObject!\n");
+            }
 
             pvData = &ObjectFlags;
             nDataSize = sizeof(ObjectFlags);
             Status = STATUS_SUCCESS;
-            ERR("UOI_FLAGS unimplemented!\n");
             break;
         }