3 * initrun.c - Run all programs in the boot execution list
5 * ReactOS Operating System
7 * --------------------------------------------------------------------
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.
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.
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,
24 * --------------------------------------------------------------------
32 //HANDLE Children[2] = {0, 0}; /* csrss, winlogon */
35 /**********************************************************************
36 * SmpRunBootAppsQueryRoutine/6
38 static NTSTATUS STDCALL
39 SmpRunBootAppsQueryRoutine(PWSTR ValueName
,
46 WCHAR Description
[MAX_PATH
];
47 WCHAR ImageName
[MAX_PATH
];
48 WCHAR ImagePath
[MAX_PATH
];
49 WCHAR CommandLine
[MAX_PATH
];
54 DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName
, ValueType
, ValueLength
);
55 DPRINT("ValueData '%S'\n", (PWSTR
)ValueData
);
57 if (ValueType
!= REG_SZ
)
59 return(STATUS_SUCCESS
);
62 /* Extract the description */
63 p1
= wcschr((PWSTR
)ValueData
, L
' ');
64 len
= p1
- (PWSTR
)ValueData
;
65 memcpy(Description
,ValueData
, len
* sizeof(WCHAR
));
68 /* Extract the image name */
70 p2
= wcschr(p1
, L
' ');
75 memcpy(ImageName
, p1
, len
* sizeof(WCHAR
));
78 /* Extract the command line */
86 wcscpy(CommandLine
, p2
);
89 DPRINT("Running %S...\n", Description
);
90 DPRINT("ImageName: '%S'\n", ImageName
);
91 DPRINT("CommandLine: '%S'\n", CommandLine
);
93 /* initialize executable path */
94 wcscpy(ImagePath
, L
"\\SystemRoot\\system32\\");
95 wcscat(ImagePath
, ImageName
);
96 wcscat(ImagePath
, L
".exe");
98 /* Create NT process */
99 Status
= SmCreateUserProcess (ImagePath
,
103 if (!NT_SUCCESS(Status
))
105 DPRINT1("SM: %s: running '$S' failed (Status=0x%08lx)\n",
106 __FUNCTION__
, Status
);
108 return(STATUS_SUCCESS
);
112 /**********************************************************************
113 * SmRunBootApplications/0
117 * Run native applications listed in the registry.
120 * \Registry\Machine\SYSTEM\CurrentControlSet\Control\Session Manager
122 * Value (format: "<description> <executable> <command line>":
123 * BootExecute = "autocheck autochk *"
126 SmRunBootApplications(VOID
)
128 RTL_QUERY_REGISTRY_TABLE QueryTable
[2];
131 RtlZeroMemory(&QueryTable
,
134 QueryTable
[0].Name
= L
"BootExecute";
135 QueryTable
[0].QueryRoutine
= SmpRunBootAppsQueryRoutine
;
137 Status
= RtlQueryRegistryValues(RTL_REGISTRY_CONTROL
,
138 L
"\\Session Manager",
142 if (!NT_SUCCESS(Status
))
144 DPRINT1("%s: RtlQueryRegistryValues() failed! (Status %lx)\n",