mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
- SMSS: Send QOS structure when creating new ports, it's not optional on NT LPC. Send maximum port length when creating new ports, it's not optional on NT LPC. Create 2 listening threads on NTLPC, instead of just one. [AUDIT: Unlock smlib, it's fully internal and specific to ROS without any relationship to NT. The author used clean-room tests and documentation].
- Fix various LPC structures in the NDK. Fix some prototypes too. - Don't export PEPORT or PLPCP_PORT_OBJECT outside of /lpc and use PVOID isntead. - Add a new RBUILD setting called NTLPC, which enables NTLPC when turned on. svn path=/trunk/; revision=24664
This commit is contained in:
parent
48ffe89726
commit
1a98439492
15 changed files with 123 additions and 44 deletions
|
@ -153,7 +153,7 @@ SmInitializeDbgSs (VOID)
|
|||
Status = SmpCreatePT(& DbgSsApiPort,
|
||||
SM_DBGSS_PORT_NAME,
|
||||
0, /* MaxDataSize */
|
||||
0, /* MaxMessageSize */
|
||||
sizeof(PORT_MESSAGE), /* MaxMessageSize */
|
||||
0, /* PoolCharge */
|
||||
DbgSsApiPortThread,
|
||||
& hDbgSsApiPortThread);
|
||||
|
@ -166,7 +166,7 @@ SmInitializeDbgSs (VOID)
|
|||
Status = SmpCreatePT(& DbgUiApiPort,
|
||||
SM_DBGUI_PORT_NAME,
|
||||
0, /* MaxDataSize */
|
||||
0, /* MaxMessageSize */
|
||||
sizeof(PORT_MESSAGE), /* MaxMessageSize */
|
||||
0, /* PoolCharge */
|
||||
DbgUiApiPortThread,
|
||||
NULL);
|
||||
|
|
|
@ -44,10 +44,8 @@ PSM_CONNECT_DATA FASTCALL SmpGetConnectData (PSM_PORT_MESSAGE Request)
|
|||
return (PSM_CONNECT_DATA)(PortMessage + 1);
|
||||
}
|
||||
|
||||
#if !defined(__USE_NT_LPC__)
|
||||
NTSTATUS STDCALL
|
||||
SmpHandleConnectionRequest (PSM_PORT_MESSAGE Request);
|
||||
#endif
|
||||
|
||||
/**********************************************************************
|
||||
* SmpCallbackServer/2
|
||||
|
@ -68,6 +66,7 @@ SmpCallbackServer (PSM_PORT_MESSAGE Request,
|
|||
ULONG CallbackPortNameLength = SM_SB_NAME_MAX_LENGTH; /* TODO: compute length */
|
||||
SB_CONNECT_DATA SbConnectData;
|
||||
ULONG SbConnectDataLength = sizeof SbConnectData;
|
||||
SECURITY_QUALITY_OF_SERVICE SecurityQos;
|
||||
|
||||
DPRINT("SM: %s called\n", __FUNCTION__);
|
||||
|
||||
|
@ -84,10 +83,15 @@ SmpCallbackServer (PSM_PORT_MESSAGE Request,
|
|||
RtlInitUnicodeString (& CallbackPortName,
|
||||
ClientData->SbApiPortName);
|
||||
|
||||
SecurityQos.Length = sizeof (SecurityQos);
|
||||
SecurityQos.ImpersonationLevel = SecurityIdentification;
|
||||
SecurityQos.ContextTrackingMode = SECURITY_DYNAMIC_TRACKING;
|
||||
SecurityQos.EffectiveOnly = TRUE;
|
||||
|
||||
SbConnectData.SmApiMax = (sizeof SmApi / sizeof SmApi[0]);
|
||||
Status = NtConnectPort (& ClientData->SbApiPort,
|
||||
& CallbackPortName,
|
||||
NULL,
|
||||
&SecurityQos,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -245,7 +249,7 @@ SmpHandleConnectionRequest (PSM_PORT_MESSAGE Request)
|
|||
}
|
||||
}
|
||||
DPRINT("SM: %s: before NtAcceptConnectPort\n", __FUNCTION__);
|
||||
#if defined(__USE_NT_LPC__)
|
||||
#if defined(NTLPC)
|
||||
Status = NtAcceptConnectPort (ClientDataApiPort,
|
||||
Context,
|
||||
(PPORT_MESSAGE) Request,
|
||||
|
@ -276,7 +280,7 @@ SmpHandleConnectionRequest (PSM_PORT_MESSAGE Request)
|
|||
__FUNCTION__, Status);
|
||||
return Status;
|
||||
}
|
||||
#if !defined(__USE_NT_LPC__) /* ReactOS LPC */
|
||||
#if !defined(NTLPC) /* ReactOS LPC */
|
||||
DPRINT("SM: %s: server side comm port thread (ROS LPC)\n", __FUNCTION__);
|
||||
Status = RtlCreateUserThread(NtCurrentProcess(),
|
||||
NULL,
|
||||
|
@ -369,8 +373,8 @@ SmCreateApiPort(VOID)
|
|||
|
||||
Status = NtCreatePort(&SmApiPort,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
sizeof(SM_CONNECT_DATA),
|
||||
sizeof(SM_PORT_MESSAGE),
|
||||
0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -386,11 +390,35 @@ SmCreateApiPort(VOID)
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
#ifdef NTLPC
|
||||
(PTHREAD_START_ROUTINE)SmpApiConnectedThread,
|
||||
&SmApiPort,
|
||||
#else
|
||||
(PTHREAD_START_ROUTINE)SmpApiThread,
|
||||
(PVOID)SmApiPort,
|
||||
#endif
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
#ifdef NTLPC
|
||||
//
|
||||
// On NT LPC, we need a second thread to handle incoming connections
|
||||
// generated by incoming requests, otherwise the thread handling
|
||||
// the request will be busy sending the LPC message, without any other
|
||||
// thread being busy to receive the LPC message.
|
||||
//
|
||||
Status = RtlCreateUserThread(NtCurrentProcess(),
|
||||
NULL,
|
||||
FALSE,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
(PTHREAD_START_ROUTINE)SmpApiConnectedThread,
|
||||
&SmApiPort,
|
||||
NULL,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<include base="ReactOS">include/reactos/subsys</include>
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_DISABLE_TIDENTS" />
|
||||
<if property="NTLPC" value="1">
|
||||
<define name="NTLPC" />
|
||||
</if>
|
||||
<library>nt</library>
|
||||
<library>smlib</library>
|
||||
<library>ntdll</library>
|
||||
|
|
|
@ -185,7 +185,9 @@ typedef enum _HARDERROR_RESPONSE
|
|||
ResponseNo,
|
||||
ResponseOk,
|
||||
ResponseRetry,
|
||||
ResponseYes
|
||||
ResponseYes,
|
||||
ResponseTryAgain,
|
||||
ResponseContinue
|
||||
} HARDERROR_RESPONSE, *PHARDERROR_RESPONSE;
|
||||
|
||||
//
|
||||
|
|
|
@ -34,8 +34,15 @@ NTAPI
|
|||
LpcRequestWaitReplyPort(
|
||||
IN PVOID Port,
|
||||
IN PPORT_MESSAGE LpcMessageRequest,
|
||||
OUT PPORT_MESSAGE LpcMessageReply)
|
||||
;
|
||||
OUT PPORT_MESSAGE LpcMessageReply
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LpcRequestPort(
|
||||
IN PVOID Port,
|
||||
IN PPORT_MESSAGE LpcMessage
|
||||
);
|
||||
#endif
|
||||
|
||||
//
|
||||
|
|
|
@ -39,8 +39,22 @@ Author:
|
|||
//
|
||||
// Port Object Access Masks
|
||||
//
|
||||
#define PORT_CONNECT 0x1
|
||||
#define PORT_ALL_ACCESS 0x1
|
||||
|
||||
//
|
||||
// Port Object Flags
|
||||
//
|
||||
#define LPCP_CONNECTION_PORT 0x00000001
|
||||
#define LPCP_UNCONNECTED_PORT 0x00000002
|
||||
#define LPCP_COMMUNICATION_PORT 0x00000003
|
||||
#define LPCP_CLIENT_PORT 0x00000004
|
||||
#define LPCP_PORT_TYPE_MASK 0x0000000F
|
||||
#define LPCP_PORT_DELETED 0x10000000
|
||||
#define LPCP_WAITABLE_PORT 0x20000000
|
||||
#define LPCP_NAME_DELETED 0x40000000
|
||||
#define LPCP_SECURITY_DYNAMIC 0x80000000
|
||||
|
||||
//
|
||||
// LPC Message Types
|
||||
//
|
||||
|
@ -170,7 +184,7 @@ typedef struct _LPCP_NONPAGED_PORT_QUEUE
|
|||
typedef struct _LPCP_PORT_QUEUE
|
||||
{
|
||||
PLPCP_NONPAGED_PORT_QUEUE NonPagedPortQueue;
|
||||
KSEMAPHORE Semaphore;
|
||||
PKSEMAPHORE Semaphore;
|
||||
LIST_ENTRY ReceiveHead;
|
||||
} LPCP_PORT_QUEUE, *PLPCP_PORT_QUEUE;
|
||||
|
||||
|
@ -179,8 +193,6 @@ typedef struct _LPCP_PORT_QUEUE
|
|||
//
|
||||
typedef struct _LPCP_PORT_OBJECT
|
||||
{
|
||||
ULONG Length;
|
||||
ULONG Flags;
|
||||
struct _LPCP_PORT_OBJECT *ConnectionPort;
|
||||
struct _LPCP_PORT_OBJECT *ConnectedPort;
|
||||
LPCP_PORT_QUEUE MsgQueue;
|
||||
|
@ -188,13 +200,17 @@ typedef struct _LPCP_PORT_OBJECT
|
|||
PVOID ClientSectionBase;
|
||||
PVOID ServerSectionBase;
|
||||
PVOID PortContext;
|
||||
ULONG MaxMessageLength;
|
||||
ULONG MaxConnectionInfoLength;
|
||||
PETHREAD ClientThread;
|
||||
SECURITY_QUALITY_OF_SERVICE SecurityQos;
|
||||
SECURITY_CLIENT_CONTEXT StaticSecurity;
|
||||
LIST_ENTRY LpcReplyChainHead;
|
||||
LIST_ENTRY LpcDataInfoChainHead;
|
||||
PEPROCESS ServerProcess;
|
||||
PEPROCESS MappingProcess;
|
||||
ULONG MaxMessageLength;
|
||||
ULONG MaxConnectionInfoLength;
|
||||
ULONG Flags;
|
||||
KEVENT WaitEvent;
|
||||
} LPCP_PORT_OBJECT, *PLPCP_PORT_OBJECT;
|
||||
|
||||
//
|
||||
|
|
|
@ -110,6 +110,14 @@ HANDLE
|
|||
NTAPI
|
||||
PsGetProcessId(PEPROCESS Process);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PsLookupProcessThreadByCid(
|
||||
IN PCLIENT_ID Cid,
|
||||
OUT PEPROCESS *Process OPTIONAL,
|
||||
OUT PETHREAD *Thread
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
|
|
|
@ -78,7 +78,7 @@ SmConnectApiPort (IN PUNICODE_STRING pSbApiPortName OPTIONAL,
|
|||
|
||||
SecurityQos.Length = sizeof (SecurityQos);
|
||||
SecurityQos.ImpersonationLevel = SecurityIdentification;
|
||||
SecurityQos.ContextTrackingMode = TRUE;
|
||||
SecurityQos.ContextTrackingMode = SECURITY_DYNAMIC_TRACKING;
|
||||
SecurityQos.EffectiveOnly = TRUE;
|
||||
|
||||
RtlInitUnicodeString (& SmApiPortName, SM_API_PORT_NAME);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
/* GLOBALS ****************************************************************/
|
||||
|
||||
BOOLEAN ExReadyForErrors = FALSE;
|
||||
PEPORT ExpDefaultErrorPort = NULL;
|
||||
PVOID ExpDefaultErrorPort = NULL;
|
||||
PEPROCESS ExpDefaultErrorPortProcess = NULL;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
|
||||
extern POBJECT_TYPE LpcPortObjectType;
|
||||
extern ULONG LpcpNextMessageId;
|
||||
#ifndef NTLPC
|
||||
extern FAST_MUTEX LpcpLock;
|
||||
#endif
|
||||
|
||||
typedef struct _EPORT_LISTENER
|
||||
{
|
||||
|
@ -74,13 +76,6 @@ typedef struct _QUEUEDMESSAGE
|
|||
PORT_MESSAGE Message;
|
||||
} QUEUEDMESSAGE, *PQUEUEDMESSAGE;
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LpcRequestPort(
|
||||
PEPORT Port,
|
||||
PPORT_MESSAGE LpcMessage
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LpcSendTerminationPort(
|
||||
|
|
|
@ -175,7 +175,7 @@ DefaultSetInfoBufferCheck(ULONG Class,
|
|||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
if (Class >= 0 && Class < ClassListEntries)
|
||||
if (Class < ClassListEntries)
|
||||
{
|
||||
if (!(ClassList[Class].Flags & ICIF_SET))
|
||||
{
|
||||
|
@ -226,7 +226,7 @@ DefaultQueryInfoBufferCheck(ULONG Class,
|
|||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
if (Class >= 0 && Class < ClassListEntries)
|
||||
if (Class < ClassListEntries)
|
||||
{
|
||||
if (!(ClassList[Class].Flags & ICIF_QUERY))
|
||||
{
|
||||
|
|
|
@ -34,10 +34,11 @@
|
|||
*
|
||||
* @implemented
|
||||
*/
|
||||
NTSTATUS STDCALL LpcRequestPort (IN PEPORT Port,
|
||||
NTSTATUS STDCALL LpcRequestPort (IN PVOID PortObject,
|
||||
IN PPORT_MESSAGE LpcMessage)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PEPORT Port = (PEPORT)PortObject;
|
||||
|
||||
DPRINT("LpcRequestPort(PortHandle %08x, LpcMessage %08x)\n", Port, LpcMessage);
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
<define name="__NO_CTYPE_INLINES" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="WIN9X_COMPAT_SPINLOCK" />
|
||||
<if property="NTLPC" value="1">
|
||||
<define name="NTLPC" />
|
||||
</if>
|
||||
<include base="cmlib">.</include>
|
||||
<include base="ntoskrnl">include</include>
|
||||
<include base="ReactOS">include/reactos/drivers</include>
|
||||
|
@ -220,19 +223,35 @@
|
|||
<file>loader.c</file>
|
||||
<file>rtl.c</file>
|
||||
</directory>
|
||||
<directory name="lpc">
|
||||
<file>close.c</file>
|
||||
<file>complete.c</file>
|
||||
<file>connect.c</file>
|
||||
<file>create.c</file>
|
||||
<file>listen.c</file>
|
||||
<file>port.c</file>
|
||||
<file>query.c</file>
|
||||
<file>queue.c</file>
|
||||
<file>receive.c</file>
|
||||
<file>reply.c</file>
|
||||
<file>send.c</file>
|
||||
</directory>
|
||||
<if property="NTLPC" value="0">
|
||||
<directory name="lpc">
|
||||
<file>close.c</file>
|
||||
<file>complete.c</file>
|
||||
<file>connect.c</file>
|
||||
<file>create.c</file>
|
||||
<file>listen.c</file>
|
||||
<file>port.c</file>
|
||||
<file>query.c</file>
|
||||
<file>queue.c</file>
|
||||
<file>receive.c</file>
|
||||
<file>reply.c</file>
|
||||
<file>send.c</file>
|
||||
</directory>
|
||||
</if>
|
||||
<if property="NTLPC" value="1">
|
||||
<directory name="lpc">
|
||||
<directory name="ntlpc">
|
||||
<file>close.c</file>
|
||||
<file>complete.c</file>
|
||||
<file>connect.c</file>
|
||||
<file>create.c</file>
|
||||
<file>listen.c</file>
|
||||
<file>port.c</file>
|
||||
<file>reply.c</file>
|
||||
<file>send.c</file>
|
||||
</directory>
|
||||
</directory>
|
||||
</if>
|
||||
<directory name="mm">
|
||||
<if property="ARCH" value="i386">
|
||||
<directory name="i386">
|
||||
|
|
|
@ -361,7 +361,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
|||
{
|
||||
HANDLE hProcess;
|
||||
PEPROCESS Process, Parent;
|
||||
PEPORT ExceptionPortObject;
|
||||
PVOID ExceptionPortObject;
|
||||
PDEBUG_OBJECT DebugObject;
|
||||
PSECTION_OBJECT SectionObject;
|
||||
NTSTATUS Status, AccessStatus;
|
||||
|
|
|
@ -486,7 +486,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
|||
HANDLE PortHandle = NULL;
|
||||
HANDLE TokenHandle = NULL;
|
||||
PROCESS_SESSION_INFORMATION SessionInfo = {0};
|
||||
PEPORT ExceptionPort;
|
||||
PVOID ExceptionPort;
|
||||
PAGED_CODE();
|
||||
|
||||
/* Verify Information Class validity */
|
||||
|
|
Loading…
Reference in a new issue