46 RtlZeroMemory(&ObjectTypeInitializer,
sizeof(ObjectTypeInitializer));
48 ObjectTypeInitializer.
Length =
sizeof(ObjectTypeInitializer);
59 &ObjectTypeInitializer,
70 &ObjectTypeInitializer,
98 if (ThreadPort ==
NULL)
104 if ((
Port == ThreadPort) ||
113 (
Port->ConnectionPort == ThreadPort))
146 MessageId = ((
volatile PORT_MESSAGE*)ClientMessage)->MessageId;
157 MessageId = ClientMessage->MessageId;
177 DPRINT1(
"Port is not a communication port\n");
194 ConnectedPort =
Port->ConnectedPort;
197 DPRINT1(
"Failed to reference the connected port\n");
198 ConnectedPort =
NULL;
200 goto CleanupWithLock;
206 DPRINT1(
"Reply message has no impersonation flag set\n");
208 goto CleanupWithLock;
212 if ((
ClientThread->LpcReplyMessageId != MessageId) || (MessageId == 0))
214 DPRINT1(
"LpcReplyMessageId mismatch: 0x%lx/0x%lx.\n",
217 goto CleanupWithLock;
223 DPRINT1(
"LpcpValidateClientPort failed\n");
225 goto CleanupWithLock;
241 &ConnectedPort->SecurityQos,
246 DPRINT1(
"SeCreateClientSecurity failed\n");
258 if (ConnectedPort !=
NULL)
UINT CALLBACK ClientThread(_Inout_ PVOID Parameter)
#define NT_SUCCESS(StatCode)
static const WCHAR Cleanup[]
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
IN CINT OUT PVOID IN ULONG PortInformationLength
IN CINT OUT PVOID PortInformation
IN CINT PortInformationClass
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
VOID FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex)
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
#define EXCEPTION_EXECUTE_HANDLER
#define OBJ_VALID_ATTRIBUTES
VOID NTAPI ExInitializePagedLookasideList(IN PPAGED_LOOKASIDE_LIST Lookaside, IN PALLOCATE_FUNCTION Allocate OPTIONAL, IN PFREE_FUNCTION Free OPTIONAL, IN ULONG Flags, IN SIZE_T Size, IN ULONG Tag, IN USHORT Depth)
VOID NTAPI LpcpDeletePort(IN PVOID ObjectBody)
#define LPCP_THREAD_FLAG_NO_IMPERSONATION
VOID NTAPI LpcpClosePort(IN PEPROCESS Process OPTIONAL, IN PVOID Object, IN ACCESS_MASK GrantedAccess, IN ULONG ProcessHandleCount, IN ULONG SystemHandleCount)
FORCEINLINE PLPCP_PORT_OBJECT LpcpGetPortFromThread(IN PETHREAD Thread)
#define LPCP_SECURITY_DYNAMIC
#define LPCP_COMMUNICATION_PORT
#define LPCP_PORT_TYPE_MASK
struct _LPCP_NONPAGED_PORT_QUEUE LPCP_NONPAGED_PORT_QUEUE
struct _LPCP_PORT_OBJECT LPCP_PORT_OBJECT
#define LPCP_MAX_MESSAGE_SIZE
enum _PORT_INFORMATION_CLASS PORT_INFORMATION_CLASS
#define SeDeleteClientSecurity(C)
NTKERNELAPI NTSTATUS NTAPI SeCreateClientSecurity(IN PETHREAD Thread, IN PSECURITY_QUALITY_OF_SERVICE QualityOfService, IN BOOLEAN RemoteClient, OUT PSECURITY_CLIENT_CONTEXT ClientContext)
#define KeGetPreviousMode()
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
POBJECT_TYPE LpcPortObjectType
NTSTATUS NTAPI NtQueryInformationPort(IN HANDLE PortHandle, IN PORT_INFORMATION_CLASS PortInformationClass, OUT PVOID PortInformation, IN ULONG PortInformationLength, OUT PULONG ReturnLength)
PAGED_LOOKASIDE_LIST LpcpMessagesLookaside
NTSTATUS NTAPI NtImpersonateClientOfPort(IN HANDLE PortHandle, IN PPORT_MESSAGE ClientMessage)
POBJECT_TYPE LpcWaitablePortObjectType
static GENERIC_MAPPING LpcpPortMapping
BOOLEAN NTAPI LpcpValidateClientPort(PETHREAD ClientThread, PLPCP_PORT_OBJECT Port)
NTSTATUS NTAPI NtQueryPortInformationProcess(VOID)
BOOLEAN NTAPI LpcInitSystem(VOID)
NTSTATUS NTAPI PsLookupProcessThreadByCid(IN PCLIENT_ID Cid, OUT PEPROCESS *Process OPTIONAL, OUT PETHREAD *Thread)
NTSTATUS NTAPI SeImpersonateClientEx(_In_ PSECURITY_CLIENT_CONTEXT ClientContext, _In_opt_ PETHREAD ServerThread)
Extended function that impersonates a client.
#define STATUS_INVALID_PORT_HANDLE
#define STATUS_REPLY_MESSAGE_MISMATCH
#define STATUS_PORT_DISCONNECTED
#define STATUS_NOT_IMPLEMENTED
BOOLEAN FASTCALL ObReferenceObjectSafe(IN PVOID Object)
NTSTATUS NTAPI ObCreateObjectType(IN PUNICODE_STRING TypeName, IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer, IN PVOID Reserved, OUT POBJECT_TYPE *ObjectType)
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)
struct _LPCP_PORT_OBJECT * ConnectedPort
struct _LPCP_PORT_OBJECT * ConnectionPort
OB_CLOSE_METHOD CloseProcedure
GENERIC_MAPPING GenericMapping
ULONG DefaultPagedPoolCharge
OB_DELETE_METHOD DeleteProcedure
ULONG DefaultNonPagedPoolCharge
#define FIELD_OFFSET(t, f)
#define RtlZeroMemory(Destination, Length)
#define STATUS_ACCESS_DENIED
#define STATUS_UNSUCCESSFUL
struct LOOKASIDE_ALIGN _PAGED_LOOKASIDE_LIST PAGED_LOOKASIDE_LIST
_Out_ PCLIENT_ID ClientId
#define ObDereferenceObject
_In_ KPROCESSOR_MODE PreviousMode