mirror of
https://github.com/reactos/reactos.git
synced 2025-03-10 10:14:44 +00:00
Fixed mp driver initialization bug and some other ones
svn path=/trunk/; revision=1022
This commit is contained in:
parent
d53eeb0cee
commit
76f55a8a93
5 changed files with 58 additions and 28 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: vidport.c,v 1.10 1999/12/29 01:37:30 ekohl Exp $
|
/* $Id: vidport.c,v 1.11 2000/03/01 03:25:11 ekohl Exp $
|
||||||
*
|
*
|
||||||
* VideoPort driver
|
* VideoPort driver
|
||||||
* Written by Rex Jolliff
|
* Written by Rex Jolliff
|
||||||
|
@ -40,15 +40,7 @@ STDCALL NTSTATUS
|
||||||
DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
||||||
IN PUNICODE_STRING RegistryPath)
|
IN PUNICODE_STRING RegistryPath)
|
||||||
{
|
{
|
||||||
|
|
||||||
DbgPrint("VideoPort Driver %s\n", VERSION);
|
DbgPrint("VideoPort Driver %s\n", VERSION);
|
||||||
|
|
||||||
// Export other driver entry points...
|
|
||||||
DriverObject->DriverStartIo = VidStartIo;
|
|
||||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = VidDispatchOpenClose;
|
|
||||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = VidDispatchOpenClose;
|
|
||||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = VidDispatchDeviceControl;
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,14 +168,16 @@ VideoPortInitialize(IN PVOID Context1,
|
||||||
IN PVOID HwContext)
|
IN PVOID HwContext)
|
||||||
{
|
{
|
||||||
UCHAR Again;
|
UCHAR Again;
|
||||||
WCHAR UnicodeBuffer[18];
|
WCHAR DeviceBuffer[20];
|
||||||
|
WCHAR SymlinkBuffer[20];
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ANSI_STRING AnsiName;
|
|
||||||
UNICODE_STRING UnicodeName;
|
|
||||||
PDRIVER_OBJECT MPDriverObject = (PDRIVER_OBJECT) Context1;
|
PDRIVER_OBJECT MPDriverObject = (PDRIVER_OBJECT) Context1;
|
||||||
PDEVICE_OBJECT MPDeviceObject;
|
PDEVICE_OBJECT MPDeviceObject;
|
||||||
VIDEO_PORT_CONFIG_INFO ConfigInfo;
|
VIDEO_PORT_CONFIG_INFO ConfigInfo;
|
||||||
PVIDEOPORT_EXTENSION_DATA ExtensionData;
|
PVIDEOPORT_EXTENSION_DATA ExtensionData;
|
||||||
|
ULONG DeviceNumber = 0;
|
||||||
|
UNICODE_STRING DeviceName;
|
||||||
|
UNICODE_STRING SymlinkName;
|
||||||
|
|
||||||
/* Build Dispatch table from passed data */
|
/* Build Dispatch table from passed data */
|
||||||
MPDriverObject->DriverStartIo = (PDRIVER_STARTIO) HwInitializationData->HwStartIO;
|
MPDriverObject->DriverStartIo = (PDRIVER_STARTIO) HwInitializationData->HwStartIO;
|
||||||
|
@ -192,17 +186,14 @@ VideoPortInitialize(IN PVOID Context1,
|
||||||
Again = FALSE;
|
Again = FALSE;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* FIXME: Need to add a device index for multiple adapters */
|
swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
|
||||||
RtlInitAnsiString(&AnsiName, "\\Device\\Display");
|
RtlInitUnicodeString(&DeviceName, DeviceBuffer);
|
||||||
UnicodeName.MaximumLength = 18 * sizeof(WCHAR);
|
|
||||||
UnicodeName.Buffer = UnicodeBuffer;
|
|
||||||
RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, FALSE);
|
|
||||||
|
|
||||||
/* Create the device */
|
/* Create the device */
|
||||||
Status = IoCreateDevice(MPDriverObject,
|
Status = IoCreateDevice(MPDriverObject,
|
||||||
HwInitializationData->HwDeviceExtensionSize +
|
HwInitializationData->HwDeviceExtensionSize +
|
||||||
sizeof(VIDEOPORT_EXTENSION_DATA),
|
sizeof(VIDEOPORT_EXTENSION_DATA),
|
||||||
&UnicodeName,
|
&DeviceName,
|
||||||
FILE_DEVICE_VIDEO,
|
FILE_DEVICE_VIDEO,
|
||||||
0,
|
0,
|
||||||
TRUE,
|
TRUE,
|
||||||
|
@ -212,6 +203,19 @@ VideoPortInitialize(IN PVOID Context1,
|
||||||
DbgPrint("IoCreateDevice call failed\n",0);
|
DbgPrint("IoCreateDevice call failed\n",0);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* initialize the miniport drivers dispatch table */
|
||||||
|
MPDriverObject->MajorFunction[IRP_MJ_CREATE] = VidDispatchOpenClose;
|
||||||
|
MPDriverObject->MajorFunction[IRP_MJ_CLOSE] = VidDispatchOpenClose;
|
||||||
|
MPDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = VidDispatchDeviceControl;
|
||||||
|
|
||||||
|
/* create symbolic link "\??\DISPLAYx" */
|
||||||
|
swprintf(SymlinkBuffer, L"\\??\\DISPLAY%lu", DeviceNumber+1);
|
||||||
|
RtlInitUnicodeString (&SymlinkName,
|
||||||
|
SymlinkBuffer);
|
||||||
|
IoCreateSymbolicLink (&SymlinkName,
|
||||||
|
&DeviceName);
|
||||||
|
|
||||||
ExtensionData =
|
ExtensionData =
|
||||||
(PVIDEOPORT_EXTENSION_DATA) MPDeviceObject->DeviceExtension;
|
(PVIDEOPORT_EXTENSION_DATA) MPDeviceObject->DeviceExtension;
|
||||||
ExtensionData->DeviceObject = MPDeviceObject;
|
ExtensionData->DeviceObject = MPDeviceObject;
|
||||||
|
@ -271,9 +275,11 @@ VideoPortInitialize(IN PVOID Context1,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
DeviceNumber++;
|
||||||
}
|
}
|
||||||
while (Again);
|
while (Again);
|
||||||
|
|
||||||
|
|
||||||
/* FIXME: initialize timer routine for MP Driver */
|
/* FIXME: initialize timer routine for MP Driver */
|
||||||
if (HwInitializationData->HwTimer != NULL)
|
if (HwInitializationData->HwTimer != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,6 +64,7 @@ typedef struct _GDIOBJHDR
|
||||||
typedef PVOID PGDIOBJ;
|
typedef PVOID PGDIOBJ;
|
||||||
|
|
||||||
PGDIOBJ GDIOBJ_AllocObject(WORD Size, WORD Magic);
|
PGDIOBJ GDIOBJ_AllocObject(WORD Size, WORD Magic);
|
||||||
|
BOOL GDIOBJ_FreeObject (PGDIOBJ Obj, WORD Magic);
|
||||||
HGDIOBJ GDIOBJ_PtrToHandle (PGDIOBJ Obj, WORD Magic);
|
HGDIOBJ GDIOBJ_PtrToHandle (PGDIOBJ Obj, WORD Magic);
|
||||||
PGDIOBJ GDIOBJ_HandleToPtr (HGDIOBJ Obj, WORD Magic);
|
PGDIOBJ GDIOBJ_HandleToPtr (HGDIOBJ Obj, WORD Magic);
|
||||||
BOOL GDIOBJ_LockObject (HGDIOBJ Obj);
|
BOOL GDIOBJ_LockObject (HGDIOBJ Obj);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: driver.c,v 1.6 1999/12/09 02:45:05 rex Exp $
|
/* $Id: driver.c,v 1.7 2000/03/01 03:23:42 ekohl Exp $
|
||||||
*
|
*
|
||||||
* GDI Driver support routines
|
* GDI Driver support routines
|
||||||
* (mostly swiped from Wine)
|
* (mostly swiped from Wine)
|
||||||
|
@ -90,8 +90,16 @@ HANDLE DRIVER_FindMPDriver(LPCWSTR Name)
|
||||||
{
|
{
|
||||||
lName = ExAllocatePool(NonPagedPool, wcslen(Name) * sizeof(WCHAR) +
|
lName = ExAllocatePool(NonPagedPool, wcslen(Name) * sizeof(WCHAR) +
|
||||||
10 * sizeof(WCHAR));
|
10 * sizeof(WCHAR));
|
||||||
wcscpy(lName, L"\\Devices\\");
|
wcscpy(lName, L"\\??\\");
|
||||||
wcscat(lName, Name);
|
if (!wcscmp (Name, L"DISPLAY"))
|
||||||
|
{
|
||||||
|
/* FIXME: Read this information from the registry ??? */
|
||||||
|
wcscat(lName, L"DISPLAY1");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wcscat(lName, Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: dc.c,v 1.10 1999/12/09 02:45:06 rex Exp $
|
/* $Id: dc.c,v 1.11 2000/03/01 03:23:57 ekohl Exp $
|
||||||
*
|
*
|
||||||
* DC.C - Device context functions
|
* DC.C - Device context functions
|
||||||
*
|
*
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
#include <win32k/dc.h>
|
#include <win32k/dc.h>
|
||||||
#include <win32k/print.h>
|
#include <win32k/print.h>
|
||||||
#include <win32k/region.h>
|
#include <win32k/region.h>
|
||||||
|
#include <win32k/gdiobj.h>
|
||||||
|
|
||||||
// #define NDEBUG
|
// #define NDEBUG
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
@ -163,7 +164,7 @@ HDC STDCALL W32kCreateDC(LPCWSTR Driver,
|
||||||
{
|
{
|
||||||
PGD_ENABLEDRIVER GDEnableDriver;
|
PGD_ENABLEDRIVER GDEnableDriver;
|
||||||
PDC NewDC;
|
PDC NewDC;
|
||||||
HDC hDC;
|
HDC hDC = NULL;
|
||||||
DRVENABLEDATA DED;
|
DRVENABLEDATA DED;
|
||||||
|
|
||||||
/* Check for existing DC object */
|
/* Check for existing DC object */
|
||||||
|
@ -866,7 +867,7 @@ PDC DC_AllocDC(LPCWSTR Driver)
|
||||||
if (Driver != NULL)
|
if (Driver != NULL)
|
||||||
{
|
{
|
||||||
NewDC->DriverName = ExAllocatePool(NonPagedPool,
|
NewDC->DriverName = ExAllocatePool(NonPagedPool,
|
||||||
wcslen(Driver) * sizeof(WCHAR));
|
(wcslen(Driver) + 1) * sizeof(WCHAR));
|
||||||
wcscpy(NewDC->DriverName, Driver);
|
wcscpy(NewDC->DriverName, Driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -895,10 +896,11 @@ void DC_InitDC(PDC DCToInit)
|
||||||
|
|
||||||
void DC_FreeDC(PDC DCToFree)
|
void DC_FreeDC(PDC DCToFree)
|
||||||
{
|
{
|
||||||
PDC Tmp;
|
|
||||||
|
|
||||||
ExFreePool(DCToFree->DriverName);
|
ExFreePool(DCToFree->DriverName);
|
||||||
ExFreePool(DCToFree);
|
if (!GDIOBJ_FreeObject((PGDIOBJ)DCToFree, GO_DC_MAGIC))
|
||||||
|
{
|
||||||
|
DbgPrint("DC_FreeDC failed\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* GDIOBJ.C - GDI object manipulation routines
|
* GDIOBJ.C - GDI object manipulation routines
|
||||||
*
|
*
|
||||||
* $Id: gdiobj.c,v 1.4 1999/11/17 20:54:05 rex Exp $
|
* $Id: gdiobj.c,v 1.5 2000/03/01 03:23:57 ekohl Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -29,6 +29,19 @@ PGDIOBJ GDIOBJ_AllocObject(WORD Size, WORD Magic)
|
||||||
return (PGDIOBJ)(((PCHAR) NewObj) + sizeof (GDIOBJHDR));
|
return (PGDIOBJ)(((PCHAR) NewObj) + sizeof (GDIOBJHDR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL GDIOBJ_FreeObject (PGDIOBJ Obj, WORD Magic)
|
||||||
|
{
|
||||||
|
PGDIOBJHDR ObjHdr;
|
||||||
|
|
||||||
|
ObjHdr = (PGDIOBJHDR)(((PCHAR)Obj) - sizeof (GDIOBJHDR));
|
||||||
|
if (ObjHdr->wMagic != Magic)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
ExFreePool (ObjHdr);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
HGDIOBJ GDIOBJ_PtrToHandle (PGDIOBJ Obj, WORD Magic)
|
HGDIOBJ GDIOBJ_PtrToHandle (PGDIOBJ Obj, WORD Magic)
|
||||||
{
|
{
|
||||||
PGDIOBJHDR objHeader;
|
PGDIOBJHDR objHeader;
|
||||||
|
|
Loading…
Reference in a new issue