1 /*++ NDK Version: 0098 2 3 Copyright (c) Alex Ionescu. All rights reserved. 4 5 Header Name: 6 7 lpcfuncs.h 8 9 Abstract: 10 11 Function definitions for the Local Procedure Call. 12 13 Author: 14 15 Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006 16 17 --*/ 18 19 #ifndef _LPCFUNCS_H 20 #define _LPCFUNCS_H 21 22 // 23 // Dependencies 24 // 25 #include <umtypes.h> 26 #include <lpctypes.h> 27 28 // 29 // LPC Exports 30 // 31 #ifndef NTOS_MODE_USER 32 NTKERNELAPI 33 NTSTATUS 34 NTAPI 35 LpcRequestWaitReplyPort( 36 _In_ PVOID Port, 37 _In_ PPORT_MESSAGE LpcMessageRequest, 38 _Out_ PPORT_MESSAGE LpcMessageReply 39 ); 40 41 NTSTATUS 42 NTAPI 43 LpcRequestPort( 44 _In_ PVOID Port, 45 _In_ PPORT_MESSAGE LpcMessage 46 ); 47 #endif 48 49 // 50 // Native calls 51 // 52 NTSYSCALLAPI 53 NTSTATUS 54 NTAPI 55 NtAcceptConnectPort( 56 _Out_ PHANDLE PortHandle, 57 _In_opt_ PVOID PortContext, 58 _In_ PPORT_MESSAGE ConnectionRequest, 59 _In_ BOOLEAN AcceptConnection, 60 _Inout_opt_ PPORT_VIEW ServerView, 61 _Out_opt_ PREMOTE_PORT_VIEW ClientView 62 ); 63 64 NTSYSCALLAPI 65 NTSTATUS 66 NTAPI 67 NtCompleteConnectPort( 68 _In_ HANDLE PortHandle 69 ); 70 71 NTSYSCALLAPI 72 NTSTATUS 73 NTAPI 74 NtConnectPort( 75 _Out_ PHANDLE PortHandle, 76 _In_ PUNICODE_STRING PortName, 77 _In_ PSECURITY_QUALITY_OF_SERVICE SecurityQos, 78 _Inout_opt_ PPORT_VIEW ClientView, 79 _Inout_opt_ PREMOTE_PORT_VIEW ServerView, 80 _Out_opt_ PULONG MaxMessageLength, 81 _Inout_opt_ PVOID ConnectionInformation, 82 _Inout_opt_ PULONG ConnectionInformationLength 83 ); 84 85 NTSYSCALLAPI 86 NTSTATUS 87 NTAPI 88 NtCreatePort( 89 _Out_ PHANDLE PortHandle, 90 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 91 _In_ ULONG MaxConnectionInfoLength, 92 _In_ ULONG MaxMessageLength, 93 _In_ ULONG MaxPoolUsage 94 ); 95 96 NTSYSCALLAPI 97 NTSTATUS 98 NTAPI 99 NtCreateWaitablePort( 100 _Out_ PHANDLE PortHandle, 101 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 102 _In_ ULONG MaxConnectInfoLength, 103 _In_ ULONG MaxDataLength, 104 _In_opt_ ULONG NPMessageQueueSize 105 ); 106 107 NTSYSCALLAPI 108 NTSTATUS 109 NTAPI 110 NtImpersonateClientOfPort( 111 _In_ HANDLE PortHandle, 112 _In_ PPORT_MESSAGE ClientMessage 113 ); 114 115 NTSYSCALLAPI 116 NTSTATUS 117 NTAPI 118 NtListenPort( 119 _In_ HANDLE PortHandle, 120 _In_ PPORT_MESSAGE ConnectionRequest 121 ); 122 123 NTSYSCALLAPI 124 NTSTATUS 125 NTAPI 126 NtQueryInformationPort( 127 _In_ HANDLE PortHandle, 128 _In_ PORT_INFORMATION_CLASS PortInformationClass, 129 _Out_bytecap_(PortInformationLength) PVOID PortInformation, 130 _In_ ULONG PortInformationLength, 131 _Out_ PULONG ReturnLength 132 ); 133 134 NTSTATUS 135 NTAPI 136 NtQueryPortInformationProcess( 137 VOID 138 ); 139 140 NTSYSCALLAPI 141 NTSTATUS 142 NTAPI 143 NtReadRequestData( 144 _In_ HANDLE PortHandle, 145 _In_ PPORT_MESSAGE Message, 146 _In_ ULONG Index, 147 _Out_bytecap_(BufferLength) PVOID Buffer, 148 _In_ ULONG BufferLength, 149 _Out_ PULONG ReturnLength 150 ); 151 152 NTSYSCALLAPI 153 NTSTATUS 154 NTAPI 155 NtReplyPort( 156 _In_ HANDLE PortHandle, 157 _In_ PPORT_MESSAGE LpcReply 158 ); 159 160 NTSYSCALLAPI 161 NTSTATUS 162 NTAPI 163 NtReplyWaitReceivePort( 164 _In_ HANDLE PortHandle, 165 _Out_opt_ PVOID *PortContext, 166 _In_opt_ PPORT_MESSAGE ReplyMessage, 167 _Out_ PPORT_MESSAGE ReceiveMessage 168 ); 169 170 NTSYSCALLAPI 171 NTSTATUS 172 NTAPI 173 NtReplyWaitReceivePortEx( 174 _In_ HANDLE PortHandle, 175 _Out_opt_ PVOID *PortContext, 176 _In_opt_ PPORT_MESSAGE ReplyMessage, 177 _Out_ PPORT_MESSAGE ReceiveMessage, 178 _In_opt_ PLARGE_INTEGER Timeout 179 ); 180 181 NTSYSCALLAPI 182 NTSTATUS 183 NTAPI 184 NtReplyWaitReplyPort( 185 _In_ HANDLE PortHandle, 186 _Out_ PPORT_MESSAGE ReplyMessage 187 ); 188 189 NTSYSCALLAPI 190 NTSTATUS 191 NTAPI 192 NtRequestPort( 193 _In_ HANDLE PortHandle, 194 _In_ PPORT_MESSAGE LpcMessage 195 ); 196 197 NTSYSCALLAPI 198 NTSTATUS 199 NTAPI 200 NtRequestWaitReplyPort( 201 _In_ HANDLE PortHandle, 202 _Out_ PPORT_MESSAGE LpcReply, 203 _In_ PPORT_MESSAGE LpcRequest 204 ); 205 206 NTSYSCALLAPI 207 NTSTATUS 208 NTAPI 209 NtSecureConnectPort( 210 _Out_ PHANDLE PortHandle, 211 _In_ PUNICODE_STRING PortName, 212 _In_ PSECURITY_QUALITY_OF_SERVICE SecurityQos, 213 _Inout_opt_ PPORT_VIEW ClientView, 214 _In_opt_ PSID ServerSid, 215 _Inout_opt_ PREMOTE_PORT_VIEW ServerView, 216 _Out_opt_ PULONG MaxMessageLength, 217 _Inout_opt_ PVOID ConnectionInformation, 218 _Inout_opt_ PULONG ConnectionInformationLength 219 ); 220 221 NTSYSCALLAPI 222 NTSTATUS 223 NTAPI 224 NtWriteRequestData( 225 _In_ HANDLE PortHandle, 226 _In_ PPORT_MESSAGE Message, 227 _In_ ULONG Index, 228 _In_bytecount_(BufferLength) PVOID Buffer, 229 _In_ ULONG BufferLength, 230 _Out_ PULONG ReturnLength 231 ); 232 233 NTSYSAPI 234 NTSTATUS 235 NTAPI 236 ZwAcceptConnectPort( 237 _Out_ PHANDLE PortHandle, 238 _In_opt_ PVOID PortContext, 239 _In_ PPORT_MESSAGE ConnectionRequest, 240 _In_ BOOLEAN AcceptConnection, 241 _In_opt_ PPORT_VIEW ServerView, 242 _In_opt_ PREMOTE_PORT_VIEW ClientView 243 ); 244 245 NTSYSAPI 246 NTSTATUS 247 NTAPI 248 ZwCompleteConnectPort( 249 _In_ HANDLE PortHandle 250 ); 251 252 NTSYSAPI 253 NTSTATUS 254 NTAPI 255 ZwConnectPort( 256 _Out_ PHANDLE PortHandle, 257 _In_ PUNICODE_STRING PortName, 258 _In_ PSECURITY_QUALITY_OF_SERVICE SecurityQos, 259 _In_opt_ PPORT_VIEW ClientView, 260 _In_opt_ PREMOTE_PORT_VIEW ServerView, 261 _In_opt_ PULONG MaxMessageLength, 262 _In_opt_ PVOID ConnectionInformation, 263 _In_opt_ PULONG ConnectionInformationLength 264 ); 265 266 NTSYSAPI 267 NTSTATUS 268 NTAPI 269 ZwCreatePort( 270 _Out_ PHANDLE PortHandle, 271 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 272 _In_ ULONG MaxConnectionInfoLength, 273 _In_ ULONG MaxMessageLength, 274 _In_ ULONG MaxPoolUsage 275 ); 276 277 NTSYSAPI 278 NTSTATUS 279 NTAPI 280 ZwCreateWaitablePort( 281 _Out_ PHANDLE PortHandle, 282 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 283 _In_ ULONG MaxConnectInfoLength, 284 _In_ ULONG MaxDataLength, 285 _In_opt_ ULONG NPMessageQueueSize 286 ); 287 288 NTSYSAPI 289 NTSTATUS 290 NTAPI 291 ZwImpersonateClientOfPort( 292 _In_ HANDLE PortHandle, 293 _In_ PPORT_MESSAGE ClientMessage 294 ); 295 296 NTSYSAPI 297 NTSTATUS 298 NTAPI 299 ZwListenPort( 300 _In_ HANDLE PortHandle, 301 _In_ PPORT_MESSAGE ConnectionRequest 302 ); 303 304 NTSYSAPI 305 NTSTATUS 306 NTAPI 307 ZwQueryInformationPort( 308 _In_ HANDLE PortHandle, 309 _In_ PORT_INFORMATION_CLASS PortInformationClass, 310 _Out_bytecap_(PortInformationLength) PVOID PortInformation, 311 _In_ ULONG PortInformationLength, 312 _Out_ PULONG ReturnLength 313 ); 314 315 NTSYSAPI 316 NTSTATUS 317 NTAPI 318 ZwReadRequestData( 319 _In_ HANDLE PortHandle, 320 _In_ PPORT_MESSAGE Message, 321 _In_ ULONG Index, 322 _Out_bytecap_(BufferLength) PVOID Buffer, 323 _In_ ULONG BufferLength, 324 _Out_ PULONG ReturnLength 325 ); 326 327 NTSYSAPI 328 NTSTATUS 329 NTAPI 330 ZwReplyPort( 331 _In_ HANDLE PortHandle, 332 _In_ PPORT_MESSAGE LpcReply 333 ); 334 335 NTSYSAPI 336 NTSTATUS 337 NTAPI 338 ZwReplyWaitReceivePort( 339 _In_ HANDLE PortHandle, 340 _Out_opt_ PVOID *PortContext, 341 _In_opt_ PPORT_MESSAGE ReplyMessage, 342 _Out_ PPORT_MESSAGE ReceiveMessage 343 ); 344 345 NTSYSAPI 346 NTSTATUS 347 NTAPI 348 ZwReplyWaitReceivePortEx( 349 _In_ HANDLE PortHandle, 350 _Out_opt_ PVOID *PortContext, 351 _In_opt_ PPORT_MESSAGE ReplyMessage, 352 _Out_ PPORT_MESSAGE ReceiveMessage, 353 _In_opt_ PLARGE_INTEGER Timeout 354 ); 355 356 NTSYSAPI 357 NTSTATUS 358 NTAPI 359 ZwReplyWaitReplyPort( 360 _In_ HANDLE PortHandle, 361 _Out_ PPORT_MESSAGE ReplyMessage 362 ); 363 364 NTSYSAPI 365 NTSTATUS 366 NTAPI 367 ZwRequestPort( 368 _In_ HANDLE PortHandle, 369 _In_ PPORT_MESSAGE LpcMessage 370 ); 371 372 NTSYSAPI 373 NTSTATUS 374 NTAPI 375 ZwRequestWaitReplyPort( 376 _In_ HANDLE PortHandle, 377 _Out_ PPORT_MESSAGE LpcReply, 378 _In_ PPORT_MESSAGE LpcRequest 379 ); 380 381 NTSYSAPI 382 NTSTATUS 383 NTAPI 384 ZwSecureConnectPort( 385 _Out_ PHANDLE PortHandle, 386 _In_ PUNICODE_STRING PortName, 387 _In_ PSECURITY_QUALITY_OF_SERVICE SecurityQos, 388 _Inout_opt_ PPORT_VIEW ClientView, 389 _In_opt_ PSID Sid, 390 _Inout_opt_ PREMOTE_PORT_VIEW ServerView, 391 _Out_opt_ PULONG MaxMessageLength, 392 _Inout_opt_ PVOID ConnectionInformation, 393 _Inout_opt_ PULONG ConnectionInformationLength 394 ); 395 396 NTSYSAPI 397 NTSTATUS 398 NTAPI 399 ZwWriteRequestData( 400 _In_ HANDLE PortHandle, 401 _In_ PPORT_MESSAGE Message, 402 _In_ ULONG Index, 403 _In_bytecount_(BufferLength) PVOID Buffer, 404 _In_ ULONG BufferLength, 405 _Out_ PULONG ReturnLength 406 ); 407 408 #endif 409