ReactOS  0.4.14-dev-317-g96040ec
lpc_x.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LpcpGetMessageType(x)   ((x)->u2.s2.Type &~ LPC_KERNELMODE_MESSAGE)
 
#define LpcpReceiveWait(s, w)
 
#define LpcpReplyWait(s, w)
 
#define LpcpConnectWait(s, w)
 
#define LpcpCompleteWait(s)
 

Functions

static __inline PLPCP_MESSAGE LpcpAllocateFromPortZone (VOID)
 
FORCEINLINE PLPCP_MESSAGE LpcpGetMessageFromThread (IN PETHREAD Thread)
 
FORCEINLINE PLPCP_PORT_OBJECT LpcpGetPortFromThread (IN PETHREAD Thread)
 
FORCEINLINE VOID LpcpSetPortToThread (IN PETHREAD Thread, IN PLPCP_PORT_OBJECT Port)
 
FORCEINLINE PLPCP_DATA_INFO LpcpGetDataInfoFromMessage (PPORT_MESSAGE Message)
 

Macro Definition Documentation

◆ LpcpCompleteWait

#define LpcpCompleteWait (   s)
Value:
{ \
/* Release the semaphore */ \
LPCTRACE(LPC_SEND_DEBUG, "Release: %p\n", s); \
KeReleaseSemaphore(s, 1, 1, FALSE); \
}
#define LPC_SEND_DEBUG
Definition: lpc.h:23
GLdouble s
Definition: gl.h:2039

Definition at line 88 of file lpc_x.h.

◆ LpcpConnectWait

#define LpcpConnectWait (   s,
  w 
)
Value:
{ \
LPCTRACE(LPC_CONNECT_DEBUG, "Wait: %p\n", s); \
w, \
FALSE, \
NULL); \
LPCTRACE(LPC_CONNECT_DEBUG, "Wait done: %lx\n", Status);\
{ \
/* We were preempted by an APC */ \
{ \
/* It's still signaled, so wait on it */ \
KeWaitForSingleObject(s, \
FALSE, \
NULL); \
Status = STATUS_SUCCESS; \
} \
} \
}
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
smooth NULL
Definition: ftsmooth.c:416
GLdouble s
Definition: gl.h:2039
Status
Definition: gdiplustypes.h:24
#define STATUS_USER_APC
Definition: ntstatus.h:78
LONG NTAPI KeReadStateSemaphore(IN PKSEMAPHORE Semaphore)
Definition: semphobj.c:41
#define LPC_CONNECT_DEBUG
Definition: lpc.h:19
return STATUS_SUCCESS
Definition: btrfs.c:2938

Definition at line 60 of file lpc_x.h.

◆ LpcpGetMessageType

#define LpcpGetMessageType (   x)    ((x)->u2.s2.Type &~ LPC_KERNELMODE_MESSAGE)

Definition at line 12 of file lpc_x.h.

◆ LpcpReceiveWait

#define LpcpReceiveWait (   s,
  w 
)
Value:
{ \
LPCTRACE(LPC_REPLY_DEBUG, "Wait: %p\n", s); \
w, \
FALSE, \
NULL); \
LPCTRACE(LPC_REPLY_DEBUG, "Wait done: %lx\n", Status); \
}
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
smooth NULL
Definition: ftsmooth.c:416
#define LPC_REPLY_DEBUG
Definition: lpc.h:21
GLdouble s
Definition: gl.h:2039
Status
Definition: gdiplustypes.h:24

Definition at line 18 of file lpc_x.h.

◆ LpcpReplyWait

#define LpcpReplyWait (   s,
  w 
)
Value:
{ \
LPCTRACE(LPC_SEND_DEBUG, "Wait: %p\n", s); \
w, \
FALSE, \
NULL); \
LPCTRACE(LPC_SEND_DEBUG, "Wait done: %lx\n", Status); \
{ \
/* We were preempted by an APC */ \
{ \
/* It's still signaled, so wait on it */ \
KeWaitForSingleObject(s, \
FALSE, \
NULL); \
Status = STATUS_SUCCESS; \
} \
} \
}
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define LPC_SEND_DEBUG
Definition: lpc.h:23
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
smooth NULL
Definition: ftsmooth.c:416
GLdouble s
Definition: gl.h:2039
Status
Definition: gdiplustypes.h:24
#define STATUS_USER_APC
Definition: ntstatus.h:78
LONG NTAPI KeReadStateSemaphore(IN PKSEMAPHORE Semaphore)
Definition: semphobj.c:41
return STATUS_SUCCESS
Definition: btrfs.c:2938

Definition at line 32 of file lpc_x.h.

Function Documentation

◆ LpcpAllocateFromPortZone()

static __inline PLPCP_MESSAGE LpcpAllocateFromPortZone ( VOID  )
static

