ReactOS 0.4.15-dev-5884-gab5aff5
connect.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for connect.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

PVOID NTAPI LpcpFreeConMsg (IN OUT PLPCP_MESSAGE *Message, IN OUT PLPCP_CONNECTION_MESSAGE *ConnectMessage, IN PETHREAD CurrentThread)
 
NTSTATUS NTAPI NtSecureConnectPort (OUT PHANDLE PortHandle, IN PUNICODE_STRING PortName, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos, IN OUT PPORT_VIEW ClientView OPTIONAL, IN PSID ServerSid OPTIONAL, IN OUT PREMOTE_PORT_VIEW ServerView OPTIONAL, OUT PULONG MaxMessageLength OPTIONAL, IN OUT PVOID ConnectionInformation OPTIONAL, IN OUT PULONG ConnectionInformationLength OPTIONAL)
 
NTSTATUS NTAPI NtConnectPort (OUT PHANDLE PortHandle, IN PUNICODE_STRING PortName, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos, IN OUT PPORT_VIEW ClientView OPTIONAL, IN OUT PREMOTE_PORT_VIEW ServerView OPTIONAL, OUT PULONG MaxMessageLength OPTIONAL, IN OUT PVOID ConnectionInformation OPTIONAL, IN OUT PULONG ConnectionInformationLength OPTIONAL)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file connect.c.

Function Documentation

◆ LpcpFreeConMsg()

PVOID NTAPI LpcpFreeConMsg ( IN OUT PLPCP_MESSAGE Message,
IN OUT PLPCP_CONNECTION_MESSAGE ConnectMessage,
IN PETHREAD  CurrentThread 
)

Definition at line 19 of file connect.c.

22{
23 PVOID SectionToMap;
25
26 /* Acquire the LPC lock */
28
29 /* Check if the reply chain is not empty */
30 if (!IsListEmpty(&CurrentThread->LpcReplyChain))
31 {
32 /* Remove this entry and re-initialize it */
33 RemoveEntryList(&CurrentThread->LpcReplyChain);
34 InitializeListHead(&CurrentThread->LpcReplyChain);
35 }
36
37 /* Check if there's a reply message */
39 if (ReplyMessage)
40 {
41 /* Get the message */
43
44 /* Check if it's got messages */
45 if (!IsListEmpty(&ReplyMessage->Entry))
46 {
47 /* Clear the list */
50 }
51
52 /* Clear message data */
53 CurrentThread->LpcReceivedMessageId = 0;
54 CurrentThread->LpcReplyMessage = NULL;
55
56 /* Get the connection message and clear the section */
57 *ConnectMessage = (PLPCP_CONNECTION_MESSAGE)(ReplyMessage + 1);
58 SectionToMap = (*ConnectMessage)->SectionToMap;
59 (*ConnectMessage)->SectionToMap = NULL;
60 }
61 else
62 {
63 /* No message to return */
64 *Message = NULL;
65 SectionToMap = NULL;
66 }
67
68 /* Release the lock and return the section */
70 return SectionToMap;
71}
#define NULL
Definition: types.h:112
static const WCHAR Message[]
Definition: register.c:74
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:53
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:42
KGUARDED_MUTEX LpcpLock
Definition: port.c:20
FORCEINLINE PLPCP_MESSAGE LpcpGetMessageFromThread(IN PETHREAD Thread)
Definition: lpc_x.h:129
struct _LPCP_CONNECTION_MESSAGE * PLPCP_CONNECTION_MESSAGE
BOOL WINAPI ReplyMessage(_In_ LRESULT)

Referenced by NtSecureConnectPort().

◆ NtConnectPort()

NTSTATUS NTAPI NtConnectPort ( OUT PHANDLE  PortHandle,
IN PUNICODE_STRING  PortName,
IN PSECURITY_QUALITY_OF_SERVICE  SecurityQos,
IN OUT PPORT_VIEW ClientView  OPTIONAL,
IN OUT PREMOTE_PORT_VIEW ServerView  OPTIONAL,
OUT PULONG MaxMessageLength  OPTIONAL,
IN OUT PVOID ConnectionInformation  OPTIONAL,
IN OUT PULONG ConnectionInformationLength  OPTIONAL 
)

Definition at line 753 of file connect.c.

