Implemented RegisterServicesProcess() and ExitWindowsEx() partially.

svn path=/trunk/; revision=3644
This commit is contained in:
Eric Kohl 2002-10-20 14:54:34 +00:00
parent e1365d9be6
commit 31789101ee
13 changed files with 177 additions and 30 deletions

View file

@ -282,6 +282,18 @@ typedef struct
DWORD NumInputEvents;
}CSRSS_GET_NUM_INPUT_EVENTS_REPLY, *PCSRSS_GET_NUM_INPUT_EVENTS_REPLY;
typedef struct
{
DWORD ProcessId;
} CSRSS_REGISTER_SERVICES_PROCESS_REQUEST, *PCSRSS_REGISTER_SERVICES_PROCESS_REQUEST;
typedef struct
{
UINT Flags;
DWORD Reserved;
} CSRSS_EXIT_REACTOS_REQUEST, *PCSRSS_EXIT_REACTOS_REQUEST;
#define CSRSS_MAX_WRITE_CONSOLE_REQUEST \
(MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(CSRSS_WRITE_CONSOLE_REQUEST))
@ -328,7 +340,10 @@ typedef struct
#define CSRSS_SCROLL_CONSOLE_SCREEN_BUFFER (0x19)
#define CSRSS_READ_CONSOLE_OUTPUT_CHAR (0x1A)
#define CSRSS_READ_CONSOLE_OUTPUT_ATTRIB (0x1B)
#define CSRSS_GET_NUM_INPUT_EVENTS (0x1C)
#define CSRSS_GET_NUM_INPUT_EVENTS (0x1C)
#define CSRSS_REGISTER_SERVICES_PROCESS (0x1D)
#define CSRSS_EXIT_REACTOS (0x1E)
/* Keep in sync with definition below. */
@ -367,6 +382,8 @@ typedef struct
CSRSS_READ_CONSOLE_OUTPUT_CHAR_REQUEST ReadConsoleOutputCharRequest;
CSRSS_READ_CONSOLE_OUTPUT_ATTRIB_REQUEST ReadConsoleOutputAttribRequest;
CSRSS_GET_NUM_INPUT_EVENTS_REQUEST GetNumInputEventsRequest;
CSRSS_REGISTER_SERVICES_PROCESS_REQUEST RegisterServicesProcessRequest;
CSRSS_EXIT_REACTOS_REQUEST ExitReactosRequest;
} Data;
} CSRSS_API_REQUEST, *PCSRSS_API_REQUEST;

View file

@ -7582,6 +7582,9 @@ SwitchToFiber (
);
WINBOOL STDCALL
RegisterServicesProcess(DWORD ServicesProcessId);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.6 2002/09/17 23:46:22 dwelch Exp $
# $Id: Makefile,v 1.7 2002/10/20 14:53:02 ekohl Exp $
PATH_TO_TOP = ../..
@ -26,16 +26,17 @@ CONTROLS_OBJECTS = \
controls/scrollbar.o
MISC_OBJECTS = \
misc/dde.o \
misc/desktop.o \
misc/display.o \
misc/dllmain.o \
misc/exit.o \
misc/sprintf.o \
misc/stubs.o \
misc/winhelp.o \
misc/win32k.o \
misc/winsta.o \
misc/resources.o \
misc/dde.o \
misc/display.o \
misc/object.o \
misc/timer.o

View file