Definition at line 100 of file lpc_x.h.

101 {
103 
104  /* Allocate a message from the port zone while holding the lock */
106  Message = (PLPCP_MESSAGE)ExAllocateFromPagedLookasideList(&LpcpMessagesLookaside);
107  if (!Message)
108  {
109  /* Fail, and let caller cleanup */
111  return NULL;
112  }
113 
114  /* Initialize it */
115  InitializeListHead(&Message->Entry);
116  Message->RepliedToThread = NULL;
117  Message->Request.u2.ZeroInit = 0;
118 
119  /* Release the lock */
121  return Message;
122 }
KGUARDED_MUTEX LpcpLock
Definition: port.c:20
PAGED_LOOKASIDE_LIST LpcpMessagesLookaside
Definition: port.c:19
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:42
smooth NULL
Definition: ftsmooth.c:416
CHAR Message[80]
Definition: alive.c:5
struct _LPCP_MESSAGE * PLPCP_MESSAGE
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:53

Referenced by LpcRequestPort(), LpcRequestWaitReplyPort(), NtReplyPort(), NtReplyWaitReceivePortEx(), NtRequestPort(), NtRequestWaitReplyPort(), and NtSecureConnectPort().

◆ LpcpGetDataInfoFromMessage()

FORCEINLINE PLPCP_DATA_INFO LpcpGetDataInfoFromMessage ( PPORT_MESSAGE  Message)

Definition at line 170 of file lpc_x.h.

171 {
172  return (PLPCP_DATA_INFO)((PUCHAR)Message + Message->u2.s2.DataInfoOffset);
173 }
unsigned char * PUCHAR
Definition: retypes.h:3
CHAR Message[80]
Definition: alive.c:5

Referenced by LpcpCopyRequestData(), LpcpVerifyMessageDataInfo(), and NtRequestWaitReplyPort().

◆ LpcpGetMessageFromThread()

FORCEINLINE PLPCP_MESSAGE LpcpGetMessageFromThread ( IN PETHREAD  Thread)

Definition at line 129 of file lpc_x.h.

130 {
131  /* Check if the port flag is set */
132  if (((ULONG_PTR)Thread->LpcReplyMessage) & LPCP_THREAD_FLAG_IS_PORT)
133  {
134  /* The pointer is actually a port, not a message, so return NULL */
135  return NULL;
136  }
137 
138  /* Otherwise, this is a message. Return the pointer */
139  return (PLPCP_MESSAGE)((ULONG_PTR)Thread->LpcReplyMessage & ~LPCP_THREAD_FLAGS);
140 }
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
#define LPCP_THREAD_FLAG_IS_PORT
Definition: lpc.h:55
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define ULONG_PTR
Definition: config.h:101
#define LPCP_THREAD_FLAGS
Definition: lpc.h:57

Referenced by LpcExitThread(), LpcpDestroyPortQueue(), LpcpFreeConMsg(), LpcRequestWaitReplyPort(), NtAcceptConnectPort(), NtCompleteConnectPort(), NtReplyPort(), NtReplyWaitReceivePortEx(), and NtRequestWaitReplyPort().

◆ LpcpGetPortFromThread()

FORCEINLINE PLPCP_PORT_OBJECT LpcpGetPortFromThread ( IN PETHREAD  Thread)

Definition at line 144 of file lpc_x.h.

145 {
146  /* Check if the port flag is set */
147  if (((ULONG_PTR)Thread->LpcReplyMessage) & LPCP_THREAD_FLAG_IS_PORT)
148  {
149  /* The pointer is actually a port, return it */
150  return (PLPCP_PORT_OBJECT)((ULONG_PTR)Thread->LpcWaitingOnPort &
152  }
153 
154  /* Otherwise, this is a message. There is nothing to return */
155  return NULL;
156 }
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
#define LPCP_THREAD_FLAG_IS_PORT
Definition: lpc.h:55
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define ULONG_PTR
Definition: config.h:101
#define LPCP_THREAD_FLAGS
Definition: lpc.h:57

Referenced by LpcpValidateClientPort().

◆ LpcpSetPortToThread()

FORCEINLINE VOID LpcpSetPortToThread ( IN PETHREAD  Thread,
IN PLPCP_PORT_OBJECT  Port 
)

Definition at line 160 of file lpc_x.h.

162 {
163  /* Set the port object */
164  Thread->LpcWaitingOnPort = (PVOID)(((ULONG_PTR)Port) |
166 }
CPPORT Port[4]
Definition: headless.c:34
uint32_t ULONG_PTR
Definition: typedefs.h:63
void * PVOID
Definition: retypes.h:9
#define LPCP_THREAD_FLAG_IS_PORT
Definition: lpc.h:55
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653

Referenced by LpcRequestWaitReplyPort(), and NtRequestWaitReplyPort().