mirror of
https://github.com/reactos/reactos.git
synced 2024-09-12 05:43:24 +00:00
Pass pointer to CSRSS process on first create request.
svn path=/trunk/; revision=3079
This commit is contained in:
parent
69c0982e64
commit
01b92c6de5
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: vidport.c,v 1.22 2002/02/12 12:00:28 jfilby Exp $
|
/* $Id: vidport.c,v 1.23 2002/06/14 14:22:22 ekohl Exp $
|
||||||
*
|
*
|
||||||
* VideoPort driver
|
* VideoPort driver
|
||||||
* Written by Rex Jolliff
|
* Written by Rex Jolliff
|
||||||
|
@ -11,7 +11,10 @@
|
||||||
|
|
||||||
#include "vidport.h"
|
#include "vidport.h"
|
||||||
|
|
||||||
#define UNIMPLEMENTED do {DbgPrint("%s:%d: Function not implemented", __FILE__, __LINE__); for(;;);} while (0)
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
//#define UNIMPLEMENTED do {DbgPrint("%s:%d: Function not implemented", __FILE__, __LINE__); for(;;);} while (0)
|
||||||
|
|
||||||
#define VERSION "0.0.0"
|
#define VERSION "0.0.0"
|
||||||
|
|
||||||
|
@ -19,8 +22,9 @@ static VOID STDCALL VidStartIo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
|
||||||
static NTSTATUS STDCALL VidDispatchOpenClose(IN PDEVICE_OBJECT pDO, IN PIRP Irp);
|
static NTSTATUS STDCALL VidDispatchOpenClose(IN PDEVICE_OBJECT pDO, IN PIRP Irp);
|
||||||
static NTSTATUS STDCALL VidDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
|
static NTSTATUS STDCALL VidDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
|
||||||
|
|
||||||
static HANDLE CsrssHandle;
|
static BOOLEAN CsrssInitialized = FALSE;
|
||||||
static struct _EPROCESS* Csrss;
|
static HANDLE CsrssHandle = 0;
|
||||||
|
static struct _EPROCESS* Csrss = NULL;
|
||||||
|
|
||||||
PBYTE ReturnCsrssAddress(void)
|
PBYTE ReturnCsrssAddress(void)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +54,7 @@ STDCALL NTSTATUS
|
||||||
DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
||||||
IN PUNICODE_STRING RegistryPath)
|
IN PUNICODE_STRING RegistryPath)
|
||||||
{
|
{
|
||||||
return STATUS_SUCCESS;
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -170,8 +174,7 @@ VideoPortGetRegistryParameters(IN PVOID HwDeviceExtension,
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
ULONG STDCALL
|
||||||
STDCALL
|
|
||||||
VideoPortInitialize(IN PVOID Context1,
|
VideoPortInitialize(IN PVOID Context1,
|
||||||
IN PVOID Context2,
|
IN PVOID Context2,
|
||||||
IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData,
|
IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData,
|
||||||
|
@ -259,6 +262,7 @@ VideoPortInitialize(IN PVOID Context1,
|
||||||
!(ConfigInfo.BusInterruptLevel == 0 &&
|
!(ConfigInfo.BusInterruptLevel == 0 &&
|
||||||
ConfigInfo.BusInterruptVector == 0))
|
ConfigInfo.BusInterruptVector == 0))
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
ExtensionData->IRQL = ConfigInfo.BusInterruptLevel;
|
ExtensionData->IRQL = ConfigInfo.BusInterruptLevel;
|
||||||
ExtensionData->InterruptLevel =
|
ExtensionData->InterruptLevel =
|
||||||
HalGetInterruptVector(ConfigInfo.AdapterInterfaceType,
|
HalGetInterruptVector(ConfigInfo.AdapterInterfaceType,
|
||||||
|
@ -287,39 +291,12 @@ VideoPortInitialize(IN PVOID Context1,
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
DeviceNumber++;
|
DeviceNumber++;
|
||||||
}
|
}
|
||||||
while (Again);
|
while (Again);
|
||||||
|
|
||||||
/* Find a process handle for csrss */
|
|
||||||
Cid.UniqueProcess = (HANDLE)3;
|
|
||||||
Cid.UniqueThread = 0;
|
|
||||||
Status = ZwOpenProcess(&CsrssHandle,
|
|
||||||
PROCESS_ALL_ACCESS,
|
|
||||||
NULL,
|
|
||||||
&Cid);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DbgPrint("VIDPORT: Failed to open csrss\n");
|
|
||||||
Csrss = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Status = ObReferenceObjectByHandle(CsrssHandle,
|
|
||||||
PROCESS_ALL_ACCESS,
|
|
||||||
NULL,
|
|
||||||
KernelMode,
|
|
||||||
(PVOID*)&Csrss,
|
|
||||||
NULL);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DbgPrint("VIDPORT: Failed to reference csrss handle\n");
|
|
||||||
Csrss = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: initialize timer routine for MP Driver */
|
/* FIXME: initialize timer routine for MP Driver */
|
||||||
if (HwInitializationData->HwTimer != NULL)
|
if (HwInitializationData->HwTimer != NULL)
|
||||||
{
|
{
|
||||||
|
@ -690,8 +667,7 @@ VideoPortWriteRegisterBufferUchar(IN PUCHAR Register,
|
||||||
WRITE_REGISTER_BUFFER_UCHAR(Register, Buffer, Count);
|
WRITE_REGISTER_BUFFER_UCHAR(Register, Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID STDCALL
|
||||||
STDCALL
|
|
||||||
VideoPortWriteRegisterBufferUshort(IN PUSHORT Register,
|
VideoPortWriteRegisterBufferUshort(IN PUSHORT Register,
|
||||||
IN PUSHORT Buffer,
|
IN PUSHORT Buffer,
|
||||||
IN ULONG Count)
|
IN ULONG Count)
|
||||||
|
@ -699,8 +675,7 @@ VideoPortWriteRegisterBufferUshort(IN PUSHORT Register,
|
||||||
WRITE_REGISTER_BUFFER_USHORT(Register, Buffer, Count);
|
WRITE_REGISTER_BUFFER_USHORT(Register, Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID STDCALL
|
||||||
STDCALL
|
|
||||||
VideoPortWriteRegisterBufferUlong(IN PULONG Register,
|
VideoPortWriteRegisterBufferUlong(IN PULONG Register,
|
||||||
IN PULONG Buffer,
|
IN PULONG Buffer,
|
||||||
IN ULONG Count)
|
IN ULONG Count)
|
||||||
|
@ -708,8 +683,7 @@ VideoPortWriteRegisterBufferUlong(IN PULONG Register,
|
||||||
WRITE_REGISTER_BUFFER_ULONG(Register, Buffer, Count);
|
WRITE_REGISTER_BUFFER_ULONG(Register, Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID STDCALL
|
||||||
STDCALL
|
|
||||||
VideoPortZeroDeviceMemory(OUT PVOID Destination,
|
VideoPortZeroDeviceMemory(OUT PVOID Destination,
|
||||||
IN ULONG Length)
|
IN ULONG Length)
|
||||||
{
|
{
|
||||||
|
@ -734,11 +708,25 @@ VideoPortZeroDeviceMemory(OUT PVOID Destination,
|
||||||
// NTSTATUS
|
// NTSTATUS
|
||||||
//
|
//
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS STDCALL
|
||||||
STDCALL
|
|
||||||
VidDispatchOpenClose(IN PDEVICE_OBJECT pDO,
|
VidDispatchOpenClose(IN PDEVICE_OBJECT pDO,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
|
PIO_STACK_LOCATION IrpStack;
|
||||||
|
|
||||||
|
DPRINT("VidDispatchOpenClose() called\n");
|
||||||
|
|
||||||
|
IrpStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
|
if (IrpStack->MajorFunction == IRP_MJ_CREATE &&
|
||||||
|
CsrssInitialized == FALSE)
|
||||||
|
{
|
||||||
|
DPRINT("Referencing CSRSS\n");
|
||||||
|
Csrss = PsGetCurrentProcess();
|
||||||
|
CsrssInitialized = TRUE;
|
||||||
|
DPRINT("Csrss %p\n", Csrss);
|
||||||
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
Irp->IoStatus.Information = FILE_OPENED;
|
Irp->IoStatus.Information = FILE_OPENED;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
@ -761,8 +749,7 @@ VidDispatchOpenClose(IN PDEVICE_OBJECT pDO,
|
||||||
// NTSTATUS
|
// NTSTATUS
|
||||||
//
|
//
|
||||||
|
|
||||||
static VOID
|
static VOID STDCALL
|
||||||
STDCALL
|
|
||||||
VidStartIo(IN PDEVICE_OBJECT DeviceObject,
|
VidStartIo(IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
|
@ -784,30 +771,32 @@ VidStartIo(IN PDEVICE_OBJECT DeviceObject,
|
||||||
// NTSTATUS
|
// NTSTATUS
|
||||||
//
|
//
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS STDCALL
|
||||||
STDCALL
|
|
||||||
VidDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject,
|
VidDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
|
PIO_STACK_LOCATION IrpStack;
|
||||||
PVIDEO_REQUEST_PACKET vrp;
|
PVIDEO_REQUEST_PACKET vrp;
|
||||||
|
|
||||||
|
IrpStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
// Translate the IRP to a VRP
|
// Translate the IRP to a VRP
|
||||||
vrp = ExAllocatePool(PagedPool, sizeof(VIDEO_REQUEST_PACKET));
|
vrp = ExAllocatePool(PagedPool, sizeof(VIDEO_REQUEST_PACKET));
|
||||||
vrp->StatusBlock = ExAllocatePool(PagedPool, sizeof(STATUS_BLOCK));
|
vrp->StatusBlock = ExAllocatePool(PagedPool, sizeof(STATUS_BLOCK));
|
||||||
vrp->IoControlCode = Irp->Stack[0].Parameters.DeviceIoControl.IoControlCode;
|
vrp->IoControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode;
|
||||||
|
|
||||||
// We're assuming METHOD_BUFFERED
|
// We're assuming METHOD_BUFFERED
|
||||||
vrp->InputBuffer = Irp->AssociatedIrp.SystemBuffer;
|
vrp->InputBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||||
vrp->InputBufferLength = Irp->Stack[0].Parameters.DeviceIoControl.InputBufferLength;
|
vrp->InputBufferLength = IrpStack->Parameters.DeviceIoControl.InputBufferLength;
|
||||||
vrp->OutputBuffer = Irp->UserBuffer;
|
vrp->OutputBuffer = Irp->UserBuffer;
|
||||||
vrp->OutputBufferLength = Irp->Stack[0].Parameters.DeviceIoControl.OutputBufferLength;
|
vrp->OutputBufferLength = IrpStack->Parameters.DeviceIoControl.OutputBufferLength;
|
||||||
|
|
||||||
// Call the Miniport Driver with the VRP
|
// Call the Miniport Driver with the VRP
|
||||||
DeviceObject->DriverObject->DriverStartIo(DeviceObject->DeviceExtension, (PIRP)vrp);
|
DeviceObject->DriverObject->DriverStartIo(DeviceObject->DeviceExtension, (PIRP)vrp);
|
||||||
|
|
||||||
// Translate the VRP back into the IRP for OutputBuffer
|
// Translate the VRP back into the IRP for OutputBuffer
|
||||||
Irp->UserBuffer = vrp->OutputBuffer;
|
Irp->UserBuffer = vrp->OutputBuffer;
|
||||||
Irp->Stack[0].Parameters.DeviceIoControl.OutputBufferLength = vrp->OutputBufferLength;
|
IrpStack->Parameters.DeviceIoControl.OutputBufferLength = vrp->OutputBufferLength;
|
||||||
|
|
||||||
// Free the VRP
|
// Free the VRP
|
||||||
ExFreePool(vrp->StatusBlock);
|
ExFreePool(vrp->StatusBlock);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: init.c,v 1.12 2001/06/25 23:48:20 ekohl Exp $
|
/* $Id: init.c,v 1.13 2002/06/14 14:23:14 ekohl Exp $
|
||||||
*
|
*
|
||||||
* reactos/subsys/csrss/init.c
|
* reactos/subsys/csrss/init.c
|
||||||
*
|
*
|
||||||
|
@ -75,6 +75,34 @@ CsrParseCommandLine (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static VOID
|
||||||
|
CsrInitVideo(VOID)
|
||||||
|
{
|
||||||
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
UNICODE_STRING DeviceName;
|
||||||
|
IO_STATUS_BLOCK Iosb;
|
||||||
|
HANDLE VideoHandle;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
RtlInitUnicodeString(&DeviceName, L"\\??\\DISPLAY1");
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
&DeviceName,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
Status = NtOpenFile(&VideoHandle,
|
||||||
|
FILE_ALL_ACCESS,
|
||||||
|
&ObjectAttributes,
|
||||||
|
&Iosb,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
NtClose(VideoHandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* NAME
|
* NAME
|
||||||
* CsrServerInitialization
|
* CsrServerInitialization
|
||||||
|
@ -109,6 +137,8 @@ CsrServerInitialization (
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CsrInitVideo();
|
||||||
|
|
||||||
/* NEW NAMED PORT: \ApiPort */
|
/* NEW NAMED PORT: \ApiPort */
|
||||||
RtlInitUnicodeString(&PortName, L"\\Windows\\ApiPort");
|
RtlInitUnicodeString(&PortName, L"\\Windows\\ApiPort");
|
||||||
InitializeObjectAttributes(&ObAttributes,
|
InitializeObjectAttributes(&ObAttributes,
|
||||||
|
|
Loading…
Reference in a new issue