mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 09:50:02 +00:00
[AUDIT] after looking through code no signs of reverse engineering were found.
BUG 1436 patch from w3seek : SMSS: make \SystemRoot\System32 the current directory for started subsystems svn path=/trunk/; revision=21742
This commit is contained in:
parent
fbd4530bfa
commit
0707606360
1 changed files with 52 additions and 10 deletions
|
@ -28,6 +28,8 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
static const WCHAR szSystemDirectory[] = L"\\System32";
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* SmCreateUserProcess/5
|
* SmCreateUserProcess/5
|
||||||
*
|
*
|
||||||
|
@ -55,6 +57,7 @@ SmCreateUserProcess (LPWSTR ImagePath,
|
||||||
{
|
{
|
||||||
UNICODE_STRING ImagePathString = {0};
|
UNICODE_STRING ImagePathString = {0};
|
||||||
UNICODE_STRING CommandLineString = {0};
|
UNICODE_STRING CommandLineString = {0};
|
||||||
|
UNICODE_STRING SystemDirectory = {0};
|
||||||
PRTL_USER_PROCESS_PARAMETERS ProcessParameters = NULL;
|
PRTL_USER_PROCESS_PARAMETERS ProcessParameters = NULL;
|
||||||
RTL_USER_PROCESS_INFORMATION ProcessInfo = {0};
|
RTL_USER_PROCESS_INFORMATION ProcessInfo = {0};
|
||||||
PRTL_USER_PROCESS_INFORMATION pProcessInfo = & ProcessInfo;
|
PRTL_USER_PROCESS_INFORMATION pProcessInfo = & ProcessInfo;
|
||||||
|
@ -70,16 +73,55 @@ SmCreateUserProcess (LPWSTR ImagePath,
|
||||||
RtlInitUnicodeString (& ImagePathString, ImagePath);
|
RtlInitUnicodeString (& ImagePathString, ImagePath);
|
||||||
RtlInitUnicodeString (& CommandLineString, CommandLine);
|
RtlInitUnicodeString (& CommandLineString, CommandLine);
|
||||||
|
|
||||||
RtlCreateProcessParameters(& ProcessParameters,
|
SystemDirectory.MaximumLength = (wcslen(SharedUserData->NtSystemRoot) * sizeof(WCHAR)) + sizeof(szSystemDirectory);
|
||||||
& ImagePathString,
|
SystemDirectory.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||||
NULL,
|
0,
|
||||||
NULL,
|
SystemDirectory.MaximumLength);
|
||||||
& CommandLineString,
|
if (SystemDirectory.Buffer == NULL)
|
||||||
SmSystemEnvironment,
|
{
|
||||||
NULL,
|
Status = STATUS_NO_MEMORY;
|
||||||
NULL,
|
DPRINT1("SM: %s: Allocating system directory string failed (Status=0x%08lx)\n",
|
||||||
NULL,
|
__FUNCTION__, Status);
|
||||||
NULL);
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = RtlAppendUnicodeToString(& SystemDirectory,
|
||||||
|
SharedUserData->NtSystemRoot);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
goto FailProcParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = RtlAppendUnicodeToString(& SystemDirectory,
|
||||||
|
szSystemDirectory);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
goto FailProcParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Status = RtlCreateProcessParameters(& ProcessParameters,
|
||||||
|
& ImagePathString,
|
||||||
|
NULL,
|
||||||
|
& SystemDirectory,
|
||||||
|
& CommandLineString,
|
||||||
|
SmSystemEnvironment,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
RtlFreeHeap(RtlGetProcessHeap(),
|
||||||
|
0,
|
||||||
|
SystemDirectory.Buffer);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
FailProcParams:
|
||||||
|
DPRINT1("SM: %s: Creating process parameters failed (Status=0x%08lx)\n",
|
||||||
|
__FUNCTION__, Status);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
Status = RtlCreateUserProcess (& ImagePathString,
|
Status = RtlCreateUserProcess (& ImagePathString,
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
|
|
Loading…
Reference in a new issue