Author: fireball Date: Wed Sep 24 03:12:41 2008 New Revision: 36450
URL: http://svn.reactos.org/svn/reactos?rev=36450&view=rev Log: - Make SmCreateUserProcess accept two flags: the old "wait for" one, and a new "reserve 1Mb" one. NT reserves lower 1MB of address space when starting a subsystem process. ReactOS should too, however right now this change is disabled (leads to boot problems).
Modified: trunk/reactos/base/system/smss/initrun.c trunk/reactos/base/system/smss/smapiexec.c trunk/reactos/base/system/smss/smss.h
Modified: trunk/reactos/base/system/smss/initrun.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss/initrun.c?... ============================================================================== --- trunk/reactos/base/system/smss/initrun.c [iso-8859-1] (original) +++ trunk/reactos/base/system/smss/initrun.c [iso-8859-1] Wed Sep 24 03:12:41 2008 @@ -80,8 +80,8 @@
/* Create NT process */ Status = SmCreateUserProcess (ImagePath, - CommandLine, - TRUE, /* wait */ + CommandLine, + SM_CREATE_FLAG_WAIT, NULL, NULL); if (!NT_SUCCESS(Status)) {
Modified: trunk/reactos/base/system/smss/smapiexec.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss/smapiexec.... ============================================================================== --- trunk/reactos/base/system/smss/smapiexec.c [iso-8859-1] (original) +++ trunk/reactos/base/system/smss/smapiexec.c [iso-8859-1] Wed Sep 24 03:12:41 2008 @@ -22,8 +22,10 @@ * ARGUMENTS * ImagePath: absolute path of the image to run; * CommandLine: arguments and options for ImagePath; - * WaitForIt: TRUE for boot time processes and FALSE for - * subsystems bootstrapping; + * Flags: Wait flag: Set for boot time processes and unset for + * subsystems bootstrapping; + * 1Mb reserve flag: Set for subsystems, unset for everything +* else * Timeout: optional: used if WaitForIt==TRUE; * ProcessHandle: optional: a duplicated handle for the child process (storage provided by the caller). @@ -35,7 +37,7 @@ NTSTATUS STDCALL SmCreateUserProcess (LPWSTR ImagePath, LPWSTR CommandLine, - BOOLEAN WaitForIt, + ULONG Flags, PLARGE_INTEGER Timeout OPTIONAL, PRTL_USER_PROCESS_INFORMATION UserProcessInfo OPTIONAL) { @@ -106,7 +108,12 @@ __FUNCTION__, Status); return Status; } - +#ifdef ROS_DOESNT_SUCK + /* Reserve lower 1Mb, if requested */ + if (Flags & SM_CREATE_FLAG_RESERVE_1MB) + ProcessParameters->Flags |= RTL_USER_PROCESS_PARAMETERS_RESERVE_1MB; +#endif + /* Create the user process */ Status = RtlCreateUserProcess (& ImagePathString, OBJ_CASE_INSENSITIVE, ProcessParameters, @@ -141,7 +148,7 @@ }
/* Wait for process termination */ - if (WaitForIt) + if (Flags & SM_CREATE_FLAG_WAIT) { Status = NtWaitForSingleObject (pProcessInfo->ProcessHandle, FALSE, @@ -151,13 +158,13 @@ DPRINT1("SM: %s: NtWaitForSingleObject failed with Status=0x%08lx\n", __FUNCTION__, Status); } - - } - if (NULL == UserProcessInfo) - { - NtClose(pProcessInfo->ProcessHandle); - NtClose(pProcessInfo->ThreadHandle); - } + } + + if (NULL == UserProcessInfo) + { + NtClose(pProcessInfo->ProcessHandle); + NtClose(pProcessInfo->ThreadHandle); + } return Status; }
@@ -230,9 +237,9 @@ Request->SmHeader.Status = SmCreateUserProcess(ImagePath, CommandLine, - FALSE, /* wait */ - NULL, /* timeout */ - & ProcessInfo); + SM_CREATE_FLAG_RESERVE_1MB, + NULL, /* timeout */ + & ProcessInfo); if (NT_SUCCESS(Request->SmHeader.Status)) { Status = SmCreateClient (& ProcessInfo, Name);
Modified: trunk/reactos/base/system/smss/smss.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss/smss.h?rev... ============================================================================== --- trunk/reactos/base/system/smss/smss.h [iso-8859-1] (original) +++ trunk/reactos/base/system/smss/smss.h [iso-8859-1] Wed Sep 24 03:12:41 2008 @@ -61,9 +61,11 @@
/* smapiexec.c */ +#define SM_CREATE_FLAG_WAIT 0x01 +#define SM_CREATE_FLAG_RESERVE_1MB 0x02 NTSTATUS STDCALL SmCreateUserProcess(LPWSTR ImagePath, LPWSTR CommandLine, - BOOLEAN WaitForIt, + ULONG Flags, PLARGE_INTEGER Timeout OPTIONAL, PRTL_USER_PROCESS_INFORMATION UserProcessInfo OPTIONAL); NTSTATUS FASTCALL SmExecPgm(PSM_PORT_MESSAGE);