Something went wrong. Try again.
Reactos
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297/*++ NDK Version: 0098
Copyright (c) Alex Ionescu. All rights reserved.
Header Name:
lpctypes.h
Abstract:
Type definitions for the Local Procedure Call.
Author:
Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
--*/
#ifndef _LPCTYPES_H#define _LPCTYPES_H
//// Dependencies//#include <umtypes.h>//#include <pstypes.h>
#ifndef NTOS_MODE_USER
//// Kernel Exported Object Types//extern POBJECT_TYPE NTSYSAPI LpcPortObjectType;
#endif // !NTOS_MODE_USER
//// Internal helper macro//#define N_ROUND_UP(x,s) \ (((ULONG)(x)+(s)-1) & ~((ULONG)(s)-1))
//// Port Object Access Masks//#define PORT_CONNECT 0x1#define PORT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \ SYNCHRONIZE | \ PORT_CONNECT)
//// 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//typedef enum _LPC_TYPE{ LPC_NEW_MESSAGE, LPC_REQUEST, LPC_REPLY, LPC_DATAGRAM, LPC_LOST_REPLY, LPC_PORT_CLOSED, LPC_CLIENT_DIED, LPC_EXCEPTION, LPC_DEBUG_EVENT, LPC_ERROR_EVENT, LPC_CONNECTION_REQUEST, LPC_CONNECTION_REFUSED, LPC_MAXIMUM} LPC_TYPE;
//// Information Classes for NtQueryInformationPort//typedef enum _PORT_INFORMATION_CLASS{ PortNoInformation} PORT_INFORMATION_CLASS;
#ifdef NTOS_MODE_USER
//// Maximum message size that can be sent through an LPC Port without a section//#ifdef _WIN64#define PORT_MAXIMUM_MESSAGE_LENGTH 512#else#define PORT_MAXIMUM_MESSAGE_LENGTH 256#endif
//// Portable LPC Types for 32/64-bit compatibility//#ifdef USE_LPC6432#define LPC_CLIENT_ID CLIENT_ID64#define LPC_SIZE_T ULONGLONG#define LPC_PVOID ULONGLONG#define LPC_HANDLE ULONGLONG#else#define LPC_CLIENT_ID CLIENT_ID#define LPC_SIZE_T SIZE_T#define LPC_PVOID PVOID#define LPC_HANDLE HANDLE#endif
//// LPC Port Message//typedef struct _PORT_MESSAGE{ union { struct { CSHORT DataLength; CSHORT TotalLength; } s1; ULONG Length; } u1; union { struct { CSHORT Type; CSHORT DataInfoOffset; } s2; ULONG ZeroInit; } u2; union { LPC_CLIENT_ID ClientId; double DoNotUseThisField; }; ULONG MessageId; union { LPC_SIZE_T ClientViewSize; ULONG CallbackId; };} PORT_MESSAGE, *PPORT_MESSAGE;
//// Local and Remove Port Views//typedef struct _PORT_VIEW{ ULONG Length; LPC_HANDLE SectionHandle; ULONG SectionOffset; LPC_SIZE_T ViewSize; LPC_PVOID ViewBase; LPC_PVOID ViewRemoteBase;} PORT_VIEW, *PPORT_VIEW;
typedef struct _REMOTE_PORT_VIEW{ ULONG Length; LPC_SIZE_T ViewSize; LPC_PVOID ViewBase;} REMOTE_PORT_VIEW, *PREMOTE_PORT_VIEW;
//// LPC Kernel-Mode Message Structures defined for size only//typedef struct _LPCP_MESSAGE{ UCHAR Data[0x14]; PORT_MESSAGE Request;} LPCP_MESSAGE;
typedef struct _LPCP_CONNECTION_MESSAGE{ UCHAR Data[0x2C];} LPCP_CONNECTION_MESSAGE;
#else
//// LPC Paged and Non-Paged Port Queues//typedef struct _LPCP_NONPAGED_PORT_QUEUE{ KSEMAPHORE Semaphore; struct _LPCP_PORT_OBJECT *BackPointer;} LPCP_NONPAGED_PORT_QUEUE, *PLPCP_NONPAGED_PORT_QUEUE;
typedef struct _LPCP_PORT_QUEUE{ PLPCP_NONPAGED_PORT_QUEUE NonPagedPortQueue; PKSEMAPHORE Semaphore; LIST_ENTRY ReceiveHead;} LPCP_PORT_QUEUE, *PLPCP_PORT_QUEUE;
//// LPC Port Object//typedef struct _LPCP_PORT_OBJECT{ struct _LPCP_PORT_OBJECT *ConnectionPort; struct _LPCP_PORT_OBJECT *ConnectedPort; LPCP_PORT_QUEUE MsgQueue; CLIENT_ID Creator; PVOID ClientSectionBase; PVOID ServerSectionBase; PVOID PortContext; PETHREAD ClientThread; SECURITY_QUALITY_OF_SERVICE SecurityQos; SECURITY_CLIENT_CONTEXT StaticSecurity; LIST_ENTRY LpcReplyChainHead; LIST_ENTRY LpcDataInfoChainHead; union { PEPROCESS ServerProcess; PEPROCESS MappingProcess; }; ULONG MaxMessageLength; ULONG MaxConnectionInfoLength; ULONG Flags; KEVENT WaitEvent;} LPCP_PORT_OBJECT, *PLPCP_PORT_OBJECT;
//// LPC Kernel-Mode Message Structures//typedef struct _LPCP_MESSAGE{ union { LIST_ENTRY Entry; struct { SINGLE_LIST_ENTRY FreeEntry; ULONG Reserved0; }; }; PLPCP_PORT_OBJECT SenderPort; PETHREAD RepliedToThread; PVOID PortContext; PORT_MESSAGE Request;} LPCP_MESSAGE, *PLPCP_MESSAGE;
typedef struct _LPCP_CONNECTION_MESSAGE{ PORT_VIEW ClientView; PLPCP_PORT_OBJECT ClientPort; PVOID SectionToMap; REMOTE_PORT_VIEW ServerView;} LPCP_CONNECTION_MESSAGE, *PLPCP_CONNECTION_MESSAGE;
#endif
//// Client Died LPC Message//typedef struct _CLIENT_DIED_MSG{ PORT_MESSAGE h; LARGE_INTEGER CreateTime;} CLIENT_DIED_MSG, *PCLIENT_DIED_MSG;
//// Maximum total Kernel-Mode LPC Message Structure Size//#define LPCP_MAX_MESSAGE_SIZE \ N_ROUND_UP(PORT_MAXIMUM_MESSAGE_LENGTH + \ sizeof(LPCP_MESSAGE) + \ sizeof(LPCP_CONNECTION_MESSAGE), 16)
//// Maximum actual LPC Message Length//#define LPC_MAX_MESSAGE_LENGTH \ (LPCP_MAX_MESSAGE_SIZE - \ FIELD_OFFSET(LPCP_MESSAGE, Request))
//// Maximum actual size of LPC Message Data//#define LPC_MAX_DATA_LENGTH \ (LPC_MAX_MESSAGE_LENGTH - \ sizeof(PORT_MESSAGE) - \ sizeof(LPCP_CONNECTION_MESSAGE))
#endif // _LPCTYPES_H