mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Added services.exe to boot sequence
svn path=/trunk/; revision=1547
This commit is contained in:
parent
300201892a
commit
03be08974e
2 changed files with 58 additions and 25 deletions
|
@ -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
|
||||
*
|
||||
|
@ -37,7 +37,6 @@
|
|||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
||||
HANDLE OutputHandle;
|
||||
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
@ -51,7 +50,7 @@ void PrintString (char* fmt,...)
|
|||
vsprintf(buffer, fmt, 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,
|
||||
FALSE,
|
||||
_T("SvcctrlStartEvent_A3725DX"));
|
||||
"SvcctrlStartEvent_A3725DX");
|
||||
if (hEvent == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -87,7 +86,6 @@ BOOL ScmCreateStartEvent(PHANDLE StartEvent)
|
|||
}
|
||||
|
||||
|
||||
//int main (int argc, char *argv[])
|
||||
int STDCALL
|
||||
WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
|
@ -96,9 +94,6 @@ WinMain(HINSTANCE hInstance,
|
|||
{
|
||||
HANDLE hScmStartEvent;
|
||||
|
||||
AllocConsole();
|
||||
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
PrintString("Service Control Manager\n");
|
||||
|
||||
/* Create start event */
|
||||
|
@ -113,20 +108,43 @@ WinMain(HINSTANCE hInstance,
|
|||
|
||||
/* 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");
|
||||
|
||||
/* Signal start event */
|
||||
SetEvent(hScmStartEvent);
|
||||
|
||||
/* FIXME: register event handler (used for system shutdown) */
|
||||
// SetConsoleCtrlHandler(...);
|
||||
|
||||
|
||||
/* FIXME: start auto-start services */
|
||||
// ScmAutoStartServices();
|
||||
|
||||
/* FIXME: more to do ? */
|
||||
|
||||
|
||||
PrintString("SERVICES: Running.\n");
|
||||
|
||||
for (;;)
|
||||
{
|
||||
NtYieldExecution();
|
||||
}
|
||||
|
||||
PrintString("SERVICES: Finished.\n");
|
||||
|
||||
ExitThread (0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -23,6 +23,19 @@
|
|||
|
||||
/* 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)
|
||||
{
|
||||
HANDLE ServicesInitEvent;
|
||||
|
@ -31,17 +44,14 @@ BOOLEAN StartServices(VOID)
|
|||
PROCESS_INFORMATION ProcessInformation;
|
||||
CHAR CommandLine[MAX_PATH];
|
||||
DWORD Count;
|
||||
|
||||
|
||||
/* Start the service control manager (services.exe) */
|
||||
OutputDebugString("WL: Running services.exe\n");
|
||||
// DbgPrint("WL: Running services.exe\n");
|
||||
PrintString("WL: Running services.exe\n");
|
||||
|
||||
GetSystemDirectory(CommandLine, MAX_PATH);
|
||||
strcat(CommandLine, "\\services.exe");
|
||||
|
||||
DbgPrint("WL: ");
|
||||
DbgPrint(CommandLine);
|
||||
DbgPrint("\n");
|
||||
PrintString("WL: %s\n", CommandLine);
|
||||
|
||||
StartupInfo.cb = sizeof(StartupInfo);
|
||||
StartupInfo.lpReserved = NULL;
|
||||
|
@ -56,28 +66,32 @@ BOOLEAN StartServices(VOID)
|
|||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
0, //DETACHED_PROCESS,
|
||||
DETACHED_PROCESS,
|
||||
NULL,
|
||||
NULL,
|
||||
&StartupInfo,
|
||||
&ProcessInformation);
|
||||
if (!Result)
|
||||
{
|
||||
DbgPrint("WL: Failed to execute services\n");
|
||||
return(FALSE);
|
||||
PrintString("WL: Failed to execute services\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* 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++)
|
||||
{
|
||||
Sleep(1000);
|
||||
|
||||
ServicesInitEvent = OpenEvent(EVENT_ALL_ACCESS, //SYNCHRONIZE,
|
||||
FALSE,
|
||||
"\\SvcctrlStartEvent_A3725DX");
|
||||
if (ServicesInitEvent)
|
||||
break;
|
||||
"SvcctrlStartEvent_A3725DX");
|
||||
if (ServicesInitEvent != NULL)
|
||||
{
|
||||
PrintString("WL: Opened start event\n");
|
||||
break;
|
||||
}
|
||||
PrintString("WL: Waiting for %ld seconds\n", Count+1);
|
||||
}
|
||||
|
||||
/* wait for event signalization */
|
||||
|
@ -86,7 +100,8 @@ BOOLEAN StartServices(VOID)
|
|||
CloseHandle(ServicesInitEvent);
|
||||
|
||||
DbgPrint("WL: Finished waiting for services\n");
|
||||
return(TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN StartLsass(VOID)
|
||||
|
@ -213,8 +228,8 @@ WinMain(HINSTANCE hInstance,
|
|||
AllocConsole();
|
||||
|
||||
/* start system processes (services.exe & lsass.exe) */
|
||||
#if 0
|
||||
StartServices();
|
||||
#if 0
|
||||
StartLsass();
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue