6f807956a70c795513eca310a46a77167970b6a3
[reactos.git] / reactos / include / napi / lpc.h
1 #ifndef __INCLUDE_NAPI_LPC_H
2 #define __INCLUDE_NAPI_LPC_H
3
4 #include <ntos/security.h>
5
6 #define MAX_MESSAGE_DATA (0x130)
7
8 #define UNUSED_MSG_TYPE (0x0)
9 #define LPC_REQUEST (0x1)
10 #define LPC_REPLY (0x2)
11 #define LPC_DATAGRAM (0x3)
12 #define LPC_LOST_REPLY (0x4)
13 #define LPC_PORT_CLOSED (0x5)
14 #define LPC_CLIENT_DIED (0x6)
15 #define LPC_EXCEPTION (0x7)
16 #define LPC_DEBUG_EVENT (0x8)
17 #define LPC_ERROR_EVENT (0x9)
18 #define LPC_CONNECTION_REQUEST (0xa)
19 #define LPC_CONNECTION_REFUSED (0xb)
20
21 typedef struct _LPC_SECTION_WRITE
22 {
23 ULONG Length;
24 HANDLE SectionHandle;
25 ULONG SectionOffset;
26 ULONG ViewSize;
27 PVOID ViewBase;
28 PVOID TargetViewBase;
29 } LPC_SECTION_WRITE, *PLPC_SECTION_WRITE;
30
31 typedef struct _LPC_SECTION_READ
32 {
33 ULONG Length;
34 ULONG ViewSize;
35 PVOID ViewBase;
36 } LPC_SECTION_READ, *PLPC_SECTION_READ;
37
38 typedef struct _LPC_MESSAGE_HEADER
39 {
40 USHORT DataSize;
41 USHORT MessageSize;
42 USHORT MessageType;
43 USHORT VirtualRangesOffset;
44 CLIENT_ID Cid;
45 ULONG MessageId;
46 ULONG SharedSectionSize;
47 } LPC_MESSAGE_HEADER, *PLPC_MESSAGE_HEADER;
48
49 typedef struct _LPC_TERMINATION_MESSAGE
50 {
51 LPC_MESSAGE_HEADER Header;
52 TIME CreationTime;
53 } LPC_TERMINATION_MESSAGE, *PLPC_TERMINATION_MESSAGE;
54
55 typedef LPC_MESSAGE_HEADER LPC_MESSAGE, *PLPC_MESSAGE;
56
57 typedef struct _LPC_MAX_MESSAGE
58 {
59 LPC_MESSAGE_HEADER Header;
60 BYTE Data[MAX_MESSAGE_DATA];
61 } LPC_MAX_MESSAGE, *PLPC_MAX_MESSAGE;
62
63 #define PORT_MESSAGE_TYPE(m) (USHORT)((m).Header.MessageType)
64
65 NTSTATUS STDCALL NtAcceptConnectPort (PHANDLE PortHandle,
66 HANDLE NamedPortHandle,
67 PLPC_MESSAGE ServerReply,
68 BOOLEAN AcceptIt,
69 PLPC_SECTION_WRITE WriteMap,
70 PLPC_SECTION_READ ReadMap);
71
72 NTSTATUS STDCALL NtCompleteConnectPort (HANDLE PortHandle);
73
74 NTSTATUS STDCALL NtConnectPort(PHANDLE PortHandle,
75 PUNICODE_STRING PortName,
76 PSECURITY_QUALITY_OF_SERVICE SecurityQos,
77 PLPC_SECTION_WRITE SectionInfo,
78 PLPC_SECTION_READ MapInfo,
79 PULONG MaxMessageSize,
80 PVOID ConnectInfo,
81 PULONG ConnectInfoLength);
82
83 NTSTATUS STDCALL NtReplyWaitReplyPort (HANDLE PortHandle,
84 PLPC_MESSAGE ReplyMessage);
85
86 NTSTATUS STDCALL NtCreatePort(PHANDLE PortHandle,
87 POBJECT_ATTRIBUTES ObjectAttributes,
88 ULONG MaxConnectInfoLength,
89 ULONG MaxDataLength,
90 ULONG NPMessageQueueSize OPTIONAL);
91
92 NTSTATUS STDCALL NtCreateWaitablePort(PHANDLE PortHandle,
93 POBJECT_ATTRIBUTES ObjectAttributes,
94 ULONG MaxConnectInfoLength,
95 ULONG MaxDataLength,
96 ULONG NPMessageQueueSize OPTIONAL);
97
98 NTSTATUS STDCALL NtImpersonateClientOfPort (HANDLE PortHandle,
99 PLPC_MESSAGE ClientMessage);
100
101 NTSTATUS STDCALL NtListenPort (HANDLE PortHandle,
102 PLPC_MESSAGE LpcMessage);
103
104 NTSTATUS STDCALL NtQueryInformationPort (HANDLE PortHandle,
105 CINT PortInformationClass,
106 PVOID PortInformation,
107 ULONG PortInformationLength,
108 PULONG ReturnLength);
109 NTSTATUS STDCALL NtReplyPort (HANDLE PortHandle,
110 PLPC_MESSAGE LpcReply);
111 NTSTATUS STDCALL NtReplyWaitReceivePort (HANDLE PortHandle,
112 PULONG PortId,
113 PLPC_MESSAGE MessageReply,
114 PLPC_MESSAGE MessageRequest);
115 NTSTATUS STDCALL NtRequestPort (HANDLE PortHandle,
116 PLPC_MESSAGE LpcMessage);
117
118 NTSTATUS STDCALL NtRequestWaitReplyPort (HANDLE PortHandle,
119 PLPC_MESSAGE LpcReply,
120 PLPC_MESSAGE LpcRequest);
121
122 NTSTATUS STDCALL NtReadRequestData (HANDLE PortHandle,
123 PLPC_MESSAGE Message,
124 ULONG Index,
125 PVOID Buffer,
126 ULONG BufferLength,
127 PULONG ReturnLength);
128
129 NTSTATUS STDCALL NtWriteRequestData (HANDLE PortHandle,
130 PLPC_MESSAGE Message,
131 ULONG Index,
132 PVOID Buffer,
133 ULONG BufferLength,
134 PULONG ReturnLength);
135
136
137 #endif /* __INCLUDE_NAPI_LPC_H */