[SMSS]: Nuke the environment code and instead inherit SMSS2's, which does all the right things. #if 0 all the non-used code, and nuke support for the "debug" subsystem as well as the custom "SmQuery" APIs.

[SMSS2]: Use SMSS2's environment when creating SMSS.

svn path=/trunk/; revision=55455
This commit is contained in:
Alex Ionescu 2012-02-06 09:29:33 +00:00
parent b207b33d11
commit ed64af75b6
16 changed files with 38 additions and 53 deletions

View file

@ -500,7 +500,7 @@ SmDestroyClient (ULONG SubsystemId)
RtlLeaveCriticalSection (& SmpClientDirectory.Lock); RtlLeaveCriticalSection (& SmpClientDirectory.Lock);
return Status; return Status;
} }
#if 0
/* === Utilities for SmQryInfo === */ /* === Utilities for SmQryInfo === */
/********************************************************************** /**********************************************************************
@ -566,5 +566,5 @@ SmGetSubSystemInformation (PSM_SUBSYSTEM_INFORMATION i)
RtlLeaveCriticalSection (& SmpClientDirectory.Lock); RtlLeaveCriticalSection (& SmpClientDirectory.Lock);
return Status; return Status;
} }
#endif
/* EOF */ /* EOF */

View file

@ -12,6 +12,7 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#if 0
/* GLOBALS ***********************************************************/ /* GLOBALS ***********************************************************/
@ -164,5 +165,7 @@ SmInitializeDbgSs (VOID)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
#endif
/* EOF */ /* EOF */

View file

@ -30,7 +30,7 @@ struct {
// {TRUE, SmInitDosDevices, "create dos device links"}, // {TRUE, SmInitDosDevices, "create dos device links"},
// {TRUE, SmRunBootApplications, "run boot applications"}, // {TRUE, SmRunBootApplications, "run boot applications"},
// {TRUE, SmProcessFileRenameList, "process the file rename list"}, // {TRUE, SmProcessFileRenameList, "process the file rename list"},
{FALSE, SmUpdateEnvironment, "update environment variables"}, // {FALSE, SmUpdateEnvironment, "update environment variables"},
// {FALSE, SmLoadKnownDlls, "preload system DLLs"}, // {FALSE, SmLoadKnownDlls, "preload system DLLs"},
// {TRUE, SmCreatePagingFiles, "create paging files"}, // {TRUE, SmCreatePagingFiles, "create paging files"},
// {TRUE, SmInitializeRegistry, "initialize the registry"}, // {TRUE, SmInitializeRegistry, "initialize the registry"},

View file

@ -12,6 +12,8 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#if 0
static NTSTATUS NTAPI static NTSTATUS NTAPI
SmpDosDevicesQueryRoutine(PWSTR ValueName, SmpDosDevicesQueryRoutine(PWSTR ValueName,
ULONG ValueType, ULONG ValueType,
@ -89,4 +91,6 @@ SmInitDosDevices(VOID)
return(Status); return(Status);
} }
#endif
/* EOF */ /* EOF */

View file

@ -22,10 +22,12 @@ PWSTR SmSystemEnvironment = NULL;
NTSTATUS NTSTATUS
SmCreateEnvironment(VOID) SmCreateEnvironment(VOID)
{ {
return RtlCreateEnvironment(FALSE, &SmSystemEnvironment); return RtlCreateEnvironment(TRUE, &SmSystemEnvironment);
} }
#if 0
static NTSTATUS static NTSTATUS
SmpSetEnvironmentVariable(IN PVOID Context, SmpSetEnvironmentVariable(IN PVOID Context,
IN PWSTR ValueName, IN PWSTR ValueName,
@ -61,7 +63,6 @@ SmpEnvironmentQueryRoutine(IN PWSTR ValueName,
return SmpSetEnvironmentVariable(Context,ValueName,(PWSTR)ValueData); return SmpSetEnvironmentVariable(Context,ValueName,(PWSTR)ValueData);
} }
NTSTATUS NTSTATUS
SmSetEnvironmentVariables(VOID) SmSetEnvironmentVariables(VOID)
{ {
@ -280,14 +281,13 @@ done:
return Status; return Status;
} }
/********************************************************************** /**********************************************************************
* Set environment variables from registry * Set environment variables from registry
*/ */
NTSTATUS NTSTATUS
SmUpdateEnvironment(VOID) SmUpdateEnvironment(VOID)
{ {
RTL_QUERY_REGISTRY_TABLE QueryTable[2]; //RTL_QUERY_REGISTRY_TABLE QueryTable[2];
WCHAR ValueBuffer[MAX_PATH]; WCHAR ValueBuffer[MAX_PATH];
NTSTATUS Status; NTSTATUS Status;
#ifndef NDEBUG #ifndef NDEBUG
@ -343,5 +343,5 @@ SmUpdateEnvironment(VOID)
return Status; return Status;
} }
#endif
/* EOF */ /* EOF */

View file

@ -12,6 +12,7 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#if 0
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@ -446,4 +447,6 @@ SmProcessFileRenameList( VOID )
return (STATUS_SUCCESS); return (STATUS_SUCCESS);
} }
#endif
/* EOF */ /* EOF */