@ -0,0 +1,66 @@
/* $Id: exit.c,v 1.1 2002/10/20 14:52:45 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/misc/exit.c
* PURPOSE: Shutdown related functions
* PROGRAMMER: Eric Kohl (ekohl@rz-online.de)
*/
#include <windows.h>
//#include <user32.h>
#include <ntdll/csr.h>
WINBOOL STDCALL
ExitWindowsEx(UINT uFlags,
DWORD dwReserved)
{
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
NTSTATUS Status;
Request.Type = CSRSS_EXIT_REACTOS;
Request.Data.ExitReactosRequest.Flags = uFlags;
Request.Data.ExitReactosRequest.Reserved = dwReserved;
Status = CsrClientCallServer(&Request,
&Reply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return(FALSE);
}
return(TRUE);
}
WINBOOL STDCALL
RegisterServicesProcess(DWORD ServicesProcessId)
{
CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply;
NTSTATUS Status;
Request.Type = CSRSS_REGISTER_SERVICES_PROCESS;
Request.Data.RegisterServicesProcessRequest.ProcessId = ServicesProcessId;
Status = CsrClientCallServer(&Request,
&Reply,
sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return(FALSE);
}
return(TRUE);
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.15 2002/09/17 23:46:23 dwelch Exp $
/* $Id: stubs.c,v 1.16 2002/10/20 14:52:45 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -122,8 +122,6 @@ DragDetect(
return FALSE;
}
WINBOOL
STDCALL
EnableScrollBar(
@ -134,18 +132,6 @@ EnableScrollBar(
return FALSE;
}
WINBOOL
STDCALL
ExitWindowsEx(
UINT uFlags,
DWORD dwReserved)
{
return FALSE;
}
HWND
STDCALL
GetActiveWindow(VOID)

View file

@ -514,7 +514,7 @@ RegisterClipboardFormatW@4
;RegisterDeviceNotificationW@12
RegisterHotKey@16
;RegisterLogonProcess
;RegisterServicesProcess
RegisterServicesProcess@4
;RegisterShellHookWindow
;RegisterSystemThread
;RegisterTasklist

View file

@ -514,7 +514,7 @@ RegisterClipboardFormatW=RegisterClipboardFormatW@4
;RegisterDeviceNotificationW@12
RegisterHotKey=RegisterHotKey@16
;RegisterLogonProcess
;RegisterServicesProcess
RegisterServicesProcess=RegisterServicesProcess@4
;RegisterShellHookWindow
;RegisterSystemThread
;RegisterTasklist

View file

@ -122,6 +122,8 @@ CSR_API(CsrScrollConsoleScreenBuffer);
CSR_API(CsrReadConsoleOutputChar);
CSR_API(CsrReadConsoleOutputAttrib);
CSR_API(CsrGetNumberOfConsoleInputEvents);
CSR_API(CsrRegisterServicesProcess);
CSR_API(CsrExitReactos);
/* print.c */
VOID STDCALL DisplayString(LPCWSTR lpwString);

View file

@ -0,0 +1,69 @@
/* $Id: user.c,v 1.1 2002/10/20 14:53:43 ekohl Exp $
*
* reactos/subsys/csrss/api/user.c
*
* User functions
*
* ReactOS Operating System
*/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <csrss/csrss.h>
#include "api.h"
#include <ntdll/rtl.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS *******************************************************************/
static BOOLEAN ServicesProcessIdValid = FALSE;
static ULONG ServicesProcessId;
/* FUNCTIONS *****************************************************************/
CSR_API(CsrRegisterServicesProcess)
{
NTSTATUS Status;
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) -
sizeof(LPC_MESSAGE_HEADER);
if (ServicesProcessIdValid == TRUE)
{
/* Only accept a single call */
Status = STATUS_INVALID_PARAMETER;
}
else
{
ServicesProcessId = (ULONG)Request->Data.RegisterServicesProcessRequest.ProcessId;
ServicesProcessIdValid = TRUE;
Status = STATUS_SUCCESS;
}
Reply->Status = Status;
return(Status);
}
CSR_API(CsrExitReactos)
{
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) -
sizeof(LPC_MESSAGE_HEADER);
Reply->Status = STATUS_NOT_IMPLEMENTED;
return(STATUS_NOT_IMPLEMENTED);
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: wapi.c,v 1.20 2002/10/20 00:34:40 mdill Exp $
/* $Id: wapi.c,v 1.21 2002/10/20 14:53:43 ekohl Exp $
*
* reactos/subsys/csrss/api/wapi.c
*
@ -55,7 +55,9 @@ static const CsrFunc CsrFuncs[] = {
CsrScrollConsoleScreenBuffer,
CsrReadConsoleOutputChar,
CsrReadConsoleOutputAttrib,
CsrGetNumberOfConsoleInputEvents,
CsrGetNumberOfConsoleInputEvents,
CsrRegisterServicesProcess,
CsrExitReactos,
0 };
static void Thread_Api2(HANDLE ServerPort)

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.16 2002/08/26 13:06:03 dwelch Exp $
# $Id: makefile,v 1.17 2002/10/20 14:53:59 ekohl Exp $
PATH_TO_TOP = ../..
@ -16,7 +16,8 @@ OBJECTS_API = \
api/process.o \
api/wapi.o \
api/conio.o \
api/handle.o
api/handle.o \
api/user.o
OBJECTS_MISC = \
$(TARGET_NAME).o \

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.4 2002/06/07 20:09:56 ekohl Exp $
# $Id: makefile,v 1.5 2002/10/20 14:54:34 ekohl Exp $
PATH_TO_TOP = ../../..
@ -10,7 +10,7 @@ TARGET_NAME = services
TARGET_INSTALLDIR = system32
TARGET_SDKLIBS = ntdll.a kernel32.a
TARGET_SDKLIBS = ntdll.a kernel32.a user32.a
TARGET_OBJECTS = $(TARGET_NAME).o database.o

View file

@ -1,4 +1,4 @@
/* $Id: services.c,v 1.8 2002/09/08 10:23:47 chorns Exp $
/* $Id: services.c,v 1.9 2002/10/20 14:54:34 ekohl Exp $
*
* service control manager
*
@ -265,8 +265,8 @@ WinMain(HINSTANCE hInstance,
/* FIXME: create listener thread for pipe */
/* FIXME: register process as service process */
// RegisterServiceProcess();
/* Register service process with CSRSS */
RegisterServicesProcess(GetCurrentProcessId());
PrintString("SERVICES: Initialized.\n");