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
|
||||
* Written by Rex Jolliff
|
||||
|
@ -40,15 +40,7 @@ STDCALL NTSTATUS
|
|||
DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
||||
IN PUNICODE_STRING RegistryPath)
|
||||
{
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -176,14 +168,16 @@ VideoPortInitialize(IN PVOID Context1,
|
|||
IN PVOID HwContext)
|
||||
{
|
||||
UCHAR Again;
|
||||
WCHAR UnicodeBuffer[18];
|
||||
WCHAR DeviceBuffer[20];
|
||||
WCHAR SymlinkBuffer[20];
|
||||
NTSTATUS Status;
|
||||
ANSI_STRING AnsiName;
|
||||
UNICODE_STRING UnicodeName;
|
||||
PDRIVER_OBJECT MPDriverObject = (PDRIVER_OBJECT) Context1;
|
||||
PDEVICE_OBJECT MPDeviceObject;
|
||||
VIDEO_PORT_CONFIG_INFO ConfigInfo;
|
||||
PVIDEOPORT_EXTENSION_DATA ExtensionData;
|
||||
ULONG DeviceNumber = 0;
|
||||
UNICODE_STRING DeviceName;
|
||||
UNICODE_STRING SymlinkName;
|
||||
|
||||
/* Build Dispatch table from passed data */
|
||||
MPDriverObject->DriverStartIo = (PDRIVER_STARTIO) HwInitializationData->HwStartIO;
|
||||
|
@ -192,17 +186,14 @@ VideoPortInitialize(IN PVOID Context1,
|
|||
Again = FALSE;
|
||||
do
|
||||
{
|
||||
/* FIXME: Need to add a device index for multiple adapters */
|
||||
RtlInitAnsiString(&AnsiName, "\\Device\\Display");
|
||||
UnicodeName.MaximumLength = 18 * sizeof(WCHAR);
|
||||
UnicodeName.Buffer = UnicodeBuffer;
|
||||
RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, FALSE);
|
||||
swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
|
||||
RtlInitUnicodeString(&DeviceName, DeviceBuffer);
|
||||
|
||||
/* Create the device */
|
||||
Status = IoCreateDevice(MPDriverObject,
|
||||
HwInitializationData->HwDeviceExtensionSize +
|
||||
sizeof(VIDEOPORT_EXTENSION_DATA),
|
||||
&UnicodeName,
|
||||
&DeviceName,
|
||||
FILE_DEVICE_VIDEO,
|
||||
0,
|
||||
TRUE,
|
||||
|
@ -212,6 +203,19 @@ VideoPortInitialize(IN PVOID Context1,
|
|||
DbgPrint("IoCreateDevice call failed\n",0);
|
||||
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 =
|
||||
(PVIDEOPORT_EXTENSION_DATA) MPDeviceObject->DeviceExtension;
|
||||
ExtensionData->DeviceObject = MPDeviceObject;
|
||||
|
@ -271,9 +275,11 @@ VideoPortInitialize(IN PVOID Context1,
|
|||
}
|
||||
|
||||
}
|
||||
DeviceNumber++;
|
||||
}
|
||||
while (Again);
|
||||
|
||||
|
||||
/* FIXME: initialize timer routine for MP Driver */
|
||||
if (HwInitializationData->HwTimer != NULL)
|
||||
{
|
||||
|
|
|
@ -64,6 +64,7 @@ typedef struct _GDIOBJHDR
|
|||
typedef PVOID PGDIOBJ;
|
||||
|
||||
PGDIOBJ GDIOBJ_AllocObject(WORD Size, WORD Magic);
|
||||
BOOL GDIOBJ_FreeObject (PGDIOBJ Obj, WORD Magic);
|
||||
HGDIOBJ GDIOBJ_PtrToHandle (PGDIOBJ Obj, WORD Magic);
|
||||
PGDIOBJ GDIOBJ_HandleToPtr (HGDIOBJ Obj, WORD Magic);
|
||||
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
|
||||
* (mostly swiped from Wine)
|
||||
|
@ -90,9 +90,17 @@ HANDLE DRIVER_FindMPDriver(LPCWSTR Name)
|
|||
{
|
||||
lName = ExAllocatePool(NonPagedPool, wcslen(Name) * sizeof(WCHAR) +
|
||||
10 * sizeof(WCHAR));
|
||||
wcscpy(lName, L"\\Devices\\");
|
||||
wcscpy(lName, L"\\??\\");
|
||||
if (!wcscmp (Name, L"DISPLAY"))
|
||||
{
|
||||
/* FIXME: Read this information from the registry ??? */
|
||||
wcscat(lName, L"DISPLAY1");
|
||||
}
|
||||
else
|
||||
{
|
||||
wcscat(lName, Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lName = ExAllocatePool(NonPagedPool, wcslen(Name) * sizeof(WCHAR));
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
@ -13,6 +13,7 @@
|
|||
#include <win32k/dc.h>
|
||||
#include <win32k/print.h>
|
||||
#include <win32k/region.h>
|
||||
#include <win32k/gdiobj.h>
|
||||
|
||||
// #define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
@ -163,7 +164,7 @@ HDC STDCALL W32kCreateDC(LPCWSTR Driver,
|
|||
{
|
||||
PGD_ENABLEDRIVER GDEnableDriver;
|
||||
PDC NewDC;
|
||||
HDC hDC;
|
||||
HDC hDC = NULL;
|
||||
DRVENABLEDATA DED;
|
||||
|
||||
/* Check for existing DC object */
|
||||
|
@ -866,7 +867,7 @@ PDC DC_AllocDC(LPCWSTR Driver)
|
|||
if (Driver != NULL)
|
||||
{
|
||||
NewDC->DriverName = ExAllocatePool(NonPagedPool,
|
||||
wcslen(Driver) * sizeof(WCHAR));
|
||||
(wcslen(Driver) + 1) * sizeof(WCHAR));
|
||||
wcscpy(NewDC->DriverName, Driver);
|
||||
}
|
||||
|
||||
|
@ -895,10 +896,11 @@ void DC_InitDC(PDC DCToInit)
|
|||
|
||||
void DC_FreeDC(PDC DCToFree)
|
||||
{
|
||||
PDC Tmp;
|
||||
|
||||
ExFreePool(DCToFree->DriverName);
|
||||
ExFreePool(DCToFree);
|
||||
if (!GDIOBJ_FreeObject((PGDIOBJ)DCToFree, GO_DC_MAGIC))
|
||||
{
|
||||
DbgPrint("DC_FreeDC failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* 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));
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
PGDIOBJHDR objHeader;
|
||||
|
|
Loading…
Reference in a new issue