2 * PROJECT: ReactOS Session Manager
3 * LICENSE: GPL v2 or later - See COPYING in the top level directory
4 * FILE: base/system/smss/initrun.c
5 * PURPOSE: Run all programs in the boot execution list.
6 * PROGRAMMERS: ReactOS Development Team
9 /* INCLUDES ******************************************************************/
15 //HANDLE Children[2] = {0, 0}; /* csrss, winlogon */
18 /**********************************************************************
19 * SmpRunBootAppsQueryRoutine/6
22 SmpRunBootAppsQueryRoutine(PWSTR ValueName
,
29 WCHAR Description
[MAX_PATH
];
30 WCHAR ImageName
[MAX_PATH
];
31 WCHAR ImagePath
[MAX_PATH
];
32 WCHAR CommandLine
[MAX_PATH
];
37 DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName
, ValueType
, ValueLength
);
38 DPRINT("ValueData '%S'\n", (PWSTR
)ValueData
);
40 if (ValueType
!= REG_SZ
)
42 return(STATUS_SUCCESS
);
45 /* Extract the description */
46 p1
= wcschr((PWSTR
)ValueData
, L
' ');
47 len
= p1
- (PWSTR
)ValueData
;
48 memcpy(Description
,ValueData
, len
* sizeof(WCHAR
));
51 /* Extract the image name */
53 p2
= wcschr(p1
, L
' ');
58 memcpy(ImageName
, p1
, len
* sizeof(WCHAR
));
61 /* Extract the command line */
69 wcscpy(CommandLine
, p2
);
72 DPRINT("Running %S...\n", Description
);
73 DPRINT("ImageName: '%S'\n", ImageName
);
74 DPRINT("CommandLine: '%S'\n", CommandLine
);
76 /* initialize executable path */
77 wcscpy(ImagePath
, L
"\\SystemRoot\\system32\\");
78 wcscat(ImagePath
, ImageName
);
79 wcscat(ImagePath
, L
".exe");
81 /* Create NT process */
82 Status
= SmCreateUserProcess (ImagePath
,
86 if (!NT_SUCCESS(Status
))
88 DPRINT1("SM: %s: running '%S' failed (Status=0x%08lx)\n",
89 __FUNCTION__
, ImagePath
, Status
);
91 return(STATUS_SUCCESS
);
95 /**********************************************************************
96 * SmRunBootApplications/0
100 * Run native applications listed in the registry.
103 * \Registry\Machine\SYSTEM\CurrentControlSet\Control\Session Manager
105 * Value (format: "<description> <executable> <command line>":
106 * BootExecute = "autocheck autochk *"
109 SmRunBootApplications(VOID
)
111 RTL_QUERY_REGISTRY_TABLE QueryTable
[2];
114 RtlZeroMemory(&QueryTable
,
117 QueryTable
[0].Name
= L
"BootExecute";
118 QueryTable
[0].QueryRoutine
= SmpRunBootAppsQueryRoutine
;
120 Status
= RtlQueryRegistryValues(RTL_REGISTRY_CONTROL
,
121 L
"\\Session Manager",
125 if (!NT_SUCCESS(Status
))
127 DPRINT1("%s: RtlQueryRegistryValues() failed! (Status %lx)\n",