2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * PURPOSE: Interface to csrss
5 * FILE: subsys/win32k/ntuser/csr.c
6 * PROGRAMER: Ge van Geldorp (ge@gse.nl)
11 static HANDLE WindowsApiPort
= NULL
;
12 PEPROCESS CsrProcess
= NULL
;
18 UNICODE_STRING PortName
;
19 ULONG ConnectInfoLength
;
20 SECURITY_QUALITY_OF_SERVICE Qos
;
22 RtlInitUnicodeString(&PortName
, L
"\\Windows\\ApiPort");
23 ConnectInfoLength
= 0;
24 Qos
.Length
= sizeof(Qos
);
25 Qos
.ImpersonationLevel
= SecurityDelegation
;
26 Qos
.ContextTrackingMode
= SECURITY_STATIC_TRACKING
;
27 Qos
.EffectiveOnly
= FALSE
;
29 Status
= ZwConnectPort(&WindowsApiPort
,
37 if (! NT_SUCCESS(Status
))
42 CsrProcess
= PsGetCurrentProcess();
44 return STATUS_SUCCESS
;
49 co_CsrNotify(PCSR_API_MESSAGE Request
)
54 if (NULL
== CsrProcess
)
56 return STATUS_INVALID_PORT_HANDLE
;
59 Request
->Header
.u2
.ZeroInit
= 0;
60 Request
->Header
.u1
.s1
.DataLength
= sizeof(CSR_API_MESSAGE
) - sizeof(PORT_MESSAGE
);
61 Request
->Header
.u1
.s1
.TotalLength
= sizeof(CSR_API_MESSAGE
);
63 /* Switch to the process in which the WindowsApiPort handle is valid */
64 OldProcess
= PsGetCurrentProcess();
65 if (CsrProcess
!= OldProcess
)
67 KeAttachProcess(&CsrProcess
->Pcb
);
72 Status
= ZwRequestWaitReplyPort(WindowsApiPort
,
78 if (CsrProcess
!= OldProcess
)
83 if (NT_SUCCESS(Status
))
85 Status
= Request
->Status
;