mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 05:52:57 +00:00
Create a branch for header work.
svn path=/branches/header-work/; revision=45691
This commit is contained in:
parent
14fe274b1c
commit
9ea495ba33
19538 changed files with 0 additions and 1063950 deletions
119
base/system/smss/initenv.c
Normal file
119
base/system/smss/initenv.c
Normal file
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Session Manager
|
||||
* LICENSE: GPL v2 or later - See COPYING in the top level directory
|
||||
* FILE: base/system/smss/initenv.c
|
||||
* PURPOSE: Environment initialization.
|
||||
* PROGRAMMERS: ReactOS Development Team
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
#include "smss.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* GLOBALS */
|
||||
|
||||
PWSTR SmSystemEnvironment = NULL;
|
||||
|
||||
|
||||
/* FUNCTIONS */
|
||||
|
||||
NTSTATUS
|
||||
SmCreateEnvironment(VOID)
|
||||
{
|
||||
return RtlCreateEnvironment(FALSE, &SmSystemEnvironment);
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
SmpSetEnvironmentVariable(IN PVOID Context,
|
||||
IN PWSTR ValueName,
|
||||
IN PVOID ValueData)
|
||||
{
|
||||
UNICODE_STRING EnvVariable;
|
||||
UNICODE_STRING EnvValue;
|
||||
|
||||
RtlInitUnicodeString(&EnvVariable,
|
||||
ValueName);
|
||||
RtlInitUnicodeString(&EnvValue,
|
||||
(PWSTR)ValueData);
|
||||
return RtlSetEnvironmentVariable(Context,
|
||||
&EnvVariable,
|
||||
&EnvValue);
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS NTAPI
|
||||
SmpEnvironmentQueryRoutine(IN PWSTR ValueName,
|
||||
IN ULONG ValueType,
|
||||
IN PVOID ValueData,
|
||||
IN ULONG ValueLength,
|
||||
IN PVOID Context,
|
||||
IN PVOID EntryContext)
|
||||
{
|
||||
DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
|
||||
|
||||
if (ValueType != REG_SZ && ValueType != REG_EXPAND_SZ)
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
DPRINT("ValueData '%S'\n", (PWSTR)ValueData);
|
||||
return SmpSetEnvironmentVariable(Context,ValueName,ValueData);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
SmSetEnvironmentVariables(VOID)
|
||||
{
|
||||
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
|
||||
WCHAR ValueBuffer[MAX_PATH];
|
||||
NTSTATUS Status;
|
||||
|
||||
/*
|
||||
* The following environment variables must be set prior to reading
|
||||
* other variables from the registry.
|
||||
*
|
||||
* Variables (example):
|
||||
* SystemRoot = "C:\reactos"
|
||||
* SystemDrive = "C:"
|
||||
*/
|
||||
|
||||
/* Copy system root into value buffer */
|
||||
wcscpy(ValueBuffer,
|
||||
SharedUserData->NtSystemRoot);
|
||||
|
||||
/* Set SystemRoot = "C:\reactos" */
|
||||
SmpSetEnvironmentVariable(&SmSystemEnvironment, L"SystemRoot", ValueBuffer);
|
||||
|
||||
/* Cut off trailing path */
|
||||
ValueBuffer[2] = 0;
|
||||
|
||||
/* Set SystemDrive = "C:" */
|
||||
SmpSetEnvironmentVariable(&SmSystemEnvironment, L"SystemDrive", ValueBuffer);
|
||||
|
||||
/* Read system environment from the registry. */
|
||||
RtlZeroMemory(&QueryTable,
|
||||
sizeof(QueryTable));
|
||||
|
||||
QueryTable[0].QueryRoutine = SmpEnvironmentQueryRoutine;
|
||||
|
||||
Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,
|
||||
L"Session Manager\\Environment",
|
||||
QueryTable,
|
||||
&SmSystemEnvironment,
|
||||
SmSystemEnvironment);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* Set environment variables from registry
|
||||
*/
|
||||
NTSTATUS
|
||||
SmUpdateEnvironment(VOID)
|
||||
{
|
||||
/* TODO */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
Loading…
Add table
Add a link
Reference in a new issue