36 ListHead = &
Port->LpcDataInfoChainHead;
37 NextEntry = ListHead->
Flink;
38 while (ListHead != NextEntry)
44 if ((
Message->Request.MessageId == MessageId) &&
56 NextEntry = NextEntry->
Flink;
118 for (ListEntry =
Port->LpcDataInfoChainHead.Flink;
119 ListEntry != &
Port->LpcDataInfoChainHead;
120 ListEntry = ListEntry->
Flink)
125 if ((
Message->Request.MessageId == MessageId) &&
146 "Destination/Origin: %p/%p. Data: %p. Length: %lx\n",
157 Origin->u2.s2.Type : MessageType & 0xFFFF;
169 Destination->ClientId.UniqueProcess = Origin->ClientId.UniqueProcess;
170 Destination->ClientId.UniqueThread = Origin->ClientId.UniqueThread;
175 Destination->ClientViewSize = Origin->ClientViewSize;
202 "Handle: %p. Message: %p.\n",
227 (
ULONG)CapturedReplyMessage.u1.s1.TotalLength)
246 if (((
ULONG)CapturedReplyMessage.u1.s1.TotalLength >
Port->MaxMessageLength) ||
247 ((
ULONG)CapturedReplyMessage.u1.s1.TotalLength <=
248 (
ULONG)CapturedReplyMessage.u1.s1.DataLength))
280 if ((WakeupThread->LpcReplyMessageId != CapturedReplyMessage.
MessageId) ||
296 &CapturedReplyMessage,
313 Message->RepliedToThread = WakeupThread;
316 WakeupThread->LpcReplyMessageId = 0;
320 if (!(WakeupThread->LpcExitThreadCalled) &&
340 CapturedReplyMessage.CallbackId,
374 ULONG ConnectionInfoLength;
378 "Handle: %p. Messages: %p/%p. Context: %p\n",
389 if (PortContext !=
NULL)
425 (
ULONG)CapturedReplyMessage.u1.s1.TotalLength)
448 if (((
ULONG)CapturedReplyMessage.u1.s1.TotalLength >
Port->MaxMessageLength) ||
449 ((
ULONG)CapturedReplyMessage.u1.s1.TotalLength <=
450 (
ULONG)CapturedReplyMessage.u1.s1.DataLength))
465 ConnectionPort = ReceivePort =
Port;
474 ConnectionPort = ReceivePort =
Port->ConnectionPort;
524 if ((WakeupThread->LpcReplyMessageId != CapturedReplyMessage.
MessageId) ||
541 &CapturedReplyMessage,
559 Message->RepliedToThread = WakeupThread;
562 WakeupThread->LpcReplyMessageId = 0;
566 if (!(WakeupThread->LpcExitThreadCalled) &&
586 CapturedReplyMessage.CallbackId,
652 "Request Messages: %p/%p\n",
657 ConnectionInfoLength =
Message->Request.u1.s1.DataLength -
661 *ReceiveMessage =
Message->Request;
668 ConnectionInfoLength);
669 ReceiveMessage->u1.s1.DataLength = (
CSHORT)ConnectionInfoLength;
672 ConnectionInfoLength);
675 if (PortContext) *PortContext =
NULL;
681 "Non-Reply Messages: %p/%p\n",
693 if (PortContext) *PortContext =
Message->PortContext;
696 if (
Message->Request.u2.s2.DataInfoOffset)
730 "Port: %p. Status: %d\n",
787 PVOID DataInfoBaseAddress;
811 if (CapturedMessage.u2.s2.DataInfoOffset == 0)
835 DPRINT1(
"Failed to lookup client thread for [0x%lx:0x%lx]: 0x%ls\n",
848 DPRINT1(
"LpcReplyMessageId mismatch: 0x%lx/0x%lx.\n",
851 goto CleanupWithLock;
857 DPRINT1(
"LpcpValidateClientPort failed\n");
859 goto CleanupWithLock;
866 if (InfoMessage ==
NULL)
868 DPRINT1(
"LpcpFindDataInfoMessage failed\n");
870 goto CleanupWithLock;
879 DPRINT1(
"Message data index %lu out of bounds (%lu in msg)\n",
882 goto CleanupWithLock;
888 DPRINT1(
"Trying to read more data (%lu) than available (%lu)\n",
891 goto CleanupWithLock;
895 DataInfoBaseAddress = DataInfo->
Entries[
Index].BaseAddress;
939 DPRINT1(
"Exception writing ReturnLength, ignoring\n");
#define ALIGN_UP_BY(size, align)
UINT CALLBACK ClientThread(_Inout_ PVOID Parameter)
#define NT_SUCCESS(StatCode)
static const WCHAR Message[]
static const WCHAR Cleanup[]
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define PsGetCurrentThread()
#define RemoveHeadList(ListHead)
#define InitializeListHead(ListHead)
VOID NTAPI KeClearEvent(IN PKEVENT Event)
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
#define EXCEPTION_EXECUTE_HANDLER
VOID NTAPI LpcpFreeToPortZone(IN PLPCP_MESSAGE Message, IN ULONG LockFlags)
POBJECT_TYPE LpcPortObjectType
#define LPCTRACE(x, fmt,...)
#define LPCP_LOCK_RELEASE
BOOLEAN NTAPI LpcpValidateClientPort(PETHREAD ClientThread, PLPCP_PORT_OBJECT Port)
#define LpcpGetMessageType(x)
#define LpcpCompleteWait(s)
#define LpcpReceiveWait(s, w)
FORCEINLINE PLPCP_MESSAGE LpcpGetMessageFromThread(IN PETHREAD Thread)
FORCEINLINE PLPCP_DATA_INFO LpcpGetDataInfoFromMessage(PPORT_MESSAGE Message)
static __inline PLPCP_MESSAGE LpcpAllocateFromPortZone(VOID)
#define LPCP_WAITABLE_PORT
#define LPCP_PORT_TYPE_MASK
struct _LPCP_CONNECTION_MESSAGE * PLPCP_CONNECTION_MESSAGE
struct _LPCP_CONNECTION_MESSAGE LPCP_CONNECTION_MESSAGE
#define LPCP_UNCONNECTED_PORT
#define LPC_CONNECTION_REQUEST
#define KeGetPreviousMode()
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
NTSTATUS NTAPI MmCopyVirtualMemory(IN PEPROCESS SourceProcess, IN PVOID SourceAddress, IN PEPROCESS TargetProcess, OUT PVOID TargetAddress, IN SIZE_T BufferSize, IN KPROCESSOR_MODE PreviousMode, OUT PSIZE_T ReturnSize)
NTSTATUS NTAPI NtReplyPort(IN HANDLE PortHandle, IN PPORT_MESSAGE ReplyMessage)
PLPCP_MESSAGE NTAPI LpcpFindDataInfoMessage(IN PLPCP_PORT_OBJECT Port, IN ULONG MessageId, IN LPC_CLIENT_ID ClientId)
NTSTATUS NTAPI NtReplyWaitReplyPort(IN HANDLE PortHandle, IN PPORT_MESSAGE ReplyMessage)
NTSTATUS NTAPI NtWriteRequestData(IN HANDLE PortHandle, IN PPORT_MESSAGE Message, IN ULONG Index, IN PVOID Buffer, IN ULONG BufferLength, OUT PULONG ReturnLength)
NTSTATUS NTAPI LpcpCopyRequestData(IN BOOLEAN Write, IN HANDLE PortHandle, IN PPORT_MESSAGE Message, IN ULONG Index, IN PVOID Buffer, IN ULONG BufferLength, OUT PULONG ReturnLength)
VOID NTAPI LpcpMoveMessage(IN PPORT_MESSAGE Destination, IN PPORT_MESSAGE Origin, IN PVOID Data, IN ULONG MessageType, IN PCLIENT_ID ClientId)
VOID NTAPI LpcpSaveDataInfoMessage(IN PLPCP_PORT_OBJECT Port, IN PLPCP_MESSAGE Message, IN ULONG LockFlags)
NTSTATUS NTAPI NtReplyWaitReceivePortEx(IN HANDLE PortHandle, OUT PVOID *PortContext OPTIONAL, IN PPORT_MESSAGE ReplyMessage OPTIONAL, OUT PPORT_MESSAGE ReceiveMessage, IN PLARGE_INTEGER Timeout OPTIONAL)
NTSTATUS NTAPI NtReadRequestData(IN HANDLE PortHandle, IN PPORT_MESSAGE Message, IN ULONG Index, IN PVOID Buffer, IN ULONG BufferLength, OUT PULONG ReturnLength)
NTSTATUS NTAPI NtReplyWaitReceivePort(IN HANDLE PortHandle, OUT PVOID *PortContext OPTIONAL, IN PPORT_MESSAGE ReplyMessage OPTIONAL, OUT PPORT_MESSAGE ReceiveMessage)
VOID NTAPI LpcpFreeDataInfoMessage(IN PLPCP_PORT_OBJECT Port, IN ULONG MessageId, IN ULONG CallbackId, IN CLIENT_ID ClientId)
NTSTATUS NTAPI PsLookupProcessThreadByCid(IN PCLIENT_ID Cid, OUT PEPROCESS *Process OPTIONAL, OUT PETHREAD *Thread)
#define STATUS_PORT_MESSAGE_TOO_LONG
#define STATUS_REPLY_MESSAGE_MISMATCH
#define STATUS_PORT_DISCONNECTED
#define STATUS_NOT_IMPLEMENTED
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_YIELD(__stmt)
#define ProbeForWritePointer(Ptr)
#define ProbeForReadLargeInteger(Ptr)
PULONG MinorVersion OPTIONAL
base of all file and directory entries
ULONG LpcReceivedMsgIdValid
ULONG LpcReceivedMessageId
struct _LIST_ENTRY * Flink
struct _LPCP_DATA_INFO::@1794 Entries[1]
#define RtlCopyMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
static BOOL Write(PBYTE Address, PBYTE Data, SIZE_T Size)
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
BOOL WINAPI ReplyMessage(_In_ LRESULT)
_Out_ PCLIENT_ID ClientId
#define ObDereferenceObject
#define ObReferenceObject
#define PsGetCurrentProcess
_In_ KPROCESSOR_MODE PreviousMode