- 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).

svn path=/trunk/; revision=36450
This commit is contained in:
Aleksey Bragin 2008-09-24 08:12:41 +00:00
parent 68b1f10bef
commit b20633a1f0
3 changed files with 26 additions and 17 deletions

View file

@ -80,8 +80,8 @@ SmpRunBootAppsQueryRoutine(PWSTR ValueName,
/* Create NT process */ /* Create NT process */
Status = SmCreateUserProcess (ImagePath, Status = SmCreateUserProcess (ImagePath,
CommandLine, CommandLine,
TRUE, /* wait */ SM_CREATE_FLAG_WAIT,
NULL, NULL); NULL, NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {

View file

@ -22,8 +22,10 @@ static const WCHAR szSystemDirectory[] = L"\\System32";
* ARGUMENTS * ARGUMENTS
* ImagePath: absolute path of the image to run; * ImagePath: absolute path of the image to run;
* CommandLine: arguments and options for ImagePath; * CommandLine: arguments and options for ImagePath;
* WaitForIt: TRUE for boot time processes and FALSE for * Flags: Wait flag: Set for boot time processes and unset for
* subsystems bootstrapping; * subsystems bootstrapping;
* 1Mb reserve flag: Set for subsystems, unset for everything
* else
* Timeout: optional: used if WaitForIt==TRUE; * Timeout: optional: used if WaitForIt==TRUE;
* ProcessHandle: optional: a duplicated handle for * ProcessHandle: optional: a duplicated handle for
the child process (storage provided by the caller). the child process (storage provided by the caller).
@ -35,7 +37,7 @@ static const WCHAR szSystemDirectory[] = L"\\System32";
NTSTATUS STDCALL NTSTATUS STDCALL
SmCreateUserProcess (LPWSTR ImagePath, SmCreateUserProcess (LPWSTR ImagePath,
LPWSTR CommandLine, LPWSTR CommandLine,
BOOLEAN WaitForIt, ULONG Flags,
PLARGE_INTEGER Timeout OPTIONAL, PLARGE_INTEGER Timeout OPTIONAL,
PRTL_USER_PROCESS_INFORMATION UserProcessInfo OPTIONAL) PRTL_USER_PROCESS_INFORMATION UserProcessInfo OPTIONAL)
{ {
@ -106,7 +108,12 @@ FailProcParams:
__FUNCTION__, Status); __FUNCTION__, Status);
return 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, Status = RtlCreateUserProcess (& ImagePathString,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
ProcessParameters, ProcessParameters,
@ -141,7 +148,7 @@ FailProcParams:
} }
/* Wait for process termination */ /* Wait for process termination */
if (WaitForIt) if (Flags & SM_CREATE_FLAG_WAIT)
{ {
Status = NtWaitForSingleObject (pProcessInfo->ProcessHandle, Status = NtWaitForSingleObject (pProcessInfo->ProcessHandle,
FALSE, FALSE,
@ -151,13 +158,13 @@ FailProcParams:
DPRINT1("SM: %s: NtWaitForSingleObject failed with Status=0x%08lx\n", DPRINT1("SM: %s: NtWaitForSingleObject failed with Status=0x%08lx\n",
__FUNCTION__, Status); __FUNCTION__, Status);
} }
} }
if (NULL == UserProcessInfo)
{ if (NULL == UserProcessInfo)
NtClose(pProcessInfo->ProcessHandle); {
NtClose(pProcessInfo->ThreadHandle); NtClose(pProcessInfo->ProcessHandle);
} NtClose(pProcessInfo->ThreadHandle);
}
return Status; return Status;
} }
@ -230,9 +237,9 @@ SMAPI(SmExecPgm)
Request->SmHeader.Status = Request->SmHeader.Status =
SmCreateUserProcess(ImagePath, SmCreateUserProcess(ImagePath,
CommandLine, CommandLine,
FALSE, /* wait */ SM_CREATE_FLAG_RESERVE_1MB,
NULL, /* timeout */ NULL, /* timeout */
& ProcessInfo); & ProcessInfo);
if (NT_SUCCESS(Request->SmHeader.Status)) if (NT_SUCCESS(Request->SmHeader.Status))
{ {
Status = SmCreateClient (& ProcessInfo, Name); Status = SmCreateClient (& ProcessInfo, Name);

View file

@ -61,9 +61,11 @@ VOID STDCALL SmpApiThread(PVOID);
/* smapiexec.c */ /* smapiexec.c */
#define SM_CREATE_FLAG_WAIT 0x01
#define SM_CREATE_FLAG_RESERVE_1MB 0x02
NTSTATUS STDCALL SmCreateUserProcess(LPWSTR ImagePath, NTSTATUS STDCALL SmCreateUserProcess(LPWSTR ImagePath,
LPWSTR CommandLine, LPWSTR CommandLine,
BOOLEAN WaitForIt, ULONG Flags,
PLARGE_INTEGER Timeout OPTIONAL, PLARGE_INTEGER Timeout OPTIONAL,
PRTL_USER_PROCESS_INFORMATION UserProcessInfo OPTIONAL); PRTL_USER_PROCESS_INFORMATION UserProcessInfo OPTIONAL);
NTSTATUS FASTCALL SmExecPgm(PSM_PORT_MESSAGE); NTSTATUS FASTCALL SmExecPgm(PSM_PORT_MESSAGE);