mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
CSRSS: register CSRSS to manage IMAGE_SUBSYSTEM_WINDOWS_CUI (experimental).
svn path=/trunk/; revision=13653
This commit is contained in:
parent
b36baad125
commit
1c2c6c8582
4 changed files with 60 additions and 48 deletions
|
@ -178,7 +178,7 @@ ServerApiPortThead(PVOID PortHandle)
|
|||
Status = NtAcceptConnectPort(&ServerPort,
|
||||
PortHandle,
|
||||
NULL,
|
||||
1,
|
||||
TRUE,
|
||||
0,
|
||||
&LpcRead);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
|
|
@ -17,11 +17,12 @@
|
|||
#include <ntdll/ldr.h>
|
||||
#include <win32k/win32k.h>
|
||||
#include <rosrtl/string.h>
|
||||
#include <sm/helper.h>
|
||||
|
||||
#include "api.h"
|
||||
#include "csrplugin.h"
|
||||
|
||||
#define NDEBUG
|
||||
//#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
@ -218,6 +219,37 @@ CSRSS_API_DEFINITION NativeDefinitions[] =
|
|||
{ 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
/**********************************************************************
|
||||
* NAME
|
||||
* CsrpRegisterSubsystem/0
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Register CSRSS in the SM to manage IMAGE_SUBSYSTEM_WINDOWS_CUI
|
||||
* processes (environment subsystem server).
|
||||
*
|
||||
* RETURN VALUE
|
||||
* STATUS_SUCCESS on success.
|
||||
*/
|
||||
static NTSTATUS FASTCALL
|
||||
CsrpRegisterSubsystem(PHANDLE hSmApiPort)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
UNICODE_STRING SbApiPortName;
|
||||
|
||||
RtlInitUnicodeString (& SbApiPortName, L"\\Windows\\SbApiPort");
|
||||
Status = SmConnectApiPort (& SbApiPortName,
|
||||
(HANDLE)-1, //unused
|
||||
IMAGE_SUBSYSTEM_WINDOWS_CUI,
|
||||
hSmApiPort);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("CSR: unable to connect to the SM (Status=0x%lx)\n", Status);
|
||||
return Status;
|
||||
}
|
||||
DisplayString(L"CSR: registered with SM\n");
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME
|
||||
|
@ -238,9 +270,20 @@ CsrServerInitialization (
|
|||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
HANDLE hSmApiPort = (HANDLE) 0;
|
||||
OBJECT_ATTRIBUTES ObAttributes;
|
||||
UNICODE_STRING PortName;
|
||||
HANDLE ApiPortHandle;
|
||||
// HANDLE hSbApiPort = (HANDLE) 0;
|
||||
|
||||
DisplayString(L"CSR: CsrServerInitialization\n");
|
||||
|
||||
Status = CsrpRegisterSubsystem(& hSmApiPort);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("CSR: Unable to register subsystem (Status: %x)\n", Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = CsrParseCommandLine (ArgumentCount, ArgumentArray);
|
||||
if (! NT_SUCCESS(Status))
|
||||
|
@ -269,7 +312,7 @@ CsrServerInitialization (
|
|||
return Status;
|
||||
}
|
||||
|
||||
/* NEW NAMED PORT: \ApiPort */
|
||||
/* NEW NAMED PORT: \Windows\ApiPort */
|
||||
RtlRosInitUnicodeStringFromLiteral(&PortName, L"\\Windows\\ApiPort");
|
||||
InitializeObjectAttributes(&ObAttributes,
|
||||
&PortName,
|
||||
|
@ -283,7 +326,7 @@ CsrServerInitialization (
|
|||
0);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("CSR: Unable to create \\ApiPort (Status %x)\n", Status);
|
||||
DPRINT1("CSR: Unable to create \\Windows\\ApiPort (Status %x)\n", Status);
|
||||
return FALSE;
|
||||
}
|
||||
Status = RtlCreateUserThread(NtCurrentProcess(),
|
||||
|
@ -302,6 +345,9 @@ CsrServerInitialization (
|
|||
NtClose(ApiPortHandle);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* TODO: create \Windows\SbApiPort */
|
||||
|
||||
Status = CsrClientConnectToServer();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -315,7 +361,15 @@ CsrServerInitialization (
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
return CallInitComplete();
|
||||
if (CallInitComplete())
|
||||
{
|
||||
#if 0
|
||||
Status = SmCompleteSession (hSmApiPort,hSbApiPort,ApiPortHandle);
|
||||
#endif
|
||||
NtClose (hSmApiPort);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/* $Id$
|
||||
*
|
||||
* lpcstub.c
|
||||
*
|
||||
* ReactOS Operating System
|
||||
*
|
||||
*
|
||||
*/
|
||||
#include <ddk/ntddk.h>
|
||||
#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 */
|
|
@ -9,7 +9,7 @@ TARGET_APPTYPE = native
|
|||
|
||||
TARGET_NAME = csrss
|
||||
|
||||
TARGET_SDKLIBS = rosrtl.a ntdll.a
|
||||
TARGET_SDKLIBS = rosrtl.a ntdll.a smdll.a
|
||||
|
||||
TARGET_INSTALLDIR = system32
|
||||
|
||||
|
|
Loading…
Reference in a new issue