Added services.exe to boot sequence

svn path=/trunk/; revision=1547
This commit is contained in:
Eric Kohl 2001-01-20 18:40:27 +00:00
parent 300201892a
commit 03be08974e
2 changed files with 58 additions and 25 deletions

View file

@ -1,4 +1,4 @@
/* $Id: services.c,v 1.1 2000/12/05 02:38:08 ekohl Exp $ /* $Id: services.c,v 1.2 2001/01/20 18:39:35 ekohl Exp $
* *
* service control manager * service control manager
* *
@ -37,7 +37,6 @@
/* GLOBALS ******************************************************************/ /* GLOBALS ******************************************************************/
HANDLE OutputHandle;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@ -51,7 +50,7 @@ void PrintString (char* fmt,...)
vsprintf(buffer, fmt, ap); vsprintf(buffer, fmt, ap);
va_end(ap); va_end(ap);
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL); OutputDebugString(buffer);
} }
@ -69,7 +68,7 @@ BOOL ScmCreateStartEvent(PHANDLE StartEvent)
{ {
hEvent = OpenEvent(EVENT_ALL_ACCESS, hEvent = OpenEvent(EVENT_ALL_ACCESS,
FALSE, FALSE,
_T("SvcctrlStartEvent_A3725DX")); "SvcctrlStartEvent_A3725DX");
if (hEvent == NULL) if (hEvent == NULL)
{ {
return FALSE; return FALSE;
@ -87,7 +86,6 @@ BOOL ScmCreateStartEvent(PHANDLE StartEvent)
} }
//int main (int argc, char *argv[])
int STDCALL int STDCALL
WinMain(HINSTANCE hInstance, WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, HINSTANCE hPrevInstance,
@ -96,9 +94,6 @@ WinMain(HINSTANCE hInstance,
{ {
HANDLE hScmStartEvent; HANDLE hScmStartEvent;
AllocConsole();
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
PrintString("Service Control Manager\n"); PrintString("Service Control Manager\n");
/* Create start event */ /* Create start event */
@ -113,20 +108,43 @@ WinMain(HINSTANCE hInstance,
/* FIXME: more initialization */ /* FIXME: more initialization */
/* FIXME: create service database */
// ScmCreateServiceDB();
/* FIXME: update service database */
// ScmGetBootAndSystemDriverState();
/* FIXME: create pipe "\Pipe\Ntsvcs" */
/* FIXME: create listener thread for pipe */
/* FIXME: register process as service process */
// RegisterServiceProcess();
PrintString("SERVICES: Initialized.\n"); PrintString("SERVICES: Initialized.\n");
/* Signal start event */ /* Signal start event */
SetEvent(hScmStartEvent); SetEvent(hScmStartEvent);
/* FIXME: register event handler (used for system shutdown) */
// SetConsoleCtrlHandler(...);
/* FIXME: start auto-start services */
// ScmAutoStartServices();
/* FIXME: more to do ? */ /* FIXME: more to do ? */
PrintString("SERVICES: Running.\n"); PrintString("SERVICES: Running.\n");
for (;;)
{
NtYieldExecution();
}
PrintString("SERVICES: Finished.\n");
ExitThread (0); ExitThread (0);
return 0; return 0;
} }

View file

@ -1,4 +1,4 @@
/* $Id: winlogon.c,v 1.3 2000/12/08 00:45:04 ekohl Exp $ /* $Id: winlogon.c,v 1.4 2001/01/20 18:40:27 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -23,6 +23,19 @@
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
void PrintString (char* fmt,...)
{
char buffer[512];
va_list ap;
va_start(ap, fmt);
vsprintf(buffer, fmt, ap);
va_end(ap);
OutputDebugString(buffer);
}
BOOLEAN StartServices(VOID) BOOLEAN StartServices(VOID)
{ {
HANDLE ServicesInitEvent; HANDLE ServicesInitEvent;
@ -31,17 +44,14 @@ BOOLEAN StartServices(VOID)
PROCESS_INFORMATION ProcessInformation; PROCESS_INFORMATION ProcessInformation;
CHAR CommandLine[MAX_PATH]; CHAR CommandLine[MAX_PATH];
DWORD Count; DWORD Count;
/* Start the service control manager (services.exe) */ /* Start the service control manager (services.exe) */
OutputDebugString("WL: Running services.exe\n"); PrintString("WL: Running services.exe\n");
// DbgPrint("WL: Running services.exe\n");
GetSystemDirectory(CommandLine, MAX_PATH); GetSystemDirectory(CommandLine, MAX_PATH);
strcat(CommandLine, "\\services.exe"); strcat(CommandLine, "\\services.exe");
DbgPrint("WL: "); PrintString("WL: %s\n", CommandLine);
DbgPrint(CommandLine);
DbgPrint("\n");
StartupInfo.cb = sizeof(StartupInfo); StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.lpReserved = NULL; StartupInfo.lpReserved = NULL;
@ -56,28 +66,32 @@ BOOLEAN StartServices(VOID)
NULL, NULL,
NULL, NULL,
FALSE, FALSE,
0, //DETACHED_PROCESS, DETACHED_PROCESS,
NULL, NULL,
NULL, NULL,
&StartupInfo, &StartupInfo,
&ProcessInformation); &ProcessInformation);
if (!Result) if (!Result)
{ {
DbgPrint("WL: Failed to execute services\n"); PrintString("WL: Failed to execute services\n");
return(FALSE); return FALSE;
} }
/* wait for event creation (by SCM) for max. 20 seconds */ /* wait for event creation (by SCM) for max. 20 seconds */
DbgPrint("WL: Waiting for services\n"); PrintString("WL: Waiting for services\n");
for (Count = 0; Count < 20; Count++) for (Count = 0; Count < 20; Count++)
{ {
Sleep(1000); Sleep(1000);
ServicesInitEvent = OpenEvent(EVENT_ALL_ACCESS, //SYNCHRONIZE, ServicesInitEvent = OpenEvent(EVENT_ALL_ACCESS, //SYNCHRONIZE,
FALSE, FALSE,
"\\SvcctrlStartEvent_A3725DX"); "SvcctrlStartEvent_A3725DX");
if (ServicesInitEvent) if (ServicesInitEvent != NULL)
break; {
PrintString("WL: Opened start event\n");
break;
}
PrintString("WL: Waiting for %ld seconds\n", Count+1);
} }
/* wait for event signalization */ /* wait for event signalization */
@ -86,7 +100,8 @@ BOOLEAN StartServices(VOID)
CloseHandle(ServicesInitEvent); CloseHandle(ServicesInitEvent);
DbgPrint("WL: Finished waiting for services\n"); DbgPrint("WL: Finished waiting for services\n");
return(TRUE);
return TRUE;
} }
BOOLEAN StartLsass(VOID) BOOLEAN StartLsass(VOID)
@ -213,8 +228,8 @@ WinMain(HINSTANCE hInstance,
AllocConsole(); AllocConsole();
/* start system processes (services.exe & lsass.exe) */ /* start system processes (services.exe & lsass.exe) */
#if 0
StartServices(); StartServices();
#if 0
StartLsass(); StartLsass();
#endif #endif