Add information letting us know creation deletion of services has worked.
[reactos.git] / reactos / subsys / smss / init.c
1 /* $Id$
2 *
3 * init.c - Session Manager initialization
4 *
5 * ReactOS Operating System
6 *
7 * --------------------------------------------------------------------
8 *
9 * This software is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * This software is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this software; see the file COPYING.LIB. If not, write
21 * to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
22 * MA 02139, USA.
23 *
24 * --------------------------------------------------------------------
25 */
26 #include "smss.h"
27
28 #define NDEBUG
29 #include <debug.h>
30
31
32 /* FUNCTIONS ****************************************************************/
33
34 static NTSTATUS
35 SmpSignalInitEvent(VOID)
36 {
37 NTSTATUS Status = STATUS_SUCCESS;
38 OBJECT_ATTRIBUTES ObjectAttributes = {0};
39 UNICODE_STRING EventName ={0};
40 HANDLE ReactOSInitEvent = (HANDLE) 0;
41
42 RtlInitUnicodeString (& EventName, L"\\ReactOSInitDone");
43 InitializeObjectAttributes(&ObjectAttributes,
44 & EventName,
45 0,
46 0,
47 NULL);
48 Status = NtOpenEvent(&ReactOSInitEvent,
49 EVENT_ALL_ACCESS,
50 &ObjectAttributes);
51 if (NT_SUCCESS(Status))
52 {
53 LARGE_INTEGER Timeout;
54 /* This will cause the boot screen image to go away (if displayed) */
55 NtPulseEvent(ReactOSInitEvent, NULL);
56
57 /* Wait for the display mode to be changed (if in graphics mode) */
58 Timeout.QuadPart = -50000000LL; /* 5 second timeout */
59 NtWaitForSingleObject(ReactOSInitEvent, FALSE, &Timeout);
60
61 NtClose(ReactOSInitEvent);
62 }
63 else
64 {
65 /* We don't really care if this fails */
66 DPRINT1("SM: Failed to open ReactOS init notification event\n");
67 }
68 return Status;
69 }
70
71 typedef NTSTATUS (* SM_INIT_ROUTINE)(VOID);
72
73 struct {
74 BOOL Required;
75 SM_INIT_ROUTINE EntryPoint;
76 PCHAR ErrorMessage;
77 } InitRoutine [] = {
78 {TRUE, SmCreateHeap, "create private heap, aborting"},
79 {TRUE, SmCreateObjectDirectories, "create object directories"},
80 {TRUE, SmCreateApiPort, "create \\SmApiPort"},
81 {TRUE, SmCreateEnvironment, "create the system environment"},
82 {TRUE, SmSetEnvironmentVariables, "set system environment variables"},
83 {TRUE, SmInitDosDevices, "create dos device links"},
84 {TRUE, SmRunBootApplications, "run boot applications"},
85 {TRUE, SmProcessFileRenameList, "process the file rename list"},
86 {FALSE, SmLoadKnownDlls, "preload system DLLs"},
87 {TRUE, SmCreatePagingFiles, "create paging files"},
88 {TRUE, SmInitializeRegistry, "initialize the registry"},
89 {FALSE, SmUpdateEnvironment, "update environment variables"},
90 {TRUE, SmInitializeClientManagement, "initialize client management"},
91 {TRUE, SmLoadSubsystems, "load subsystems"},
92 {FALSE, SmpSignalInitEvent, "open ReactOS init notification event"},
93 };
94
95 NTSTATUS
96 InitSessionManager(VOID)
97 {
98 UINT i = 0;
99 NTSTATUS Status = STATUS_SUCCESS;
100
101 for (i=0; i < (sizeof InitRoutine / sizeof InitRoutine[0]); i++)
102 {
103 Status = InitRoutine[i].EntryPoint();
104 if(!NT_SUCCESS(Status))
105 {
106 DPRINT1("SM: %s: failed to %s (Status=%lx)\n",
107 __FUNCTION__,
108 InitRoutine[i].ErrorMessage,
109 Status);
110 if (InitRoutine[i].Required)
111 {
112 return(Status);
113 }
114 }
115 }
116 return(STATUS_SUCCESS);
117 }
118
119 /* EOF */