View file

@ -12,6 +12,7 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#if 0
static NTSTATUS NTAPI static NTSTATUS NTAPI
SmpObjectDirectoryQueryRoutine(PWSTR ValueName, SmpObjectDirectoryQueryRoutine(PWSTR ValueName,
ULONG ValueType, ULONG ValueType,
@ -69,5 +70,6 @@ SmCreateObjectDirectories(VOID)
return(Status); return(Status);
} }
#endif
/* EOF */ /* EOF */

View file

@ -12,6 +12,8 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#if 0
#define GIGABYTE (1024 * 1024 * 1024) /* One Gigabyte */ #define GIGABYTE (1024 * 1024 * 1024) /* One Gigabyte */
static NTSTATUS NTAPI static NTSTATUS NTAPI
@ -520,6 +522,6 @@ SmCreatePagingFiles(VOID)
return Status; return Status;
} }
#endif
/* EOF */ /* EOF */

View file

@ -12,6 +12,7 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#if 0
NTSTATUS NTSTATUS
SmInitializeRegistry(VOID) SmInitializeRegistry(VOID)
{ {
@ -20,5 +21,6 @@ SmInitializeRegistry(VOID)
/* Load remaining registry hives */ /* Load remaining registry hives */
return NtInitializeRegistry(CM_BOOT_FLAG_SMSS); return NtInitializeRegistry(CM_BOOT_FLAG_SMSS);
} }
#endif
/* EOF */ /* EOF */

View file

@ -12,6 +12,7 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#if 0
//HANDLE Children[2] = {0, 0}; /* csrss, winlogon */ //HANDLE Children[2] = {0, 0}; /* csrss, winlogon */
@ -223,6 +224,6 @@ SmRunBootApplications(VOID)
return(Status); return(Status);
} }
#endif
/* EOF */ /* EOF */

View file

@ -12,6 +12,7 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#if 0
static NTSTATUS NTAPI static NTSTATUS NTAPI
SmpKnownDllsQueryRoutine(PWSTR ValueName, SmpKnownDllsQueryRoutine(PWSTR ValueName,
ULONG ValueType, ULONG ValueType,
@ -236,6 +237,6 @@ SmLoadKnownDlls(VOID)
return Status; return Status;
} }
#endif
/* EOF */ /* EOF */

View file

@ -12,6 +12,7 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#if 0
VOID NTAPI DisplayString(LPCWSTR lpwString) VOID NTAPI DisplayString(LPCWSTR lpwString)
{ {
UNICODE_STRING us; UNICODE_STRING us;
@ -39,5 +40,6 @@ VOID NTAPI PrintString (char* fmt, ...)
NtDisplayString(&UnicodeString); NtDisplayString(&UnicodeString);
RtlFreeUnicodeString (&UnicodeString); RtlFreeUnicodeString (&UnicodeString);
} }
#endif
/* EOF */ /* EOF */

