2005-01-06 13:58:04 +00:00
|
|
|
/* $Id$
|
1999-09-05 12:29:50 +00:00
|
|
|
*
|
|
|
|
* smss.c - Session Manager
|
|
|
|
*
|
|
|
|
* ReactOS Operating System
|
|
|
|
*
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* This software is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This software is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this software; see the file COPYING.LIB. If not, write
|
|
|
|
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
|
|
|
|
* MA 02139, USA.
|
|
|
|
*
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* 19990529 (Emanuele Aliberti)
|
|
|
|
* Compiled successfully with egcs 1.1.2
|
|
|
|
*/
|
2002-09-08 10:23:54 +00:00
|
|
|
#include <ddk/ntddk.h>
|
2005-02-06 21:55:07 +00:00
|
|
|
#include <sm/api.h>
|
1999-12-01 15:18:54 +00:00
|
|
|
#include "smss.h"
|
1999-09-05 12:29:50 +00:00
|
|
|
|
2003-08-11 18:50:12 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
1999-09-05 12:29:50 +00:00
|
|
|
|
|
|
|
void
|
2002-05-24 07:52:09 +00:00
|
|
|
DisplayString(LPCWSTR lpwString)
|
1999-09-05 12:29:50 +00:00
|
|
|
{
|
2002-05-24 07:52:09 +00:00
|
|
|
UNICODE_STRING us;
|
1999-09-05 12:29:50 +00:00
|
|
|
|
2002-05-24 07:52:09 +00:00
|
|
|
RtlInitUnicodeString(&us, lpwString);
|
|
|
|
NtDisplayString(&us);
|
1999-09-05 12:29:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-12-06 00:25:14 +00:00
|
|
|
void
|
2002-05-24 07:52:09 +00:00
|
|
|
PrintString(char* fmt,...)
|
1999-12-06 00:25:14 +00:00
|
|
|
{
|
2002-05-24 07:52:09 +00:00
|
|
|
char buffer[512];
|
|
|
|
va_list ap;
|
|
|
|
UNICODE_STRING UnicodeString;
|
|
|
|
ANSI_STRING AnsiString;
|
|
|
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
vsprintf(buffer, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
RtlInitAnsiString(&AnsiString, buffer);
|
|
|
|
RtlAnsiStringToUnicodeString(&UnicodeString,
|
|
|
|
&AnsiString,
|
|
|
|
TRUE);
|
|
|
|
NtDisplayString(&UnicodeString);
|
|
|
|
RtlFreeUnicodeString(&UnicodeString);
|
1999-12-06 00:25:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-09-05 12:29:50 +00:00
|
|
|
/* Native image's entry point */
|
|
|
|
|
2002-10-25 22:08:21 +00:00
|
|
|
VOID STDCALL
|
2002-05-22 15:55:51 +00:00
|
|
|
NtProcessStartup(PPEB Peb)
|
1999-09-05 12:29:50 +00:00
|
|
|
{
|
2002-05-22 15:55:51 +00:00
|
|
|
HANDLE Children[2]; /* csrss, winlogon */
|
|
|
|
NTSTATUS Status;
|
1999-09-05 12:29:50 +00:00
|
|
|
|
2002-05-22 15:55:51 +00:00
|
|
|
Status = InitSessionManager(Children);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2003-08-11 18:50:12 +00:00
|
|
|
DPRINT1("SM: Initialization failed!\n");
|
2002-05-22 15:55:51 +00:00
|
|
|
goto ByeBye;
|
|
|
|
}
|
1999-09-05 12:29:50 +00:00
|
|
|
|
2002-05-22 15:55:51 +00:00
|
|
|
Status = NtWaitForMultipleObjects(((LONG) sizeof(Children) / sizeof(HANDLE)),
|
|
|
|
Children,
|
|
|
|
WaitAny,
|
|
|
|
TRUE, /* alertable */
|
|
|
|
NULL); /* NULL for infinite */
|
2002-05-24 07:52:09 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
2002-05-22 15:55:51 +00:00
|
|
|
{
|
2003-08-11 18:50:12 +00:00
|
|
|
DPRINT1("SM: NtWaitForMultipleObjects failed!\n");
|
2002-05-22 15:55:51 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-08-11 18:50:12 +00:00
|
|
|
DPRINT1("SM: Process terminated!\n");
|
2002-05-22 15:55:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ByeBye:
|
|
|
|
/* Raise a hard error (crash the system/BSOD) */
|
|
|
|
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED,
|
|
|
|
0,0,0,0,0);
|
2000-10-09 00:18:00 +00:00
|
|
|
|
|
|
|
// NtTerminateProcess(NtCurrentProcess(), 0);
|
1999-09-05 12:29:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|