Commit in reactos/subsys/system/winlogon on MAIN
makefile+3-31.8 -> 1.9
winlogon.c+56-151.27 -> 1.28
+59-18
2 modified files
Load user profile and create user environment upon user logon.

reactos/subsys/system/winlogon
makefile 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- makefile	1 Dec 2003 18:21:04 -0000	1.8
+++ makefile	20 Mar 2004 15:58:16 -0000	1.9
@@ -1,4 +1,4 @@
-# $Id: makefile,v 1.8 2003/12/01 18:21:04 weiden Exp $
+# $Id: makefile,v 1.9 2004/03/20 15:58:16 ekohl Exp $
 
 PATH_TO_TOP = ../../..
 
@@ -10,9 +10,9 @@
 
 TARGET_INSTALLDIR = system32
 
-TARGET_SDKLIBS = ntdll.a kernel32.a user32.a secur32.a
+TARGET_SDKLIBS = ntdll.a kernel32.a user32.a advapi32.a userenv.a secur32.a
 
-TARGET_OBJECTS = $(TARGET_NAME).o setup.o wlx.o
+TARGET_OBJECTS = setup.o winlogon.o wlx.o
 
 TARGET_CFLAGS = -Wall -Werror -DUNICODE -I./ -I../../../include
 

reactos/subsys/system/winlogon
winlogon.c 1.27 -> 1.28
diff -u -r1.27 -r1.28
--- winlogon.c	9 Mar 2004 15:08:12 -0000	1.27
+++ winlogon.c	20 Mar 2004 15:58:16 -0000	1.28
@@ -1,4 +1,4 @@
-/* $Id: winlogon.c,v 1.27 2004/03/09 15:08:12 ekohl Exp $
+/* $Id: winlogon.c,v 1.28 2004/03/20 15:58:16 ekohl Exp $
  * 
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -11,11 +11,13 @@
 
 /* INCLUDES *****************************************************************/
 
+#define NTOS_MODE_USER
 #include <ntos.h>
 #include <windows.h>
 #include <stdio.h>
 #include <ntsecapi.h>
 #include <wchar.h>
+#include <userenv.h>
 
 #include "setup.h"
 #include "winlogon.h"
@@ -285,7 +287,7 @@
 */
 
 #if SUPPORT_CONSOLESTART
-static BOOL StartIntoGUI(void)
+static BOOL StartIntoGUI(VOID)
 {
   HANDLE WinLogonKey;
   DWORD Type, Size, Value;
@@ -365,7 +367,9 @@
   WCHAR CommandLine[MAX_PATH];
   WCHAR CurrentDirectory[MAX_PATH];
   HANDLE hToken;
+  PROFILEINFOW ProfileInfo;
   BOOL Result;
+  LPVOID lpEnvironment = NULL;
 
   Result = LogonUserW (Name,
 		       NULL,
@@ -375,11 +379,39 @@
 		       &hToken);
   if (!Result)
     {
-      DbgPrint ("WL: LogonUserW failed\n");
+      DbgPrint ("WL: LogonUserW() failed\n");
+      RtlDestroyEnvironment (lpEnvironment);
       return FALSE;
     }
 
-  GetWindowsDirectoryW(CurrentDirectory, MAX_PATH);
+  /* Load the user profile */
+  ProfileInfo.dwSize = sizeof(PROFILEINFOW);
+  ProfileInfo.dwFlags = 0;
+  ProfileInfo.lpUserName = Name;
+  ProfileInfo.lpProfilePath = NULL;
+  ProfileInfo.lpDefaultPath = NULL;
+  ProfileInfo.lpServerName = NULL;
+  ProfileInfo.lpPolicyPath = NULL;
+  ProfileInfo.hProfile = NULL;
+
+  if (!LoadUserProfileW (hToken,
+			 &ProfileInfo))
+    {
+      DbgPrint ("WL: LoadUserProfileW() failed\n");
+      CloseHandle (hToken);
+      RtlDestroyEnvironment (lpEnvironment);
+      return FALSE;
+    }
+
+  if (!CreateEnvironmentBlock (&lpEnvironment,
+			       hToken,
+			       TRUE))
+    {
+      DbgPrint ("WL: CreateEnvironmentBlock() failed\n");
+      return FALSE;
+    }
+
+  GetWindowsDirectoryW (CurrentDirectory, MAX_PATH);
 
   StartupInfo.cb = sizeof(StartupInfo);
   StartupInfo.lpReserved = NULL;
@@ -395,24 +427,33 @@
 				 NULL,
 				 NULL,
 				 FALSE,
-				 CREATE_NEW_CONSOLE,
-				 NULL,
+				 CREATE_NEW_CONSOLE,// | CREATE_UNICODE_ENVIRONMENT,
+				 lpEnvironment, // NULL,
 				 CurrentDirectory,
 				 &StartupInfo,
 				 &ProcessInformation);
-   if (!Result)
-     {
-	DbgPrint ("WL: Failed to execute user shell %s\n", CommandLine);
-	CloseHandle (hToken);
-	return FALSE;
-     }
+  if (!Result)
+    {
+      DbgPrint ("WL: Failed to execute user shell %s\n", CommandLine);
+      UnloadUserProfile (hToken,
+			 ProfileInfo.hProfile);
+      CloseHandle (hToken);
+      DestroyEnvironmentBlock (lpEnvironment);
+      return FALSE;
+    }
 
-   WaitForSingleObject (ProcessInformation.hProcess, INFINITE);
-   CloseHandle (ProcessInformation.hProcess);
-   CloseHandle (ProcessInformation.hThread);
+  WaitForSingleObject (ProcessInformation.hProcess, INFINITE);
+  CloseHandle (ProcessInformation.hProcess);
+  CloseHandle (ProcessInformation.hThread);
+
+  /* Unload user profile */
+  UnloadUserProfile (hToken,
+		     ProfileInfo.hProfile);
 
   CloseHandle (hToken);
 
+  RtlDestroyEnvironment (lpEnvironment);
+
   return TRUE;
 }
 #endif
CVSspam 0.2.8