[INCLUDE][WINLOGON] Rename the STARTF_SCRNSAVER flag to STARTF_SCREENSAVER,
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 22 Jul 2018 18:45:16 +0000 (20:45 +0200)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 19 Aug 2018 20:18:40 +0000 (22:18 +0200)
as documented in "Advanced Windows NT" by Jeffrey M. Richter (Microsoft Press),
and in https://is.muni.cz/el/1433/jaro2010/PB167/um/cv5/undocumented_CreateProcess.pdf .

[INCLUDE][SERVICES][WIN32K:NTUSER] Add an undocumented STARTF_INHERITDESKTOP flag
for the STARTUPINFO::dwFlags structure member, whose purpose is to tell Win32k
that the created handles to the window station and desktop to which the
process is connecting to, can be inherited by its child processes.
It is used when starting interactive services.
Observed via API monitoring on Windows 2003.

base/system/services/database.c
base/system/winlogon/screensaver.c
sdk/include/reactos/undocuser.h
win32ss/user/ntuser/main.c

index 0a71065..409fab4 100644 (file)
@@ -17,6 +17,8 @@
 #include <userenv.h>
 #include <strsafe.h>
 
+#include <reactos/undocuser.h>
+
 #define NDEBUG
 #include <debug.h>
 
@@ -1674,6 +1676,7 @@ ScmStartUserModeService(PSERVICE Service,
     if ((NoInteractiveServices == 0) &&
         (Service->Status.dwServiceType & SERVICE_INTERACTIVE_PROCESS))
     {
+        StartupInfo.dwFlags |= STARTF_INHERITDESKTOP;
         StartupInfo.lpDesktop = L"WinSta0\\Default";
     }
 
index a613928..e56c688 100644 (file)
@@ -327,7 +327,7 @@ StartScreenSaver(
     ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
     ZeroMemory(&ProcessInformation, sizeof(PROCESS_INFORMATION));
     StartupInfo.cb = sizeof(STARTUPINFOW);
-    StartupInfo.dwFlags = STARTF_SCRNSAVER;
+    StartupInfo.dwFlags = STARTF_SCREENSAVER;
 
     /* FIXME: run the screen saver on the screen saver desktop */
     ret = CreateProcessW(szApplicationName,
index 7001e98..5e2074a 100644 (file)
@@ -156,8 +156,11 @@ extern "C" {
 #define DFCS_MENUARROWUP   0x0008
 #define DFCS_MENUARROWDOWN 0x0010
 
-
-#define STARTF_SCRNSAVER 0x80000000
+//
+// Undocumented flags for CreateProcess
+//
+#define STARTF_INHERITDESKTOP   0x40000000
+#define STARTF_SCREENSAVER      0x80000000
 
 #define MOD_WINLOGON_SAS 0x8000
 
index 2fc1b69..21fba73 100644 (file)
@@ -165,8 +165,8 @@ UserProcessCreate(PEPROCESS Process)
 
     /* Setup process flags */
     ppiCurrent->W32PF_flags |= W32PF_PROCESSCONNECTED;
-    if ( Process->Peb->ProcessParameters &&
-         Process->Peb->ProcessParameters->WindowFlags & STARTF_SCRNSAVER )
+    if (Process->Peb->ProcessParameters &&
+        (Process->Peb->ProcessParameters->WindowFlags & STARTF_SCREENSAVER))
     {
         ppiScrnSaver = ppiCurrent;
         ppiCurrent->W32PF_flags |= W32PF_SCREENSAVER;
@@ -603,7 +603,7 @@ InitThreadCallback(PETHREAD Thread)
 
         Status = IntResolveDesktop(Process,
                                    &DesktopPath,
-                                   FALSE,
+                                   !!(ProcessParams->WindowFlags & STARTF_INHERITDESKTOP),
                                    &hWinSta,
                                    &hDesk);