* Sync with recent trunk (r52637).
[reactos.git] / base / system / smss / init.c
1 /*
2 * PROJECT: ReactOS Session Manager
3 * LICENSE: GPL v2 or later - See COPYING in the top level directory
4 * FILE: base/system/smss/init.c
5 * PURPOSE: Initialization.
6 * PROGRAMMERS: ReactOS Development Team
7 */
8
9 /* INCLUDES ******************************************************************/
10 #include "smss.h"
11
12 #define NDEBUG
13 #include <debug.h>
14
15
16 /* FUNCTIONS ****************************************************************/
17
18 typedef NTSTATUS (* SM_INIT_ROUTINE)(VOID);
19
20 struct {
21 BOOL Required;
22 SM_INIT_ROUTINE EntryPoint;
23 PCHAR ErrorMessage;
24 } InitRoutine [] = {
25 {TRUE, SmCreateHeap, "create private heap, aborting"},
26 {TRUE, SmCreateObjectDirectories, "create object directories"},
27 {TRUE, SmCreateApiPort, "create \\SmApiPort"},
28 {TRUE, SmCreateEnvironment, "create the system environment"},
29 {TRUE, SmSetEnvironmentVariables, "set system environment variables"},
30 {TRUE, SmInitDosDevices, "create dos device links"},
31 {TRUE, SmRunBootApplications, "run boot applications"},
32 {TRUE, SmProcessFileRenameList, "process the file rename list"},
33 {FALSE, SmUpdateEnvironment, "update environment variables"},
34 {FALSE, SmLoadKnownDlls, "preload system DLLs"},
35 {TRUE, SmCreatePagingFiles, "create paging files"},
36 {TRUE, SmInitializeRegistry, "initialize the registry"},
37 {TRUE, SmInitializeClientManagement, "initialize client management"},
38 {TRUE, SmLoadSubsystems, "load subsystems"}
39 };
40
41 NTSTATUS
42 InitSessionManager(VOID)
43 {
44 UINT i = 0;
45 NTSTATUS Status = STATUS_SUCCESS;
46
47 for (i=0; i < (sizeof InitRoutine / sizeof InitRoutine[0]); i++)
48 {
49 Status = InitRoutine[i].EntryPoint();
50 if(!NT_SUCCESS(Status))
51 {
52 DPRINT1("SM: %s: failed to %s (Status=%lx)\n",
53 __FUNCTION__,
54 InitRoutine[i].ErrorMessage,
55 Status);
56 if (InitRoutine[i].Required)
57 {
58 return(Status);
59 }
60 }
61 }
62 return(STATUS_SUCCESS);
63 }
64
65 /* EOF */