mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00

The idea then would be to have the following behaviour (when specifying the following options in the kernel command line): /DEBUGPORT=COMi --> load KDCOM.DLL and use COMi port (i == 1,2,3,4) if possible. /DEBUGPORT=FOO --> load KDFOO.DLL (useful for KDUSB.DLL, KD1394.DLL, KDBAZIS.DLL for VirtualKD, etc...) /DEBUGPORT=ROSDBG:[COMi|SCREEN|FILE|GDB|...] --> load KDROSDBG.DLL which contains the ROS kernel debugger, and use COMi or SCREEN or... as output port. svn path=/branches/kd++/; revision=58883
91 lines
2 KiB
C
91 lines
2 KiB
C
/*
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
* PROJECT: ReactOS kernel
|
|
* PURPOSE: Interface to csrss
|
|
* FILE: subsys/win32k/ntuser/csr.c
|
|
* PROGRAMER: Ge van Geldorp (ge@gse.nl)
|
|
*/
|
|
|
|
#include <win32k.h>
|
|
|
|
static HANDLE WindowsApiPort = NULL;
|
|
PEPROCESS CsrProcess = NULL;
|
|
|
|
NTSTATUS FASTCALL
|
|
CsrInit(void)
|
|
{
|
|
NTSTATUS Status;
|
|
UNICODE_STRING PortName;
|
|
ULONG ConnectInfoLength;
|
|
SECURITY_QUALITY_OF_SERVICE Qos;
|
|
|
|
RtlInitUnicodeString(&PortName, L"\\Windows\\ApiPort");
|
|
ConnectInfoLength = 0;
|
|
Qos.Length = sizeof(Qos);
|
|
Qos.ImpersonationLevel = SecurityDelegation;
|
|
Qos.ContextTrackingMode = SECURITY_STATIC_TRACKING;
|
|
Qos.EffectiveOnly = FALSE;
|
|
|
|
Status = ZwConnectPort(&WindowsApiPort,
|
|
&PortName,
|
|
&Qos,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
&ConnectInfoLength);
|
|
if (! NT_SUCCESS(Status))
|
|
{
|
|
return Status;
|
|
}
|
|
|
|
CsrProcess = PsGetCurrentProcess();
|
|
|
|
return STATUS_SUCCESS;
|
|
}
|
|
|
|
|
|
NTSTATUS FASTCALL
|
|
co_CsrNotify(PCSR_API_MESSAGE Request)
|
|
{
|
|
NTSTATUS Status;
|
|
PEPROCESS OldProcess;
|
|
|
|
if (NULL == CsrProcess)
|
|
{
|
|
return STATUS_INVALID_PORT_HANDLE;
|
|
}
|
|
|
|
Request->Header.u2.ZeroInit = 0;
|
|
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
|
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
|
|
|
/* Switch to the process in which the WindowsApiPort handle is valid */
|
|
OldProcess = PsGetCurrentProcess();
|
|
if (CsrProcess != OldProcess)
|
|
{
|
|
KeAttachProcess(&CsrProcess->Pcb);
|
|
}
|
|
|
|
UserLeaveCo();
|
|
|
|
Status = ZwRequestWaitReplyPort(WindowsApiPort,
|
|
&Request->Header,
|
|
&Request->Header);
|
|
|
|
UserEnterCo();
|
|
|
|
if (CsrProcess != OldProcess)
|
|
{
|
|
KeDetachProcess();
|
|
}
|
|
|
|
if (NT_SUCCESS(Status))
|
|
{
|
|
Status = Request->Status;
|
|
}
|
|
|
|
return Status;
|
|
}
|
|
|
|
/* EOF */
|