Added new 'bootcd' target.
[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_HEADER, *PLPC_MESSAGE_HEADER;
54
55 typedef struct _LPC_TERMINATION_MESSAGE
56 {
57 LPC_MESSAGE_HEADER Header;
58 TIME CreationTime;
59 } LPC_TERMINATION_MESSAGE, *PLPC_TERMINATION_MESSAGE;
60
61 typedef struct _LPC_DEBUG_MESSAGE
62 {
63 LPC_MESSAGE_HEADER 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 LPC_MESSAGE_HEADER LPC_MESSAGE, *PLPC_MESSAGE;
107
108 typedef struct _LPC_MAX_MESSAGE
109 {
110 LPC_MESSAGE_HEADER Header;
111 BYTE Data[MAX_MESSAGE_DATA];
112 } LPC_MAX_MESSAGE, *PLPC_MAX_MESSAGE;
113
114 #define PORT_MESSAGE_TYPE(m) (LPC_TYPE)((m).Header.MessageType)
115
116 #ifndef __USE_NT_LPC__
117 NTSTATUS STDCALL NtAcceptConnectPort (PHANDLE PortHandle,
118 HANDLE NamedPortHandle,
119 PLPC_MESSAGE ServerReply,
120 BOOLEAN AcceptIt,
121 PLPC_SECTION_WRITE WriteMap,
122 PLPC_SECTION_READ ReadMap);
123 #else
124 NTSTATUS STDCALL NtAcceptConnectPort (PHANDLE PortHandle,
125 ULONG PortIdentifier,
126 PLPC_MESSAGE ServerReply,
127 BOOLEAN AcceptIt,
128 PLPC_SECTION_WRITE WriteMap,
129 PLPC_SECTION_READ ReadMap);
130 #endif /* ndef __USE_NT_LPC__ */
131
132 NTSTATUS STDCALL NtCompleteConnectPort (HANDLE PortHandle);
133
134 NTSTATUS STDCALL NtConnectPort(PHANDLE PortHandle,
135 PUNICODE_STRING PortName,
136 PSECURITY_QUALITY_OF_SERVICE SecurityQos,
137 PLPC_SECTION_WRITE SectionInfo,
138 PLPC_SECTION_READ MapInfo,
139 PULONG MaxMessageSize,
140 PVOID ConnectInfo,
141 PULONG ConnectInfoLength);
142
143 NTSTATUS STDCALL NtReplyWaitReplyPort (HANDLE PortHandle,
144 PLPC_MESSAGE ReplyMessage);
145
146 NTSTATUS STDCALL NtCreatePort(PHANDLE PortHandle,
147 POBJECT_ATTRIBUTES ObjectAttributes,
148 ULONG MaxConnectInfoLength,
149 ULONG MaxDataLength,
150 ULONG NPMessageQueueSize OPTIONAL);
151
152 NTSTATUS STDCALL NtCreateWaitablePort(PHANDLE PortHandle,
153 POBJECT_ATTRIBUTES ObjectAttributes,
154 ULONG MaxConnectInfoLength,
155 ULONG MaxDataLength,
156 ULONG NPMessageQueueSize OPTIONAL);
157
158 NTSTATUS STDCALL NtImpersonateClientOfPort (HANDLE PortHandle,
159 PLPC_MESSAGE ClientMessage);
160
161 NTSTATUS STDCALL NtListenPort (HANDLE PortHandle,
162 PLPC_MESSAGE LpcMessage);
163
164 NTSTATUS STDCALL NtQueryInformationPort (HANDLE PortHandle,
165 CINT PortInformationClass,
166 PVOID PortInformation,
167 ULONG PortInformationLength,
168 PULONG ReturnLength);
169 NTSTATUS STDCALL NtReplyPort (HANDLE PortHandle,
170 PLPC_MESSAGE LpcReply);
171 NTSTATUS STDCALL NtReplyWaitReceivePort (HANDLE PortHandle,
172 PULONG PortId,
173 PLPC_MESSAGE MessageReply,
174 PLPC_MESSAGE MessageRequest);
175 NTSTATUS STDCALL NtRequestPort (HANDLE PortHandle,
176 PLPC_MESSAGE LpcMessage);
177
178 NTSTATUS STDCALL NtRequestWaitReplyPort (HANDLE PortHandle,
179 PLPC_MESSAGE LpcReply,
180 PLPC_MESSAGE LpcRequest);
181
182 NTSTATUS STDCALL NtReadRequestData (HANDLE PortHandle,
183 PLPC_MESSAGE Message,
184 ULONG Index,
185 PVOID Buffer,
186 ULONG BufferLength,
187 PULONG ReturnLength);
188
189 NTSTATUS STDCALL NtWriteRequestData (HANDLE PortHandle,
190 PLPC_MESSAGE Message,
191 ULONG Index,
192 PVOID Buffer,
193 ULONG BufferLength,
194 PULONG ReturnLength);
195
196
197 #endif /* __INCLUDE_NAPI_LPC_H */