1 added + 3 modified, total 4 files
reactos/lib/userenv
diff -N environment.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ environment.c 19 Mar 2004 12:40:49 -0000 1.1
@@ -0,0 +1,103 @@
+/* $Id: environment.c,v 1.1 2004/03/19 12:40:49 ekohl Exp $
+ *
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS system libraries
+ * FILE: lib/userenv/environment.c
+ * PURPOSE: User environment functions
+ * PROGRAMMER: Eric Kohl
+ */
+
+#define NTOS_MODE_USER
+#include <ntos.h>
+#include <windows.h>
+#include <userenv.h>
+
+#include "internal.h"
+
+
+static BOOL
+SetUserEnvironmentVariable (LPVOID *Environment,
+ LPWSTR lpName,
+ LPWSTR lpValue)
+{
+ UNICODE_STRING Name;
+ UNICODE_STRING Value;
+ NTSTATUS Status;
+
+ RtlInitUnicodeString (&Name, lpName);
+ RtlInitUnicodeString (&Value, lpValue);
+
+ Status = RtlSetEnvironmentVariable ((PWSTR*)Environment,
+ &Name,
+ &Value);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1 ("RtlSetEnvironmentVariable() failed (Status %lx)\n", Status);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+BOOL WINAPI
+CreateEnvironmentBlock (LPVOID *lpEnvironment,
+ HANDLE hToken,
+ BOOL bInherit)
+{
+ WCHAR Buffer[MAX_PATH];
+ DWORD Length;
+ NTSTATUS Status;
+
+ DPRINT1 ("CreateEnvironmentBlock() called\n");
+
+ if (lpEnvironment == NULL)
+ return FALSE;
+
+ Status = RtlCreateEnvironment ((BOOLEAN)bInherit,
+ (PWSTR*)lpEnvironment);
+ if (!NT_SUCCESS (Status))
+ {
+ DPRINT1 ("RtlCreateEnvironment() failed (Status %lx)\n", Status);
+ return FALSE;
+ }
+
+ /* Set 'COMPUTERNAME' variable */
+ Length = MAX_PATH;
+ if (GetComputerNameW (Buffer,
+ &Length))
+ {
+ SetUserEnvironmentVariable (lpEnvironment,
+ L"COMPUTERNAME",
+ Buffer);
+ }
+
+ /* Set 'USERPROFILE' variable */
+ Length = MAX_PATH;
+ if (GetUserProfileDirectoryW (hToken,
+ Buffer,
+ &Length))
+ {
+ SetUserEnvironmentVariable (lpEnvironment,
+ L"USERPROFILE",
+ Buffer);
+ }
+
+ return TRUE;
+}
+
+
+BOOL WINAPI
+DestroyEnvironmentBlock (LPVOID lpEnvironment)
+{
+ DPRINT ("DestroyEnvironmentBlock() called\n");
+
+ if (lpEnvironment == NULL)
+ return FALSE;
+
+ RtlDestroyEnvironment (lpEnvironment);
+
+ return TRUE;
+}
+
+/* EOF */
reactos/lib/userenv
diff -u -r1.4 -r1.5
--- makefile 16 Jan 2004 15:31:53 -0000 1.4
+++ makefile 19 Mar 2004 12:40:49 -0000 1.5
@@ -15,7 +15,8 @@
TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a
-TARGET_OBJECTS = directory.o profile.o misc.o registry.o setup.o userenv.o
+TARGET_OBJECTS = directory.o environment.o profile.o misc.o registry.o \
+ setup.o userenv.o
DEP_OBJECTS = $(TARGET_OBJECTS)
reactos/lib/userenv
diff -u -r1.4 -r1.5
--- userenv.def 13 Mar 2004 20:49:07 -0000 1.4
+++ userenv.def 19 Mar 2004 12:40:49 -0000 1.5
@@ -1,11 +1,13 @@
LIBRARY userenv.dll
EXPORTS
InitializeProfiles@0 @100 NONAME
+CreateUserProfileW@8 @110 NONAME
+CreateEnvironmentBlock@12
+DestroyEnvironmentBlock@4
GetAllUsersProfileDirectoryW@8
GetDefaultUserProfileDirectoryW@8
GetProfilesDirectoryW@8
GetUserProfileDirectoryW@12
-CreateUserProfileW@8
LoadUserProfileW@8
UnloadUserProfile@8
;EOF
reactos/lib/userenv
diff -u -r1.4 -r1.5
--- userenv.edf 13 Mar 2004 20:49:07 -0000 1.4
+++ userenv.edf 19 Mar 2004 12:40:49 -0000 1.5
@@ -1,11 +1,13 @@
LIBRARY userenv.dll
EXPORTS
InitializeProfiles=InitializeProfiles@0 @100 NONAME
+CreateUserProfileW=CreateUserProfileW@8 @110 NONAME
+CreateEnvironmentBlock=CreateEnvironmentBlock@12
+DestroyEnvironmentBlock=DestroyEnvironmentBlock@4
GetAllUsersProfileDirectoryW=GetAllUsersProfileDirectoryW@8
GetDefaultUserProfileDirectoryW=GetDefaultUserProfileDirectoryW@8
GetProfilesDirectoryW=GetProfilesDirectoryW@8
GetUserProfileDirectoryW=GetUserProfileDirectoryW@12
-CreateUserProfileW=CreateUserProfileW@8
LoadUserProfileW=LoadUserProfileW@8
UnloadUserProfile=UnloadUserProfile@8
;EOF
CVSspam 0.2.8