From 8ae5eb02c7173649245f1e7cda2e8971fe601748 Mon Sep 17 00:00:00 2001 From: Emanuele Aliberti Date: Tue, 8 Jun 1999 22:50:59 +0000 Subject: [PATCH] Initial work for W32 server svn path=/trunk/; revision=547 --- reactos/subsys/csrss/api.h | 14 ++++ reactos/subsys/csrss/api/process.c | 28 +++++++ reactos/subsys/csrss/csrss.c | 84 ++++++++++++++++++++ reactos/subsys/csrss/csrss.rc | 38 +++++++++ reactos/subsys/csrss/init.c | 123 +++++++++++++++++++++++++++++ reactos/subsys/csrss/lpcstub.c | 43 ++++++++++ reactos/subsys/csrss/makefile | 46 +++++++++++ 7 files changed, 376 insertions(+) create mode 100644 reactos/subsys/csrss/api.h create mode 100644 reactos/subsys/csrss/api/process.c create mode 100644 reactos/subsys/csrss/csrss.c create mode 100644 reactos/subsys/csrss/csrss.rc create mode 100644 reactos/subsys/csrss/init.c create mode 100644 reactos/subsys/csrss/lpcstub.c create mode 100644 reactos/subsys/csrss/makefile diff --git a/reactos/subsys/csrss/api.h b/reactos/subsys/csrss/api.h new file mode 100644 index 00000000000..5c49ff50c0f --- /dev/null +++ b/reactos/subsys/csrss/api.h @@ -0,0 +1,14 @@ +#include + +LPC_RETURN_CODE +CSR_CreateProcess ( + PLPC_REQUEST_REPLY pLpcRequestReply + ); + +LPC_RETURN_CODE +CSR_TerminateProcess( + PLPC_REQUEST_REPLY pLpcRequestReply + ); + + +/* EOF */ diff --git a/reactos/subsys/csrss/api/process.c b/reactos/subsys/csrss/api/process.c new file mode 100644 index 00000000000..7cb1c884bb2 --- /dev/null +++ b/reactos/subsys/csrss/api/process.c @@ -0,0 +1,28 @@ +/* $Id: process.c,v 1.1 1999/06/08 22:50:59 ea Exp $ + * + * reactos/subsys/csrss/api/process.c + * + * "\windows\ApiPort" port process management functions + * + * ReactOS Operating System + */ +#include + +LPC_RETURN_CODE +CSR_CreateProcess ( + PLPC_REQUEST_REPLY pLpcRequestReply + ) +{ + return LPC_ERROR_CALL_NOT_IMPLEMENTED; +} + + +LPC_RETURN_CODE +CSR_TerminateProcess( + PLPC_REQUEST_REPLY pLpcRequestReply + ) +{ + return LPC_ERROR_CALL_NOT_IMPLEMENTED; +} + +/* EOF */ diff --git a/reactos/subsys/csrss/csrss.c b/reactos/subsys/csrss/csrss.c new file mode 100644 index 00000000000..358300545cb --- /dev/null +++ b/reactos/subsys/csrss/csrss.c @@ -0,0 +1,84 @@ +/* $Id: csrss.c,v 1.1 1999/06/08 22:50:59 ea Exp $ + * + * csrss.c - Client/Server Runtime subsystem + * + * 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 + * Library 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. + * + * -------------------------------------------------------------------- + * + * 19990417 (Emanuele Aliberti) + * Do nothing native application skeleton + * 19990528 (Emanuele Aliberti) + * Compiled successfully with egcs 1.1.2 + * 19990605 (Emanuele Aliberti) + * First standalone run under ReactOS (it + * actually does nothing but running). + */ +#include +//#include + +BOOL TerminationRequestPending = FALSE; + +BOOL InitializeServer(void); + + +void +DisplayString( + LPCWSTR Message + ) +{ + UNICODE_STRING title; + + title.Buffer = (LPWSTR) Message; + title.Length = wcslen(title.Buffer) * sizeof (WCHAR); + title.MaximumLength = title.Length + sizeof (WCHAR); + NtDisplayString( & title ); +} + + +/* Native process' entry point */ + +void +NtProcessStartup( PSTARTUP_ARGUMENT StartupArgument ) +{ + DisplayString( L"Client/Server Runtime Subsystem\n" ); + + if (TRUE == InitializeServer()) + { + while (FALSE == TerminationRequestPending) + { + /* Do nothing! Should it + * be the SbApi port's + * thread instead? + */ + NtYieldExecution(); + } + } + else + { + DisplayString( L"CSR: Subsystem initialization failed.\n" ); + /* + * Tell SM we failed. + */ + } + NtTerminateProcess( NtCurrentProcess(), 0 ); +} + +/* EOF */ diff --git a/reactos/subsys/csrss/csrss.rc b/reactos/subsys/csrss/csrss.rc new file mode 100644 index 00000000000..c2ecd4d2f60 --- /dev/null +++ b/reactos/subsys/csrss/csrss.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", "Client/Server Runtime Process\0" + VALUE "FileVersion", RES_STR_FILE_VERSION + VALUE "InternalName", "CSRSs and CSRSrv\0" + VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT + VALUE "OriginalFilename", "CSRSs.exe and CSRSrv.dll\0" + VALUE "ProductName", RES_STR_PRODUCT_NAME + VALUE "ProductVersion", RES_STR_PRODUCT_VERSION + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + diff --git a/reactos/subsys/csrss/init.c b/reactos/subsys/csrss/init.c new file mode 100644 index 00000000000..039aeee8ad3 --- /dev/null +++ b/reactos/subsys/csrss/init.c @@ -0,0 +1,123 @@ +/* $Id: init.c,v 1.1 1999/06/08 22:50:59 ea Exp $ + * + * reactos/subsys/csrss/init.c + * + * Initialize the CSRSS subsystem server process. + * + * ReactOS Operating System + * + */ +#include +#include + +#if 0 +struct _SERVER_PORT +{ + HANDLE Port; + THREAD Thread; +}; + +struct _SERVER_PORTS +{ + struct _SERVER_PORT Api; + struct _SERVER_PORT SbApi; + +} + +void Thread_Api(void*); +void Thread_SbApi(void*); + +struct _SERVER_PORTS +Server = +{ + {INVALID_HANDLE_VALUE,Thread_Api}, + {INVALID_HANDLE_VALUE,Thread_SbApi} +}; + + +static +void +Thread_Api(void * pPort) +{ + HANDLE port; + + port = * (HANDLE*) pPort; + + NtListenPort(port); + while (TRUE) + { + NtAcceptConnectPort( + port + ); + if (NT_SUCCESS(NtCompleteConnectPort(port))) + { + /* dispatch call */ + } + } +} + + +static +void +Thread_SbApi(void * pPort) +{ + HANDLE port; + + port = * (HANDLE*) pPort; + + NtListenPort(port); + while (TRUE) + { + NtAcceptConnectPort( + port + ); + if (NT_SUCCESS(NtCompleteConnectPort(port))) + { + /* dispatch call */ + continue; + } + /* error */ + } +} +#endif + + +BOOL +InitializeServer(void) +{ + OBJECT_ATTRIBUTES ObAttributes; + HANDLE MySelf; +#if 0 + MySelf = NtCurrentProcess(); + /* \ApiPort */ + Server.Api.Port = + NtCreatePort( + LPC_CSR_PORT_NAME_APIPORT, + ... + ); + NtCreateThread( + & Server.Api.Thread, + 0, /* desired access */ + & ObAttributes, /* object attributes */ + MySelf, /* process' handle */ + 0, /* client id */ + Thread_ApiPort, + (void*) & Server.Api.Port + ); + /* \SbApiPort */ + Server.SbApi.Port = + NtCreatePort( + LPC_CSR_PORT_NAME_SBAPIPORT, + ... + ); + NtCreateThread( + & Server.SbApi.Thread, + Thread_SbApi, + (void*) & Server.SbApi.Port + ); +#endif + return TRUE; +} + + +/* EOF */ diff --git a/reactos/subsys/csrss/lpcstub.c b/reactos/subsys/csrss/lpcstub.c new file mode 100644 index 00000000000..ec9110e44ba --- /dev/null +++ b/reactos/subsys/csrss/lpcstub.c @@ -0,0 +1,43 @@ +/* $Id: lpcstub.c,v 1.1 1999/06/08 22:50:59 ea Exp $ + * + * lpcstub.c + * + * ReactOS Operating System + * + * + */ +#include +#include +#include "api.h" + + +/* CUI & GUI Win32(tm) API port */ + +LPC_RETURN_CODE +PortDispatcher_Api( + PLPC_REQUEST_REPLY pLpcRequestReply + ) +{ + switch (pLpcRequestReply->Function) + { + case CSRSS_API_PROCESS_CREATE: + return CSRSS_CreateProcess(pLpcRequestReply); + case CSRSS_API_PROCESS_TERMINATE: + return CSRSS_TerminateProcess(pLpcRequestReply); + } + return LPC_ERROR_INVALID_FUNCTION; +} + + +/* The \SbApi dispatcher: what is this port for? */ + +LPC_RETURN_CODE +PortDispatcher_SbApi( + PLPC_REQUEST_REPLY pLpcRequestReply + ) +{ + return LPC_ERROR_INVALID_FUNCTION; +} + + +/* EOF */ diff --git a/reactos/subsys/csrss/makefile b/reactos/subsys/csrss/makefile new file mode 100644 index 00000000000..b2295590caa --- /dev/null +++ b/reactos/subsys/csrss/makefile @@ -0,0 +1,46 @@ +# $Id: makefile,v 1.1 1999/06/08 22:50:59 ea Exp $ +# +# CSRSS: Client/server runtime subsystem +# +# ReactOS Operating System +# +TARGET=csrss + +OBJECTS_API = api/process.o + +OBJECTS_SBAPI = + +OBJECTS_MISC = $(TARGET).o init.o lpcstub.o $(TARGET).coff + +OBJECTS = $(OBJECTS_API) $(OBJECTS_SBAPI) $(OBJECTS_MISC) + +LIBS = ../../lib/ntdll/ntdll.a + +all: $(TARGET).exe + +.phony: all + +clean: + - $(RM) api/*.o + - $(RM) sbapi/*.o + - $(RM) *.o + - $(RM) $(TARGET).exe + - $(RM) $(TARGET).sym + - $(RM) $(TARGET).coff + +.phony: clean + +$(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 + +include ../../rules.mak + +# EOF -- 2.17.1