a99c919e06a9f65047780d0250a6ced3deba8d64
[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 typedef enum
9 {
10 UNUSED_MSG_TYPE = 0x0, /* ReactOS */
11 LPC_NEW_MESSAGE = 0x0, /* NT */
12 LPC_REQUEST = 0x1,
13 LPC_REPLY = 0x2,
14 LPC_DATAGRAM = 0x3,
15 LPC_LOST_REPLY = 0x4,
16 LPC_PORT_CLOSED = 0x5,
17 LPC_CLIENT_DIED = 0x6,
18 LPC_EXCEPTION = 0x7,
19 LPC_DEBUG_EVENT = 0x8,
20 LPC_ERROR_EVENT = 0x9,
21 LPC_CONNECTION_REQUEST = 0xa,
22 LPC_CONNECTION_REFUSED = 0xb
23
24 } LPC_TYPE, *PLPC_TYPE;
25
26 typedef struct _LPC_SECTION_WRITE
27 {
28 ULONG Length;
29 HANDLE SectionHandle;
30 ULONG SectionOffset;
31 ULONG ViewSize;
32 PVOID ViewBase;
33 PVOID TargetViewBase;
34 } LPC_SECTION_WRITE, *PLPC_SECTION_WRITE;
35
36 typedef struct _LPC_SECTION_READ
37 {
38 ULONG Length;
39 ULONG ViewSize;
40 PVOID ViewBase;
41 } LPC_SECTION_READ, *PLPC_SECTION_READ;
42
43 typedef struct _LPC_MESSAGE_HEADER
44 {
45 USHORT DataSize;
46 USHORT MessageSize;
47 // LPC_TYPE MessageType;
48 USHORT MessageType;
49 USHORT VirtualRangesOffset;
50 CLIENT_ID Cid;
51 ULONG MessageId;
52 ULONG SharedSectionSize;
53 } LPC_MESSAGE, *PLPC_MESSAGE;
54
55 typedef struct _LPC_TERMINATION_MESSAGE
56 {
57 LPC_MESSAGE Header;
58 TIME CreationTime;
59 } LPC_TERMINATION_MESSAGE, *PLPC_TERMINATION_MESSAGE;
60
61 typedef struct _LPC_DEBUG_MESSAGE
62 {
63 LPC_MESSAGE Header;
64 ULONG EventCode;
65 ULONG Status;
66 union {
67 struct {
68 EXCEPTION_RECORD ExceptionRecord;
69 ULONG FirstChance;
70 } Exception;
71 struct {
72 ULONG Reserved;
73 PVOID StartAddress;
74 } CreateThread;
75 struct {
76 ULONG Reserved;
77 HANDLE FileHandle;
78 PVOID Base;
79 ULONG PointerToSymbolTable;
80 ULONG NumberOfSymbols;
81 ULONG Reserved2;
82 PVOID EntryPoint;
83 } CreateProcess;
84 struct {
85 ULONG ExitCode;
86 } ExitThread;
87 struct {
88 ULONG ExitCode;
89 } ExitProcess;
90 struct {
91 HANDLE FileHandle;
92 PVOID Base;
93 ULONG PointerToSymbolTable;
94 ULONG NumberOfSymbols;
95 } LoadDll;
96 struct {
97 PVOID Base;
98 } UnloadDll;
99 #ifdef ANONYMOUSUNIONS
100 };
101 #else
102 } u;
103 #endif
104 } LPC_DEBUG_MESSAGE, * PLPC_DEBUG_MESSAGE;
105
106 typedef struct _LPC_MAX_MESSAGE
107 {
108 LPC_MESSAGE Header;
109 BYTE Data[MAX_MESSAGE_DATA];
110 } LPC_MAX_MESSAGE, *PLPC_MAX_MESSAGE;
111
112 #define PORT_MESSAGE_TYPE(m) (LPC_TYPE)((m).Header.MessageType)
113
114 #ifndef __USE_NT_LPC__
115 NTSTATUS STDCALL NtAcceptConnectPort (PHANDLE PortHandle,
116 HANDLE NamedPortHandle,
117 PLPC_MESSAGE ServerReply,
118 BOOLEAN AcceptIt,
119 PLPC_SECTION_WRITE WriteMap,
120 PLPC_SECTION_READ ReadMap);
121 #else
122 NTSTATUS STDCALL NtAcceptConnectPort (PHANDLE PortHandle,
123 ULONG PortIdentifier,
124 PLPC_MESSAGE ServerReply,
125 BOOLEAN AcceptIt,
126 PLPC_SECTION_WRITE WriteMap,
127 PLPC_SECTION_READ ReadMap);
128 #endif /* ndef __USE_NT_LPC__ */
129
130 NTSTATUS STDCALL NtCompleteConnectPort (HANDLE PortHandle);
131
132 NTSTATUS STDCALL NtConnectPort(PHANDLE PortHandle,
133 PUNICODE_STRING PortName,
134 PSECURITY_QUALITY_OF_SERVICE SecurityQos,
135 PLPC_SECTION_WRITE SectionInfo,
136 PLPC_SECTION_READ MapInfo,
137 PULONG MaxMessageSize,
138 PVOID ConnectInfo,
139 PULONG ConnectInfoLength);
140
141 NTSTATUS STDCALL NtReplyWaitReplyPort (HANDLE PortHandle,
142 PLPC_MESSAGE ReplyMessage);
143
144 NTSTATUS STDCALL NtCreatePort(PHANDLE PortHandle,
145 POBJECT_ATTRIBUTES ObjectAttributes,
146 ULONG MaxConnectInfoLength,
147 ULONG MaxDataLength,
148 ULONG NPMessageQueueSize OPTIONAL);
149
150 NTSTATUS STDCALL NtCreateWaitablePort(PHANDLE PortHandle,
151 POBJECT_ATTRIBUTES ObjectAttributes,
152 ULONG MaxConnectInfoLength,
153 ULONG MaxDataLength,
154 ULONG NPMessageQueueSize OPTIONAL);
155
156 NTSTATUS STDCALL NtImpersonateClientOfPort (HANDLE PortHandle,
157 PLPC_MESSAGE ClientMessage);
158
159 NTSTATUS STDCALL NtListenPort (HANDLE PortHandle,
160 PLPC_MESSAGE LpcMessage);
161
162 NTSTATUS STDCALL NtQueryInformationPort (HANDLE PortHandle,
163 CINT PortInformationClass,
164 PVOID PortInformation,
165 ULONG PortInformationLength,
166 PULONG ReturnLength);
167 NTSTATUS STDCALL NtReplyPort (HANDLE PortHandle,
168 PLPC_MESSAGE LpcReply);
169 NTSTATUS STDCALL NtReplyWaitReceivePort (HANDLE PortHandle,
170 PULONG PortId,
171 PLPC_MESSAGE MessageReply,
172 PLPC_MESSAGE MessageRequest);
173 NTSTATUS STDCALL NtRequestPort (HANDLE PortHandle,
174 PLPC_MESSAGE LpcMessage);
175
176 NTSTATUS STDCALL NtRequestWaitReplyPort (HANDLE PortHandle,
177 PLPC_MESSAGE LpcReply,
178 PLPC_MESSAGE LpcRequest);
179
180 NTSTATUS STDCALL NtReadRequestData (HANDLE PortHandle,
181 PLPC_MESSAGE Message,
182 ULONG Index,
183 PVOID Buffer,
184 ULONG BufferLength,
185 PULONG ReturnLength);
186
187 NTSTATUS STDCALL NtWriteRequestData (HANDLE PortHandle,
188 PLPC_MESSAGE Message,
189 ULONG Index,
190 PVOID Buffer,
191 ULONG BufferLength,
192 PULONG ReturnLength);
193
194
195 #endif /* __INCLUDE_NAPI_LPC_H */