From 648c68ff1a1f551ac30cdc36fd5033f294087c67 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 5 Sep 1999 12:29:50 +0000 Subject: [PATCH] Moved smss to a better place. svn path=/trunk/; revision=640 --- reactos/subsys/smss/init.c | 93 +++++++++++++++++++++++++++++++ reactos/subsys/smss/makefile | 61 ++++++++++++++++++++ reactos/subsys/smss/smss.c | 105 +++++++++++++++++++++++++++++++++++ reactos/subsys/smss/smss.rc | 38 +++++++++++++ 4 files changed, 297 insertions(+) create mode 100644 reactos/subsys/smss/init.c create mode 100644 reactos/subsys/smss/makefile create mode 100644 reactos/subsys/smss/smss.c create mode 100644 reactos/subsys/smss/smss.rc diff --git a/reactos/subsys/smss/init.c b/reactos/subsys/smss/init.c new file mode 100644 index 00000000000..a65fee97b16 --- /dev/null +++ b/reactos/subsys/smss/init.c @@ -0,0 +1,93 @@ +/* $Id: init.c,v 1.1 1999/09/05 12:29:50 ekohl Exp $ + * + * init.c - Session Manager initialization + * + * 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. + * + * -------------------------------------------------------------------- + * + * 19990530 (Emanuele Aliberti) + * Compiled successfully with egcs 1.1.2 + */ +#include +//#include + +BOOL +InitSessionManager( + HANDLE Children[] + ) +{ + NTSTATUS Status; + UNICODE_STRING CmdLineW; + + /* FIXME: Create the \SmApiPort object (LPC) */ + /* FIXME: Create two thread for \SmApiPort */ + /* FIXME: Create the system environment variables */ + /* FIXME: Define symbolic links to kernel devices (MS-DOS names) */ + /* FIXME: Create paging files (if any) other than the first one */ + /* FIXME: Load the well known DLLs */ + /* FIXME: Load the kernel mode driver win32k.sys */ + +#if 0 + /* Start the Win32 subsystem (csrss.exe) */ + Status = NtCreateProcess( + L"\\??\\C:\\reactos\\system32\\csrss.exe", + & Children[CHILD_CSRSS] + ); +#endif + + /* Start the simple shell (shell.exe) */ + RtlInitUnicodeString(&CmdLineW, + L"\\??\\C:\\reactos\\system32\\shell.exe"); + Status = RtlCreateUserProcess(&CmdLineW, + NULL, + NULL, + FALSE, + 0, + NULL, + &Children[0], + NULL); + + if (!NT_SUCCESS(Status)) + { + return FALSE; + } +#if 0 + /* Start winlogon.exe */ + Status = NtCreateProcess( + L"\\??\\C:\\reactos\\system32\\winlogon.exe", + & Children[CHILD_WINLOGON] + ); + if (!NT_SUCCESS(Status)) + { + Status = NtTerminateProcess( + Children[CHILD_CSRSS] + ); + return FALSE; + } +#endif + /* FIXME: Create the \DbgSsApiPort object (LPC) */ + /* FIXME: Create the \DbgUiApiPort object (LPC) */ + return TRUE; +} + + +/* EOF */ + diff --git a/reactos/subsys/smss/makefile b/reactos/subsys/smss/makefile new file mode 100644 index 00000000000..a4903ebf365 --- /dev/null +++ b/reactos/subsys/smss/makefile @@ -0,0 +1,61 @@ +# $Id: makefile,v 1.1 1999/09/05 12:29:50 ekohl Exp $ +# +# Session Manager +# +# ReactOS Operating System +# +TARGET=smss + +BASE_CFLAGS = -I../../include + +OBJECTS = $(TARGET).o init.o $(TARGET).coff + +LIBS = ../../lib/ntdll/ntdll.a + +CLEAN_FILES = *.o $(TARGET).exe $(TARGET).sym $(TARGET).coff + +all: $(TARGET).exe + +.phony: all + + +$(TARGET).coff: $(TARGET).rc + $(RC) $(TARGET).rc $(TARGET).coff + +$(TARGET).exe: $(OBJECTS) $(LIBS) + $(LD) \ + $(OBJECTS) \ + $(LIBS) \ + -o $(TARGET).exe \ + --subsystem native + $(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym + + +clean: $(CLEAN_FILES:%=%_clean) + +$(CLEAN_FILES:%=%_clean): %_clean: + - $(RM) $* + +.PHONY: clean $(CLEAN_FILES:%=%_clean) + + +floppy: $(FLOPPY_DIR)/subsys/$(TARGET).exe + +$(FLOPPY_DIR)/subsys/$(TARGET).exe: $(TARGET).exe +ifeq ($(DOSCLI),yes) + $(CP) $(TARGET).exe $(FLOPPY_DIR)\subsys\$(TARGET).exe +else + $(CP) $(TARGET).exe $(FLOPPY_DIR)/subsys/$(TARGET).exe +endif + + +dist: $(DIST_DIR)/subsys/$(TARGET).exe + +$(DIST_DIR)/subsys/$(TARGET).exe: $(TARGET).exe +ifeq ($(DOSCLI),yes) + $(CP) $(TARGET).exe ..\..\$(DIST_DIR)\subsys\$(TARGET).exe +else + $(CP) $(TARGET).exe ../../$(DIST_DIR)/subsys/$(TARGET).exe +endif + +include ../../rules.mak diff --git a/reactos/subsys/smss/smss.c b/reactos/subsys/smss/smss.c new file mode 100644 index 00000000000..6a98dfc7a3d --- /dev/null +++ b/reactos/subsys/smss/smss.c @@ -0,0 +1,105 @@ +/* $Id: smss.c,v 1.1 1999/09/05 12:29:50 ekohl Exp $ + * + * 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 + */ +#include +#include + +BOOL InitSessionManager(HANDLE Children[]); /* ./init.c */ + + +void +DisplayString( LPCWSTR lpwString ) +{ + UNICODE_STRING us; + + us.Buffer = (LPWSTR) lpwString; + us.Length = wcslen(lpwString) * sizeof (WCHAR); + us.MaximumLength = us.Length + sizeof (WCHAR); + NtDisplayString( & us ); +} + + +/* Native image's entry point */ + +void +NtProcessStartup( PSTARTUP_ARGUMENT StartupArgument ) +{ + HANDLE Children[2]; /* csrss, winlogon */ + + DisplayString( L"Session Manager\n" ); + + + if (TRUE == InitSessionManager(Children)) + { + LARGE_INTEGER Time = {{(DWORD)-1,(DWORD)-1}}; /* infinite? */ + NTSTATUS wws; + + DisplayString( L"SM: Waiting for process termination...\n" ); + + wws = NtWaitForSingleObject ( + Children[0], + TRUE, /* alertable */ + & Time + ); + +#if 0 + wws = NtWaitForMultipleObjects ( + ((LONG) sizeof Children / sizeof (HANDLE)), + Children, + WaitAny, + TRUE, /* alertable */ + & Time + ); +#endif + if (!NT_SUCCESS(wws)) + { + DisplayString( L"SM: NtWaitForMultipleObjects failed!\n" ); + /* FIXME: CRASH THE SYSTEM (BSOD) */ + } + else + { + DisplayString( L"SM: Process terminated!\n" ); + /* FIXME: CRASH THE SYSTEM (BSOD) */ + } + } + else + { + DisplayString( L"SM: initialization failed!\n" ); + /* FIXME: CRASH SYSTEM (BSOD)*/ + } + + + /* + * OK: CSRSS asked to shutdown the system; + * We die. + */ + NtTerminateProcess( NtCurrentProcess(), 0 ); +} + + +/* EOF */ diff --git a/reactos/subsys/smss/smss.rc b/reactos/subsys/smss/smss.rc new file mode 100644 index 00000000000..53534f832cb --- /dev/null +++ b/reactos/subsys/smss/smss.rc @@ -0,0 +1,38 @@ +#include "../../include/defines.h" +#include "../../include/reactos/resource.h" + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +VS_VERSION_INFO VERSIONINFO + FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD + PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", RES_STR_COMPANY_NAME + VALUE "FileDescription", "ReactOS Session Manager\0" + VALUE "FileVersion", RES_STR_FILE_VERSION + VALUE "InternalName", "smss\0" + VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT + VALUE "OriginalFilename", "smss.exe\0" + VALUE "ProductName", RES_STR_PRODUCT_NAME + VALUE "ProductVersion", RES_STR_PRODUCT_VERSION + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END +