- 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 */
Status = SmCreateUserProcess (ImagePath,
CommandLine,
TRUE, /* wait */
CommandLine,
SM_CREATE_FLAG_WAIT,
NULL, NULL);
if (!NT_SUCCESS(Status))
{

View file

@ -22,8 +22,10 @@ static const WCHAR szSystemDirectory[] = L"\\System32";
* 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 @@ static const WCHAR szSystemDirectory[] = L"\\System32";
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 @@ FailProcParams:
__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 @@ FailProcParams:
}
/* Wait for process termination */
if (WaitForIt)
if (Flags & SM_CREATE_FLAG_WAIT)
{
Status = NtWaitForSingleObject (pProcessInfo->ProcessHandle,
FALSE,
@ -151,13 +158,13 @@ FailProcParams:
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 @@ SMAPI(SmExecPgm)
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);

View file

@ -61,9 +61,11 @@ VOID STDCALL SmpApiThread(PVOID);
/* 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);