761{
762 /* Call the newer API */
763 return NtSecureConnectPort(PortHandle,
764 PortName,
765 SecurityQos,
766 ClientView,
767 NULL,
768 ServerView,
769 MaxMessageLength,
770 ConnectionInformation,
771 ConnectionInformationLength);
772}
static UNICODE_STRING PortName
NTSTATUS NTAPI NtSecureConnectPort(OUT PHANDLE PortHandle, IN PUNICODE_STRING PortName, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos, IN OUT PPORT_VIEW ClientView OPTIONAL, IN PSID ServerSid OPTIONAL, IN OUT PREMOTE_PORT_VIEW ServerView OPTIONAL, OUT PULONG MaxMessageLength OPTIONAL, IN OUT PVOID ConnectionInformation OPTIONAL, IN OUT PULONG ConnectionInformationLength OPTIONAL)
Definition: connect.c:80

Referenced by ClientThread(), LsaConnectUntrusted(), LsapOpenLsaPort(), LsapRmInitializeServer(), main(), SmConnectToSm(), and SmpHandleConnectionRequest().

◆ NtSecureConnectPort()

NTSTATUS NTAPI NtSecureConnectPort ( OUT PHANDLE  PortHandle,
IN PUNICODE_STRING  PortName,
IN PSECURITY_QUALITY_OF_SERVICE  SecurityQos,
IN OUT PPORT_VIEW ClientView  OPTIONAL,
IN PSID ServerSid  OPTIONAL,
IN OUT PREMOTE_PORT_VIEW ServerView  OPTIONAL,
OUT PULONG MaxMessageLength  OPTIONAL,
IN OUT PVOID ConnectionInformation  OPTIONAL,
IN OUT PULONG ConnectionInformationLength  OPTIONAL 
)

Definition at line 80 of file connect.c.

