svn propset {keyword, eol-type}
[reactos.git] / reactos / subsys / smss / initenv.c
index 97341d3..28c4160 100644 (file)
-/* $Id: init.c 13449 2005-02-06 21:55:07Z ea $\r
- *\r
- * initenv.c - Environment initialization\r
- * \r
- * ReactOS Operating System\r
- * \r
- * --------------------------------------------------------------------\r
- *\r
- * This software is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License as\r
- * published by the Free Software Foundation; either version 2 of the\r
- * License, or (at your option) any later version.\r
- *\r
- * This software is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
- * General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this software; see the file COPYING.LIB. If not, write\r
- * to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,\r
- * MA 02139, USA.  \r
- *\r
- * --------------------------------------------------------------------\r
- */\r
-\r
-#include "smss.h"\r
-\r
-#define NDEBUG\r
-#include <debug.h>\r
-\r
-/* GLOBALS */\r
-\r
-PWSTR SmSystemEnvironment = NULL;\r
-\r
-\r
-/* FUNCTIONS */\r
-\r
-NTSTATUS \r
-SmCreateEnvironment(VOID)\r
-{\r
-  return RtlCreateEnvironment(FALSE, &SmSystemEnvironment);\r
-}\r
-\r
-\r
-static NTSTATUS\r
-SmpSetEnvironmentVariable(PVOID Context,\r
-                         PWSTR ValueName,\r
-                         PVOID ValueData)\r
-{\r
-  UNICODE_STRING EnvVariable;\r
-  UNICODE_STRING EnvValue;\r
-\r
-  RtlInitUnicodeString(&EnvVariable,\r
-                      ValueName);\r
-  RtlInitUnicodeString(&EnvValue,\r
-                      (PWSTR)ValueData);\r
-  RtlSetEnvironmentVariable(Context,\r
-                           &EnvVariable,\r
-                           &EnvValue);\r
-\r
-  return(STATUS_SUCCESS);\r
-}\r
-\r
-\r
-static NTSTATUS STDCALL\r
-SmpEnvironmentQueryRoutine(PWSTR ValueName,\r
-                         ULONG ValueType,\r
-                         PVOID ValueData,\r
-                         ULONG ValueLength,\r
-                         PVOID Context,\r
-                         PVOID EntryContext)\r
-{\r
-  DPRINT("ValueName '%S'  Type %lu  Length %lu\n", ValueName, ValueType, ValueLength);\r
-  DPRINT("ValueData '%S'\n", (PWSTR)ValueData);\r
-\r
-  if (ValueType != REG_SZ)\r
-    {\r
-      return(STATUS_SUCCESS);\r
-    }\r
-  return SmpSetEnvironmentVariable(Context,ValueName,ValueData);\r
-}\r
-\r
-\r
-NTSTATUS\r
-SmSetEnvironmentVariables(VOID)\r
-{\r
-  RTL_QUERY_REGISTRY_TABLE QueryTable[2];\r
-  WCHAR ValueBuffer[MAX_PATH];\r
-  NTSTATUS Status;\r
-\r
-  /*\r
-   * The following environment variables must be set prior to reading\r
-   * other variables from the registry.\r
-   *\r
-   * Variables (example):\r
-   *    SystemRoot = "C:\reactos"\r
-   *    SystemDrive = "C:"\r
-   */\r
-\r
-  /* Copy system root into value buffer */\r
-  wcscpy(ValueBuffer,\r
-        SharedUserData->NtSystemRoot);\r
-\r
-  /* Set SystemRoot = "C:\reactos" */\r
-  SmpSetEnvironmentVariable(&SmSystemEnvironment,L"SystemRoot",ValueBuffer);\r
-\r
-  /* Cut off trailing path */\r
-  ValueBuffer[2] = 0;\r
-\r
-  /* Set SystemDrive = "C:" */\r
-  SmpSetEnvironmentVariable(&SmSystemEnvironment,L"SystemDrive",ValueBuffer);\r
-\r
-  /* Read system environment from the registry. */\r
-  RtlZeroMemory(&QueryTable,\r
-               sizeof(QueryTable));\r
-\r
-  QueryTable[0].QueryRoutine = SmpEnvironmentQueryRoutine;\r
-\r
-  Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,\r
-                                 L"\\Session Manager\\Environment",\r
-                                 QueryTable,\r
-                                 &SmSystemEnvironment,\r
-                                 SmSystemEnvironment);\r
-\r
-  return(Status);\r
-}\r
-\r
-/**********************************************************************\r
- *  Set environment variables from registry\r
- */\r
-NTSTATUS\r
-SmUpdateEnvironment(VOID)\r
-{\r
-       /* TODO */\r
-       return STATUS_SUCCESS;\r
-}\r
-\r
-/* EOF */\r
+/* $Id$
+ *
+ * initenv.c - Environment initialization
+ * 
+ * ReactOS Operating System
+ * 
+ * --------------------------------------------------------------------
+ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; see the file COPYING.LIB. If not, write
+ * to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
+ * MA 02139, USA.  
+ *
+ * --------------------------------------------------------------------
+ */
+
+#include "smss.h"
+
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS */
+
+PWSTR SmSystemEnvironment = NULL;
+
+
+/* FUNCTIONS */
+
+NTSTATUS 
+SmCreateEnvironment(VOID)
+{
+  return RtlCreateEnvironment(FALSE, &SmSystemEnvironment);
+}
+
+
+static NTSTATUS
+SmpSetEnvironmentVariable(PVOID Context,
+                         PWSTR ValueName,
+                         PVOID ValueData)
+{
+  UNICODE_STRING EnvVariable;
+  UNICODE_STRING EnvValue;
+
+  RtlInitUnicodeString(&EnvVariable,
+                      ValueName);
+  RtlInitUnicodeString(&EnvValue,
+                      (PWSTR)ValueData);
+  RtlSetEnvironmentVariable(Context,
+                           &EnvVariable,
+                           &EnvValue);
+
+  return(STATUS_SUCCESS);
+}
+
+
+static NTSTATUS STDCALL
+SmpEnvironmentQueryRoutine(PWSTR ValueName,
+                         ULONG ValueType,
+                         PVOID ValueData,
+                         ULONG ValueLength,
+                         PVOID Context,
+                         PVOID EntryContext)
+{
+  DPRINT("ValueName '%S'  Type %lu  Length %lu\n", ValueName, ValueType, ValueLength);
+  DPRINT("ValueData '%S'\n", (PWSTR)ValueData);
+
+  if (ValueType != REG_SZ)
+    {
+      return(STATUS_SUCCESS);
+    }
+  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 */