View file

@ -35,7 +35,7 @@ SM_PORT_API SmApi [] =
SmInvalid, /* obsolete */ SmInvalid, /* obsolete */
SmInvalid, /* unknown */ SmInvalid, /* unknown */
SmExecPgm, /* smapiexec.c */ SmExecPgm, /* smapiexec.c */
SmQryInfo /* smapyqry.c */ SmInvalid /* smapyqry.c */
}; };
/* TODO: optimize this address computation (it should be done /* TODO: optimize this address computation (it should be done

View file

@ -263,23 +263,9 @@ SMAPI(SmExecPgm)
else else
{ {
/* /*
* OK, the definition is empty, but check * Badly defined subsystem. Check the registry!
* if it is the name of an embedded subsystem.
*/ */
if(0 == _wcsicmp(L"DEBUG", Name)) Request->SmHeader.Status = STATUS_NOT_FOUND;
{
/*
* Initialize the embedded DBGSS.
*/
Request->SmHeader.Status = SmInitializeDbgSs();
}
else
{
/*
* Badly defined subsystem. Check the registry!
*/
Request->SmHeader.Status = STATUS_NOT_FOUND;
}
} }
} else { } else {
/* It couldn't lookup the Name! */ /* It couldn't lookup the Name! */

View file

@ -12,7 +12,7 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#if 0
/********************************************************************** /**********************************************************************
* SmQryInfo/1 API * SmQryInfo/1 API
*/ */
@ -50,6 +50,6 @@ SMAPI(SmQryInfo)
} }
return Status; return Status;
} }
#endif
/* EOF */ /* EOF */

View file

@ -305,7 +305,7 @@ ExpLoadInitialProcess(IN PINIT_BUFFER InitBuffer,
SIZE_T Size; SIZE_T Size;
PWSTR p; PWSTR p;
UNICODE_STRING NullString = RTL_CONSTANT_STRING(L""); UNICODE_STRING NullString = RTL_CONSTANT_STRING(L"");
UNICODE_STRING SmssName, Environment, SystemDriveString, DebugString; UNICODE_STRING SmssName, DebugString;
PVOID EnvironmentPtr = NULL; PVOID EnvironmentPtr = NULL;
PRTL_USER_PROCESS_INFORMATION ProcessInformation; PRTL_USER_PROCESS_INFORMATION ProcessInformation;
PRTL_USER_PROCESS_PARAMETERS ProcessParams = NULL; PRTL_USER_PROCESS_PARAMETERS ProcessParams = NULL;
@ -436,28 +436,7 @@ ExpLoadInitialProcess(IN PINIT_BUFFER InitBuffer,
NtInitialUserProcessBuffer); NtInitialUserProcessBuffer);
/* Create the environment string */ /* Create the environment string */
RtlInitEmptyUnicodeString(&Environment, ProcessParams->Environment = SmpDefaultEnvironment;
ProcessParams->Environment,
(USHORT)Size);
/* Append the DLL path to it */
RtlAppendUnicodeToString(&Environment, L"Path=");
RtlAppendUnicodeStringToString(&Environment, &ProcessParams->DllPath);
RtlAppendUnicodeStringToString(&Environment, &NullString);
/* Create the system drive string */
SystemDriveString = SmpSystemRoot;
SystemDriveString.Length = 2 * sizeof(WCHAR);
/* Append it to the environment */
RtlAppendUnicodeToString(&Environment, L"SystemDrive=");
RtlAppendUnicodeStringToString(&Environment, &SystemDriveString);
RtlAppendUnicodeStringToString(&Environment, &NullString);
/* Append the system root to the environment */
RtlAppendUnicodeToString(&Environment, L"SystemRoot=");
RtlAppendUnicodeStringToString(&Environment, &SmpSystemRoot);
RtlAppendUnicodeStringToString(&Environment, &NullString);
/* Create SMSS process */ /* Create SMSS process */
SmssName = ProcessParams->ImagePathName; SmssName = ProcessParams->ImagePathName;