From: Hermès Bélusca-Maïto Date: Sun, 22 Jul 2018 18:45:16 +0000 (+0200) Subject: [INCLUDE][WINLOGON] Rename the STARTF_SCRNSAVER flag to STARTF_SCREENSAVER, X-Git-Tag: 0.4.11-dev~50 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=fd39f92fcb8545f9f9eff46362827339dc3eab30 [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. --- diff --git a/base/system/services/database.c b/base/system/services/database.c index 0a710659bb6..409fab4c718 100644 --- a/base/system/services/database.c +++ b/base/system/services/database.c @@ -17,6 +17,8 @@ #include #include +#include + #define NDEBUG #include @@ -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 a6139280ad3..e56c688df8f 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 7001e985f04..5e2074a2171 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 2fc1b69082d..21fba73d1db 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);