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

commit fd39f92fcb8545f9f9eff46362827339dc3eab30
Author:     Hermès Bélusca-Maïto <[email protected]>
AuthorDate: Sun Jul 22 20:45:16 2018 +0200
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Sun Aug 19 22:18:40 2018 +0200

    [INCLUDE][WINLOGON] Rename the STARTF_SCRNSAVER flag to STARTF_SCREENSAVER,
    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    | 3 +++
 base/system/winlogon/screensaver.c | 2 +-
 sdk/include/reactos/undocuser.h    | 7 +++++--
 win32ss/user/ntuser/main.c         | 6 +++---
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/base/system/services/database.c b/base/system/services/database.c
index 0a710659bb..409fab4c71 100644
--- a/base/system/services/database.c
+++ b/base/system/services/database.c
@@ -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";
     }
 
diff --git a/base/system/winlogon/screensaver.c 
b/base/system/winlogon/screensaver.c
index a6139280ad..e56c688df8 100644
--- a/base/system/winlogon/screensaver.c
+++ b/base/system/winlogon/screensaver.c
@@ -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,
diff --git a/sdk/include/reactos/undocuser.h b/sdk/include/reactos/undocuser.h
index 7001e985f0..5e2074a217 100644
--- a/sdk/include/reactos/undocuser.h
+++ b/sdk/include/reactos/undocuser.h
@@ -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
 
diff --git a/win32ss/user/ntuser/main.c b/win32ss/user/ntuser/main.c
index 2fc1b69082..21fba73d1d 100644
--- a/win32ss/user/ntuser/main.c
+++ b/win32ss/user/ntuser/main.c
@@ -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);
 

Reply via email to