6 #define PORT_CONNECT 0x0001
7 #define PORT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1)
56 #define LPC_DATAGRAM 3
57 #define LPC_LOST_REPLY 4
58 #define LPC_PORT_CLOSED 5
59 #define LPC_CLIENT_DIED 6
60 #define LPC_EXCEPTION 7
61 #define LPC_DEBUG_EVENT 8
62 #define LPC_ERROR_EVENT 9
63 #define LPC_CONNECTION_REQUEST 10
65 #define LPC_KERNELMODE_MESSAGE (CSHORT)0x8000
66 #define LPC_NO_IMPERSONATE (CSHORT)0x4000
68 #define PORT_VALID_OBJECT_ATTRIBUTES OBJ_CASE_INSENSITIVE
71 #define PORT_MAXIMUM_MESSAGE_LENGTH 512
73 #define PORT_MAXIMUM_MESSAGE_LENGTH 256
76 #define LPC_MAX_CONNECTION_INFO_SIZE (16 * sizeof(ULONG_PTR))
78 #define PORT_TOTAL_MAXIMUM_MESSAGE_LENGTH \
79 ((PORT_MAXIMUM_MESSAGE_LENGTH + sizeof(PORT_MESSAGE) + LPC_MAX_CONNECTION_INFO_SIZE + 0xf) & ~0xf)
172 _Out_ PHANDLE PortHandle,
174 _In_ ULONG MaxConnectionInfoLength,
175 _In_ ULONG MaxMessageLength,
176 _In_opt_ ULONG MaxPoolUsage
183 _Out_ PHANDLE PortHandle,
185 _In_ ULONG MaxConnectionInfoLength,
186 _In_ ULONG MaxMessageLength,
187 _In_opt_ ULONG MaxPoolUsage
196 _Out_ PHANDLE PortHandle,
198 _In_ PSECURITY_QUALITY_OF_SERVICE SecurityQos,
199 _Inout_opt_ PPORT_VIEW ClientView,
200 _Inout_opt_ PREMOTE_PORT_VIEW ServerView,
201 _Out_opt_ PULONG MaxMessageLength,
202 _Inout_updates_bytes_to_opt_(*ConnectionInformationLength, *ConnectionInformationLength) PVOID ConnectionInformation,
203 _Inout_opt_ PULONG ConnectionInformationLength
210 _Out_ PHANDLE PortHandle,
212 _In_ PSECURITY_QUALITY_OF_SERVICE SecurityQos,
213 _Inout_opt_ PPORT_VIEW ClientView,
214 _In_opt_ PSID RequiredServerSid,
215 _Inout_opt_ PREMOTE_PORT_VIEW ServerView,
216 _Out_opt_ PULONG MaxMessageLength,
217 _Inout_updates_bytes_to_opt_(*ConnectionInformationLength, *ConnectionInformationLength) PVOID ConnectionInformation,
218 _Inout_opt_ PULONG ConnectionInformationLength
227 _In_ HANDLE PortHandle,
228 _Out_ PPORT_MESSAGE ConnectionRequest
235 _Out_ PHANDLE PortHandle,
236 _In_opt_ PVOID PortContext,
237 _In_ PPORT_MESSAGE ConnectionRequest,
238 _In_ BOOLEAN AcceptConnection,
239 _Inout_opt_ PPORT_VIEW ServerView,
240 _Out_opt_ PREMOTE_PORT_VIEW ClientView
247 _In_ HANDLE PortHandle
256 _In_ HANDLE PortHandle,
257 _In_reads_bytes_(RequestMessage->u1.s1.TotalLength) PPORT_MESSAGE RequestMessage
264 _In_ HANDLE PortHandle,
265 _In_reads_bytes_(RequestMessage->u1.s1.TotalLength) PPORT_MESSAGE RequestMessage,
266 _Out_ PPORT_MESSAGE ReplyMessage
273 _In_ HANDLE PortHandle,
274 _In_reads_bytes_(ReplyMessage->u1.s1.TotalLength) PPORT_MESSAGE ReplyMessage
281 _In_ HANDLE PortHandle,
282 _Inout_ PPORT_MESSAGE ReplyMessage
289 _In_ HANDLE PortHandle,
290 _Out_opt_ PVOID *PortContext,
291 _In_reads_bytes_opt_(ReplyMessage->u1.s1.TotalLength) PPORT_MESSAGE ReplyMessage,
292 _Out_ PPORT_MESSAGE ReceiveMessage
299 _In_ HANDLE PortHandle,
300 _Out_opt_ PVOID *PortContext,
301 _In_reads_bytes_opt_(ReplyMessage->u1.s1.TotalLength) PPORT_MESSAGE ReplyMessage,
302 _Out_ PPORT_MESSAGE ReceiveMessage,
303 _In_opt_ PLARGE_INTEGER Timeout
310 _In_ HANDLE PortHandle,
311 _In_ PPORT_MESSAGE Message
318 _In_ HANDLE PortHandle,
319 _In_ PPORT_MESSAGE Message,
320 _In_ ULONG DataEntryIndex,
321 _Out_writes_bytes_to_(BufferSize, *NumberOfBytesRead) PVOID Buffer,
322 _In_ SIZE_T BufferSize,
323 _Out_opt_ PSIZE_T NumberOfBytesRead
330 _In_ HANDLE PortHandle,
331 _In_ PPORT_MESSAGE Message,
332 _In_ ULONG DataEntryIndex,
333 _In_reads_bytes_(BufferSize) PVOID Buffer,
334 _In_ SIZE_T BufferSize,
335 _Out_opt_ PSIZE_T NumberOfBytesWritten
348 _In_ HANDLE PortHandle,
350 _Out_writes_bytes_to_(Length, *ReturnLength) PVOID PortInformation,
352 _Out_opt_ PULONG ReturnLength
360 #define ALPC_PORFLG_ALLOW_LPC_REQUESTS 0x20000 // rev
361 #define ALPC_PORFLG_WAITABLE_PORT 0x40000 // dbg
362 #define ALPC_PORFLG_SYSTEM_PROCESS 0x100000 // dbg
382 #define ALPC_MESSAGE_SECURITY_ATTRIBUTE 0x80000000
383 #define ALPC_MESSAGE_VIEW_ATTRIBUTE 0x40000000
384 #define ALPC_MESSAGE_CONTEXT_ATTRIBUTE 0x20000000
385 #define ALPC_MESSAGE_HANDLE_ATTRIBUTE 0x10000000
410 #define ALPC_COMPLETION_LIST_BUFFER_GRANULARITY_MASK 0x3f // dbg
424 ULONG AttributeFlags;
429 ULONG LastCallbackId;
449 #define ALPC_HANDLEFLG_DUPLICATE_SAME_ACCESS 0x10000
450 #define ALPC_HANDLEFLG_DUPLICATE_SAME_ATTRIBUTES 0x20000
451 #define ALPC_HANDLEFLG_DUPLICATE_INHERIT 0x80000
463 #define ALPC_SECFLG_CREATE_HANDLE 0x20000 // dbg
469 PSECURITY_QUALITY_OF_SERVICE
QoS;
474 #define ALPC_VIEWFLG_NOT_SECURE 0x40000
563 #if (PHNT_VERSION >= PHNT_VISTA)
571 _Out_ PHANDLE PortHandle,
573 _In_opt_ PALPC_PORT_ATTRIBUTES PortAttributes
580 _In_ HANDLE PortHandle,
588 _In_opt_ HANDLE PortHandle,
590 _Inout_updates_bytes_to_(Length, *ReturnLength) PVOID PortInformation,
592 _Out_opt_ PULONG ReturnLength
599 _In_ HANDLE PortHandle,
601 _In_reads_bytes_opt_(Length) PVOID PortInformation,
609 _In_ HANDLE PortHandle,
611 _In_opt_ HANDLE SectionHandle,
612 _In_ SIZE_T SectionSize,
613 _Out_ PALPC_HANDLE AlpcSectionHandle,
614 _Out_ PSIZE_T ActualSectionSize
621 _In_ HANDLE PortHandle,
622 _Reserved_ ULONG Flags,
623 _In_ ALPC_HANDLE SectionHandle
630 _In_ HANDLE PortHandle,
631 _Reserved_ ULONG Flags,
632 _In_ SIZE_T MessageSize,
633 _Out_ PALPC_HANDLE ResourceId
640 _In_ HANDLE PortHandle,
641 _Reserved_ ULONG Flags,
642 _In_ ALPC_HANDLE ResourceId
649 _In_ HANDLE PortHandle,
650 _Reserved_ ULONG Flags,
651 _Inout_ PALPC_DATA_VIEW_ATTR ViewAttributes
658 _In_ HANDLE PortHandle,
659 _Reserved_ ULONG Flags,
667 _In_ HANDLE PortHandle,
668 _Reserved_ ULONG Flags,
669 _Inout_ PALPC_SECURITY_ATTR SecurityAttribute
676 _In_ HANDLE PortHandle,
677 _Reserved_ ULONG Flags,
678 _In_ ALPC_HANDLE ContextHandle
685 _In_ HANDLE PortHandle,
686 _Reserved_ ULONG Flags,
687 _In_ ALPC_HANDLE ContextHandle
694 _In_ HANDLE PortHandle,
695 _In_ PPORT_MESSAGE PortMessage,
697 _Out_writes_bytes_to_opt_(Length, *ReturnLength) PVOID MessageInformation,
699 _Out_opt_ PULONG ReturnLength
702 #define ALPC_MSGFLG_REPLY_MESSAGE 0x1
703 #define ALPC_MSGFLG_LPC_MODE 0x2 // ?
704 #define ALPC_MSGFLG_RELEASE_MESSAGE 0x10000 // dbg
705 #define ALPC_MSGFLG_SYNC_REQUEST 0x20000 // dbg
706 #define ALPC_MSGFLG_WAIT_USER_MODE 0x100000
707 #define ALPC_MSGFLG_WAIT_ALERTABLE 0x200000
708 #define ALPC_MSGFLG_WOW64_CALL 0x80000000 // dbg
714 _Out_ PHANDLE PortHandle,
717 _In_opt_ PALPC_PORT_ATTRIBUTES PortAttributes,
719 _In_opt_ PSID RequiredServerSid,
720 _Inout_updates_bytes_to_opt_(*BufferLength, *BufferLength) PPORT_MESSAGE ConnectionMessage,
721 _Inout_opt_ PULONG BufferLength,
722 _Inout_opt_ PALPC_MESSAGE_ATTRIBUTES OutMessageAttributes,
723 _Inout_opt_ PALPC_MESSAGE_ATTRIBUTES InMessageAttributes,
724 _In_opt_ PLARGE_INTEGER Timeout
727 #if (PHNT_VERSION >= PHNT_WIN8)
732 _Out_ PHANDLE PortHandle,
735 _In_opt_ PALPC_PORT_ATTRIBUTES PortAttributes,
737 _In_opt_ PSECURITY_DESCRIPTOR ServerSecurityRequirements,
738 _Inout_updates_bytes_to_opt_(*BufferLength, *BufferLength) PPORT_MESSAGE ConnectionMessage,
739 _Inout_opt_ PSIZE_T BufferLength,
740 _Inout_opt_ PALPC_MESSAGE_ATTRIBUTES OutMessageAttributes,
741 _Inout_opt_ PALPC_MESSAGE_ATTRIBUTES InMessageAttributes,
742 _In_opt_ PLARGE_INTEGER Timeout
750 _Out_ PHANDLE PortHandle,
751 _In_ HANDLE ConnectionPortHandle,
754 _In_opt_ PALPC_PORT_ATTRIBUTES PortAttributes,
755 _In_opt_ PVOID PortContext,
756 _In_reads_bytes_(ConnectionRequest->u1.s1.TotalLength) PPORT_MESSAGE ConnectionRequest,
757 _Inout_opt_ PALPC_MESSAGE_ATTRIBUTES ConnectionMessageAttributes,
758 _In_ BOOLEAN AcceptConnection
765 _In_ HANDLE PortHandle,
767 _In_reads_bytes_opt_(SendMessage->u1.s1.TotalLength) PPORT_MESSAGE SendMessage,
768 _Inout_opt_ PALPC_MESSAGE_ATTRIBUTES SendMessageAttributes,
769 _Out_writes_bytes_to_opt_(*BufferLength, *BufferLength) PPORT_MESSAGE ReceiveMessage,
770 _Inout_opt_ PSIZE_T BufferLength,
771 _Inout_opt_ PALPC_MESSAGE_ATTRIBUTES ReceiveMessageAttributes,
772 _In_opt_ PLARGE_INTEGER Timeout
775 #define ALPC_CANCELFLG_TRY_CANCEL 0x1 // dbg
776 #define ALPC_CANCELFLG_NO_CONTEXT_CHECK 0x8
777 #define ALPC_CANCELFLGP_FLUSH 0x10000 // dbg
783 _In_ HANDLE PortHandle,
785 _In_ PALPC_CONTEXT_ATTR MessageContext
792 _In_ HANDLE PortHandle,
793 _In_ PPORT_MESSAGE Message,
797 #if (PHNT_VERSION >= PHNT_THRESHOLD)
802 _In_ HANDLE PortHandle,
803 _In_ PPORT_MESSAGE Message,
812 _Out_ PHANDLE ProcessHandle,
813 _In_ HANDLE PortHandle,
814 _In_ PPORT_MESSAGE PortMessage,
816 _In_ ACCESS_MASK DesiredAccess,
824 _Out_ PHANDLE ThreadHandle,
825 _In_ HANDLE PortHandle,
826 _In_ PPORT_MESSAGE PortMessage,
828 _In_ ACCESS_MASK DesiredAccess,
852 _In_ ULONG AttributeFlags,
853 _Out_opt_ PALPC_MESSAGE_ATTRIBUTES Buffer,
854 _In_ ULONG BufferSize,
855 _Out_ PULONG RequiredBufferSize
862 _In_ PALPC_MESSAGE_ATTRIBUTES Buffer,
863 _In_ ULONG AttributeFlag
870 _In_ HANDLE PortHandle,
871 _Out_ PALPC_COMPLETION_LIST_HEADER Buffer,
873 _In_ ULONG ConcurrencyCount,
874 _In_ ULONG AttributeFlags
881 _In_ HANDLE PortHandle
884 #if (PHNT_VERSION >= PHNT_WIN7)
890 _In_ HANDLE PortHandle
898 _In_ HANDLE PortHandle,
899 _In_ ULONG ConcurrencyCount
906 _Inout_ PVOID CompletionList
913 _Inout_ PVOID CompletionList
920 _In_ PVOID CompletionList,
921 _Out_ PULONG LastMessageId,
922 _Out_ PULONG LastCallbackId
929 _In_ PVOID CompletionList
936 _In_ PVOID CompletionList,
937 _Out_opt_ PALPC_MESSAGE_ATTRIBUTES *MessageAttributes
944 _Inout_ PVOID CompletionList,
945 _In_ PPORT_MESSAGE Message
949 PALPC_MESSAGE_ATTRIBUTES
952 _In_ PVOID CompletionList,
953 _In_ PPORT_MESSAGE Message