89{
94 PORT_VIEW CapturedClientView;
95 PSID CapturedServerSid;
96 ULONG ConnectionInfoLength = 0;
99 PLPCP_CONNECTION_MESSAGE ConnectMessage;
100 ULONG PortMessageLength;
102 PVOID SectionToMap;
105 PTOKEN_USER TokenUserInfo;
106
107 PAGED_CODE();
109 "Name: %wZ. SecurityQos: %p. Views: %p/%p. Sid: %p\n",
110 PortName,
111 SecurityQos,
112 ClientView,
113 ServerView,
114 ServerSid);
115
116 /* Check if the call comes from user mode */
118 {
119 /* Enter SEH for probing the parameters */
121 {
122 /* Probe the PortHandle */
123 ProbeForWriteHandle(PortHandle);
124
125 /* Probe and capture the QoS */
126 ProbeForRead(SecurityQos, sizeof(*SecurityQos), sizeof(ULONG));
127 CapturedQos = *(volatile SECURITY_QUALITY_OF_SERVICE*)SecurityQos;
128 /* NOTE: Do not care about CapturedQos.Length */
129
130 /* The following parameters are optional */
131
132 /* Capture the client view */
133 if (ClientView)
134 {
135 ProbeForWrite(ClientView, sizeof(*ClientView), sizeof(ULONG));
136 CapturedClientView = *(volatile PORT_VIEW*)ClientView;
137
138 /* Validate the size of the client view */
139 if (CapturedClientView.Length != sizeof(CapturedClientView))
140 {
141 /* Invalid size */
143 }
144
145 }
146
147 /* Capture the server view */
148 if (ServerView)
149 {
150 ProbeForWrite(ServerView, sizeof(*ServerView), sizeof(ULONG));
151
152 /* Validate the size of the server view */
153 if (((volatile REMOTE_PORT_VIEW*)ServerView)->Length != sizeof(*ServerView))
154 {
155 /* Invalid size */
157 }
158 }
159
160 if (MaxMessageLength)
161 ProbeForWriteUlong(MaxMessageLength);
162
163 /* Capture connection information length */
164 if (ConnectionInformationLength)
165 {
166 ProbeForWriteUlong(ConnectionInformationLength);
167 ConnectionInfoLength = *(volatile ULONG*)ConnectionInformationLength;
168 }
169
170 /* Probe the ConnectionInformation */
171 if (ConnectionInformation)
172 ProbeForWrite(ConnectionInformation, ConnectionInfoLength, sizeof(ULONG));
173
174 CapturedServerSid = ServerSid;
175 if (ServerSid != NULL)
176 {
177 /* Capture it */
178 Status = SepCaptureSid(ServerSid,
180 PagedPool,
181 TRUE,
182 &CapturedServerSid);
183 if (!NT_SUCCESS(Status))
184 {
185 DPRINT1("Failed to capture ServerSid!\n");
186 _SEH2_YIELD(return Status);
187 }
188 }
189 }
191 {
192 /* There was an exception, return the exception code */
194 }
195 _SEH2_END;
196 }
197 else
198 {
199 CapturedQos = *SecurityQos;
200 /* NOTE: Do not care about CapturedQos.Length */
201
202 /* The following parameters are optional */
203
204 /* Capture the client view */
205 if (ClientView)
206 {
207 /* Validate the size of the client view */
208 if (ClientView->Length != sizeof(*ClientView))
209 {
210 /* Invalid size */
212 }
213 CapturedClientView = *ClientView;
214 }
215
216 /* Capture the server view */
217 if (ServerView)
218 {
219 /* Validate the size of the server view */
220 if (ServerView->Length != sizeof(*ServerView))
221 {
222 /* Invalid size */
224 }
225 }
226
227 /* Capture connection information length */
228 if (ConnectionInformationLength)
229 ConnectionInfoLength = *ConnectionInformationLength;
230
231 CapturedServerSid = ServerSid;
232 }
233
234 /* Get the port */
236 0,
237 NULL,
241 NULL,
242 (PVOID*)&Port);
243 if (!NT_SUCCESS(Status))
244 {
245 DPRINT1("Failed to reference port '%wZ': 0x%lx\n", PortName, Status);
246
247 if (CapturedServerSid != ServerSid)
248 SepReleaseSid(CapturedServerSid, PreviousMode, TRUE);
249
250 return Status;
251 }
252
253 /* This has to be a connection port */
255 {
256 DPRINT1("Port '%wZ' is not a connection port (Flags: 0x%lx)\n", PortName, Port->Flags);
257
258 /* It isn't, so fail */
260
261 if (CapturedServerSid != ServerSid)
262 SepReleaseSid(CapturedServerSid, PreviousMode, TRUE);
263
265 }
266
267 /* Check if we have a (captured) SID */
268 if (ServerSid)
269 {
270 /* Make sure that we have a server */
271 if (Port->ServerProcess)
272 {
273 /* Get its token and query user information */
274 Token = PsReferencePrimaryToken(Port->ServerProcess);
275 Status = SeQueryInformationToken(Token, TokenUser, (PVOID*)&TokenUserInfo);
277
278 /* Check for success */
279 if (NT_SUCCESS(Status))
280 {
281 /* Compare the SIDs */
282 if (!RtlEqualSid(CapturedServerSid, TokenUserInfo->User.Sid))
283 {
284 /* Fail */
285 DPRINT1("Port '%wZ': server SID mismatch\n", PortName);
287 }
288
289 /* Free token information */
290 ExFreePoolWithTag(TokenUserInfo, TAG_SE);
291 }
292 }
293 else
294 {
295 /* Invalid SID */
296 DPRINT1("Port '%wZ': server SID mismatch\n", PortName);
298 }
299
300 /* Finally release the captured SID, we don't need it anymore */
301 if (CapturedServerSid != ServerSid)
302 SepReleaseSid(CapturedServerSid, PreviousMode, TRUE);
303
304 /* Check if SID failed */
305 if (!NT_SUCCESS(Status))
306 {
307 /* Quit */
309 return Status;
310 }
311 }
312
313 /* Create the client port */
316 NULL,
318 NULL,
319 sizeof(LPCP_PORT_OBJECT),
320 0,
321 0,
322 (PVOID*)&ClientPort);
323 if (!NT_SUCCESS(Status))
324 {
325 /* Failed, dereference the server port and return */
326 DPRINT1("Failed to create Port object: 0x%lx\n", Status);
328 return Status;
329 }
330
331 /*
332 * Setup the client port -- From now on, dereferencing the client port
333 * will automatically dereference the connection port too.
334 */
337 ClientPort->ConnectionPort = Port;
338 ClientPort->MaxMessageLength = Port->MaxMessageLength;
339 ClientPort->SecurityQos = CapturedQos;
340 InitializeListHead(&ClientPort->LpcReplyChainHead);
341 InitializeListHead(&ClientPort->LpcDataInfoChainHead);
342
343 /* Check if we have dynamic security */
345 {
346 /* Remember that */
348 }
349 else
350 {
351 /* Create our own client security */
353 &CapturedQos,
354 FALSE,
355 &ClientPort->StaticSecurity);
356 if (!NT_SUCCESS(Status))
357 {
358 /* Security failed, dereference and return */
359 DPRINT1("SeCreateClientSecurity failed: 0x%lx\n", Status);
361 return Status;
362 }
363 }
364
365 /* Initialize the port queue */
367 if (!NT_SUCCESS(Status))
368 {
369 /* Failed */
370 DPRINT1("LpcpInitializePortQueue failed: 0x%lx\n", Status);
372 return Status;
373 }
374
375 /* Check if we have a client view */
376 if (ClientView)
377 {
378 /* Get the section handle */
384 (PVOID*)&SectionToMap,
385 NULL);
386 if (!NT_SUCCESS(Status))
387 {
388 /* Fail */
389 DPRINT1("Failed to reference port section handle: 0x%lx\n", Status);
391 return Status;
392 }
393
394 /* Set the section offset */
395 SectionOffset.QuadPart = CapturedClientView.SectionOffset;
396
397 /* Map it */
398 Status = MmMapViewOfSection(SectionToMap,
400 &ClientPort->ClientSectionBase,
401 0,
402 0,
404 &CapturedClientView.ViewSize,
405 ViewUnmap,
406 0,
408
409 /* Update the offset */
410 CapturedClientView.SectionOffset = SectionOffset.LowPart;
411
412 /* Check for failure */
413 if (!NT_SUCCESS(Status))
414 {
415 /* Fail */
416 DPRINT1("Failed to map port section: 0x%lx\n", Status);
417 ObDereferenceObject(SectionToMap);
419 return Status;
420 }
421
422 /* Update the base */
423 CapturedClientView.ViewBase = ClientPort->ClientSectionBase;
424
425 /* Reference and remember the process */
426 ClientPort->MappingProcess = PsGetCurrentProcess();
427 ObReferenceObject(ClientPort->MappingProcess);
428 }
429 else
430 {
431 /* No section */
432 SectionToMap = NULL;
433 }
434
435 /* Normalize connection information */
436 if (ConnectionInfoLength > Port->MaxConnectionInfoLength)
437 {
438 /* Use the port's maximum allowed value */
439 ConnectionInfoLength = Port->MaxConnectionInfoLength;
440 }
441
442 /* Allocate a message from the port zone */
444 if (!Message)
445 {
446 /* Fail if we couldn't allocate a message */
447 DPRINT1("LpcpAllocateFromPortZone failed\n");
448 if (SectionToMap) ObDereferenceObject(SectionToMap);
450 return STATUS_NO_MEMORY;
451 }
452
453 /* Set pointer to the connection message and fill in the CID */
454 ConnectMessage = (PLPCP_CONNECTION_MESSAGE)(Message + 1);
455 Message->Request.ClientId = Thread->Cid;
456
457 /* Check if we have a client view */
458 if (ClientView)
459 {
460 /* Set the view size */
461 Message->Request.ClientViewSize = CapturedClientView.ViewSize;
462
463 /* Copy the client view and clear the server view */
464 RtlCopyMemory(&ConnectMessage->ClientView,
465 &CapturedClientView,
466 sizeof(CapturedClientView));
467 RtlZeroMemory(&ConnectMessage->ServerView, sizeof(REMOTE_PORT_VIEW));
468 }
469 else
470 {
471 /* Set the size to 0 and clear the connect message */
472 Message->Request.ClientViewSize = 0;
473 RtlZeroMemory(ConnectMessage, sizeof(LPCP_CONNECTION_MESSAGE));
474 }
475
476 /* Set the section and client port. Port is NULL for now */
477 ConnectMessage->ClientPort = NULL;
478 ConnectMessage->SectionToMap = SectionToMap;
479
480 /* Set the data for the connection request message */
481 Message->Request.u1.s1.DataLength = (CSHORT)ConnectionInfoLength +
483 Message->Request.u1.s1.TotalLength = sizeof(LPCP_MESSAGE) +
484 Message->Request.u1.s1.DataLength;
485 Message->Request.u2.s2.Type = LPC_CONNECTION_REQUEST;
486
487 /* Check if we have connection information */
488 if (ConnectionInformation)
489 {
491 {
492 /* Copy it in */
493 RtlCopyMemory(ConnectMessage + 1,
494 ConnectionInformation,
495 ConnectionInfoLength);
496 }
498 {
499 DPRINT1("Exception 0x%lx when copying connection info to user mode\n",
501
502 /* Cleanup and return the exception code */
503
504 /* Free the message we have */
506
507 /* Dereference other objects */
508 if (SectionToMap) ObDereferenceObject(SectionToMap);
510
511 /* Return status */
513 }
514 _SEH2_END;
515 }
516
517 /* Reset the status code */
519
520 /* Acquire the port lock */
522
523 /* Check if someone already deleted the port name */
525 {
526 /* Fail the request */
528 }
529 else
530 {
531 /* Associate no thread yet */
532 Message->RepliedToThread = NULL;
533
534 /* Generate the Message ID and set it */
535 Message->Request.MessageId = LpcpNextMessageId++;
537 Thread->LpcReplyMessageId = Message->Request.MessageId;
538
539 /* Insert the message into the queue and thread chain */
540 InsertTailList(&Port->MsgQueue.ReceiveHead, &Message->Entry);
541 InsertTailList(&Port->LpcReplyChainHead, &Thread->LpcReplyChain);
542 Thread->LpcReplyMessage = Message;
543
544 /* Now we can finally reference the client port and link it */
546 ConnectMessage->ClientPort = ClientPort;
547
548 /* Enter a critical region */
550 }
551
552 /* Add another reference to the port */
554
555 /* Release the lock */
557
558 /* Check for success */
559 if (NT_SUCCESS(Status))
560 {
562 "Messages: %p/%p. Ports: %p/%p. Status: %lx\n",
563 Message,
564 ConnectMessage,
565 Port,
567 Status);
568
569 /* If this is a waitable port, set the event */
571 KeSetEvent(&Port->WaitEvent, 1, FALSE);
572
573 /* Release the queue semaphore and leave the critical region */
574 LpcpCompleteWait(Port->MsgQueue.Semaphore);
576
577 /* Now wait for a reply and set 'Status' */
578 LpcpConnectWait(&Thread->LpcReplySemaphore, PreviousMode);
579 }
580
581 /* Now, always free the connection message */
582 SectionToMap = LpcpFreeConMsg(&Message, &ConnectMessage, Thread);
583
584 /* Check for failure */
585 if (!NT_SUCCESS(Status))
586 {
587 /* Check if the semaphore got signaled in the meantime */
588 if (KeReadStateSemaphore(&Thread->LpcReplySemaphore))
589 {
590 /* Wait on it */
591 KeWaitForSingleObject(&Thread->LpcReplySemaphore,
594 FALSE,
595 NULL);
596 }
597
598 goto Failure;
599 }
600
601 /* Check if we got a message back */
602 if (Message)
603 {
604 /* Check for new return length */
605 if ((Message->Request.u1.s1.DataLength -
606 sizeof(LPCP_CONNECTION_MESSAGE)) < ConnectionInfoLength)
607 {
608 /* Set new normalized connection length */
609 ConnectionInfoLength = Message->Request.u1.s1.DataLength -
611 }
612
613 /* Check if the caller had connection information */
614 if (ConnectionInformation)
615 {
617 {
618 /* Return the connection information length if needed */
619 if (ConnectionInformationLength)
620 *ConnectionInformationLength = ConnectionInfoLength;
621
622 /* Return the connection information */
623 RtlCopyMemory(ConnectionInformation,
624 ConnectMessage + 1,
625 ConnectionInfoLength);
626 }
628 {
629 /* Cleanup and return the exception code */
631 _SEH2_YIELD(goto Failure);
632 }
633 _SEH2_END;
634 }
635
636 /* Make sure we had a connected port */
637 if (ClientPort->ConnectedPort)
638 {
639 /* Get the message length before the port might get killed */
640 PortMessageLength = Port->MaxMessageLength;
641
642 /* Insert the client port */
644 NULL,
646 0,
647 NULL,
648 &Handle);
649 if (NT_SUCCESS(Status))
650 {
652 "Handle: %p. Length: %lx\n",
653 Handle,
654 PortMessageLength);
655
657 {
658 /* Return the handle */
659 *PortHandle = Handle;
660
661 /* Check if maximum length was requested */
662 if (MaxMessageLength)
663 *MaxMessageLength = PortMessageLength;
664
665 /* Check if we had a client view */
666 if (ClientView)
667 {
668 /* Copy it back */
669 RtlCopyMemory(ClientView,
670 &ConnectMessage->ClientView,
671 sizeof(*ClientView));
672 }
673
674 /* Check if we had a server view */
675 if (ServerView)
676 {
677 /* Copy it back */
678 RtlCopyMemory(ServerView,
679 &ConnectMessage->ServerView,
680 sizeof(*ServerView));
681 }
682 }
684 {
685 /* An exception happened, close the opened handle */
688 }
689 _SEH2_END;
690 }
691 }
692 else
693 {
694 /* No connection port, we failed */
695 if (SectionToMap) ObDereferenceObject(SectionToMap);
696
697 /* Acquire the lock */
699
700 /* Check if it's because the name got deleted */
701 if (!(ClientPort->ConnectionPort) ||
703 {
704 /* Set the correct status */
706 }
707 else
708 {
709 /* Otherwise, the caller refused us */
711 }
712
713 /* Release the lock */
715
716 /* Kill the port */
718 }
719
720 /* Free the message */
722 }
723 else
724 {
725 /* No reply message, fail */
727 goto Failure;
728 }
729
731
732 /* Return status */
733 return Status;
734
735Failure:
736 /* Check if we had a message and free it */
738
739 /* Dereference other objects */
740 if (SectionToMap) ObDereferenceObject(SectionToMap);
743
744 /* Return status */
745 return Status;
746}
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SECTION_MAP_READ
Definition: compat.h:139
#define InsertTailList(ListHead, Entry)
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define PagedPool
Definition: env_spec_w32.h:308
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
_Outptr_ PFLT_PORT * ClientPort
Definition: fltkernel.h:1891
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
ULONG Handle
Definition: gdb_input.c:15
Status
Definition: gdiplustypes.h:25
CPPORT Port[4]
Definition: headless.c:35
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
if(dx< 0)
Definition: linetemp.h:194
VOID NTAPI LpcpFreeToPortZone(IN PLPCP_MESSAGE Message, IN ULONG LockFlags)
Definition: close.c:52
POBJECT_TYPE LpcPortObjectType
Definition: port.c:17
#define LPCTRACE(x, fmt,...)
Definition: lpc.h:49
NTSTATUS NTAPI LpcpInitializePortQueue(IN PLPCP_PORT_OBJECT Port)
Definition: create.c:19
#define LPC_CONNECT_DEBUG
Definition: lpc.h:19
ULONG LpcpNextMessageId
Definition: port.c:22
#define LpcpConnectWait(s, w)
Definition: lpc_x.h:60
#define LpcpCompleteWait(s)
Definition: lpc_x.h:88
static __inline PLPCP_MESSAGE LpcpAllocateFromPortZone(VOID)
Definition: lpc_x.h:100
#define LPCP_SECURITY_DYNAMIC
Definition: lpctypes.h:62
#define LPCP_CONNECTION_PORT
Definition: lpctypes.h:54
#define LPCP_NAME_DELETED
Definition: lpctypes.h:61
#define LPCP_WAITABLE_PORT
Definition: lpctypes.h:60
#define PORT_ALL_ACCESS
Definition: lpctypes.h:47
#define LPCP_CLIENT_PORT
Definition: lpctypes.h:57
#define LPCP_PORT_TYPE_MASK
Definition: lpctypes.h:58
struct _LPCP_MESSAGE LPCP_MESSAGE
#define PORT_CONNECT
Definition: lpctypes.h:46
struct _LPCP_CONNECTION_MESSAGE LPCP_CONNECTION_MESSAGE
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
NTKERNELAPI NTSTATUS NTAPI SeCreateClientSecurity(IN PETHREAD Thread, IN PSECURITY_QUALITY_OF_SERVICE QualityOfService, IN BOOLEAN RemoteClient, OUT PSECURITY_CLIENT_CONTEXT ClientContext)
#define PsDereferencePrimaryToken(T)
Definition: imports.h:301
#define LPC_CONNECTION_REQUEST
Definition: port.c:102
#define KernelMode
Definition: asm.h:34
#define KeGetPreviousMode()
Definition: ketypes.h:1108
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER SectionOffset
Definition: mmfuncs.h:407
NTSYSAPI BOOLEAN NTAPI RtlEqualSid(_In_ PSID Sid1, _In_ PSID Sid2)
#define SECTION_MAP_WRITE
Definition: nt_native.h:1288
#define PAGE_READWRITE
Definition: nt_native.h:1304
@ ViewUnmap
Definition: nt_native.h:1279
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
VOID NTAPI SepReleaseSid(_In_ PSID CapturedSid, _In_ KPROCESSOR_MODE AccessMode, _In_ BOOLEAN CaptureIfKernel)
Releases a captured SID.
Definition: sid.c:400
NTSTATUS NTAPI SepCaptureSid(_In_ PSID InputSid, _In_ KPROCESSOR_MODE AccessMode, _In_ POOL_TYPE PoolType, _In_ BOOLEAN CaptureIfKernel, _Out_ PSID *CapturedSid)
Captures a SID.
Definition: sid.c:314
PVOID NTAPI LpcpFreeConMsg(IN OUT PLPCP_MESSAGE *Message, IN OUT PLPCP_CONNECTION_MESSAGE *ConnectMessage, IN PETHREAD CurrentThread)
Definition: connect.c:19
PACCESS_TOKEN NTAPI PsReferencePrimaryToken(PEPROCESS Process)
Definition: security.c:440
#define STATUS_INVALID_PORT_HANDLE
Definition: ntstatus.h:302
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_PORT_CONNECTION_REFUSED
Definition: ntstatus.h:301
#define STATUS_SERVER_SID_MISMATCH
Definition: ntstatus.h:787
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3379
NTSTATUS NTAPI ObInsertObject(IN PVOID Object, IN PACCESS_STATE AccessState OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG ObjectPointerBias, OUT PVOID *NewObject OPTIONAL, OUT PHANDLE Handle)
Definition: obhandle.c:2935
NTSTATUS NTAPI ObCreateObject(IN KPROCESSOR_MODE ProbeMode OPTIONAL, IN POBJECT_TYPE Type, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext OPTIONAL, IN ULONG ObjectSize, IN ULONG PagedPoolCharge OPTIONAL, IN ULONG NonPagedPoolCharge OPTIONAL, OUT PVOID *Object)
Definition: oblife.c:1024
NTSTATUS NTAPI ObReferenceObjectByName(IN PUNICODE_STRING ObjectPath, IN ULONG Attributes, IN PACCESS_STATE PassedAccessState, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext, OUT PVOID *ObjectPtr)
Definition: obref.c:409
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:494
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:162
#define ProbeForWriteHandle(Ptr)
Definition: probe.h:43
#define ProbeForWriteUlong(Ptr)
Definition: probe.h:36
NTSTATUS NTAPI MmMapViewOfSection(IN PVOID SectionObject, IN PEPROCESS Process, IN OUT PVOID *BaseAddress, IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize, IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, IN OUT PSIZE_T ViewSize, IN SECTION_INHERIT InheritDisposition, IN ULONG AllocationType, IN ULONG Protect)
Definition: section.c:3918
POBJECT_TYPE MmSectionObjectType
Definition: section.c:195
LONG NTAPI KeReadStateSemaphore(IN PKSEMAPHORE Semaphore)
Definition: semphobj.c:41
#define STATUS_SUCCESS
Definition: shellext.h:65
USHORT Flags
Definition: cportlib.h:31
CLIENT_ID Cid
Definition: pstypes.h:1128
LIST_ENTRY LpcReplyChain
Definition: pstypes.h:1108
PLPCP_PORT_OBJECT ClientPort
Definition: lpctypes.h:257
REMOTE_PORT_VIEW ServerView
Definition: lpctypes.h:259
LPC_PVOID ViewBase
LPC_HANDLE SectionHandle
ULONG SectionOffset
LPC_SIZE_T ViewSize
SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
Definition: lsa.idl:66
SID_AND_ATTRIBUTES User
Definition: setypes.h:1006
#define TAG_SE
Definition: tag.h:150
NTSTATUS NTAPI SeQueryInformationToken(_In_ PACCESS_TOKEN AccessToken, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Outptr_result_buffer_(_Inexpressible_(token-dependent)) PVOID *TokenInformation)
Queries information details about the given token to the call. The difference between NtQueryInformat...
Definition: tokencls.c:95
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
short CSHORT
Definition: umtypes.h:127
@ WrExecutive
Definition: ketypes.h:410
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
#define ObDereferenceObject
Definition: obfuncs.h:203
#define ObReferenceObject
Definition: obfuncs.h:204
#define PsGetCurrentProcess
Definition: psfuncs.h:17
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
@ TokenUser
Definition: setypes.h:962
#define SECURITY_DYNAMIC_TRACKING
Definition: setypes.h:103

Referenced by CsrpConnectToServer(), and NtConnectPort().