mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 12:55:43 +00:00
- Make VBEMP look like a legacy driver.
- Reorganize VideoPortInitialize (firstly do all checks, then do Driver Object Extension related operations). - Fix the hack Magnus Olsen added for the "No PNP videocard" problem, by adding a real check Windows 2003 SP1 videoport driver is performing (information got by building "stub" miniports and trying to load them with a checked build of W2K3SP1's videoprt.sys). - Add stubbed handler for IRP_MJ_SYSTEM_CONTROL (for PnP miniports) and IRP_MJ_INTERNAL_DEVICE_CONTROL. svn path=/trunk/; revision=31350
This commit is contained in:
parent
bf53c43ed8
commit
79a2c2db56
4 changed files with 76 additions and 44 deletions
|
@ -42,9 +42,9 @@ DriverEntry(IN PVOID Context1, IN PVOID Context2)
|
|||
InitData.HwInitialize = VBEInitialize;
|
||||
InitData.HwStartIO = VBEStartIO;
|
||||
InitData.HwResetHw = VBEResetHw;
|
||||
InitData.HwGetPowerState = VBEGetPowerState;
|
||||
InitData.HwSetPowerState = VBESetPowerState;
|
||||
InitData.HwGetVideoChildDescriptor = VBEGetVideoChildDescriptor;
|
||||
//InitData.HwGetPowerState = VBEGetPowerState;
|
||||
//InitData.HwSetPowerState = VBESetPowerState;
|
||||
//InitData.HwGetVideoChildDescriptor = VBEGetVideoChildDescriptor;
|
||||
InitData.HwDeviceExtensionSize = sizeof(VBE_DEVICE_EXTENSION);
|
||||
|
||||
return VideoPortInitialize(Context1, Context2, &InitData, NULL);
|
||||
|
|
|
@ -509,6 +509,14 @@ IntVideoPortDispatchPower(
|
|||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NTSTATUS NTAPI
|
||||
IntVideoPortDispatchSystemControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
VOID NTAPI
|
||||
IntVideoPortUnload(PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* VideoPort driver
|
||||
*
|
||||
* Copyright (C) ReactOS Team
|
||||
* Copyright (C) 2002-2004, 2007 ReactOS Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -553,7 +553,7 @@ VideoPortInitialize(
|
|||
PUNICODE_STRING RegistryPath = Context2;
|
||||
NTSTATUS Status;
|
||||
PVIDEO_PORT_DRIVER_EXTENSION DriverExtension;
|
||||
BOOL LegacyDetection = FALSE;
|
||||
BOOLEAN PnpDriver = FALSE, LegacyDetection = FALSE;
|
||||
|
||||
DPRINT("VideoPortInitialize\n");
|
||||
|
||||
|
@ -573,6 +573,63 @@ VideoPortInitialize(
|
|||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
switch (HwInitializationData->HwInitDataSize)
|
||||
{
|
||||
/*
|
||||
* NT4 drivers are special case, because we must use legacy method
|
||||
* of detection instead of the Plug & Play one.
|
||||
*/
|
||||
|
||||
case SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA:
|
||||
DPRINT("We were loaded by a Windows NT miniport driver.\n");
|
||||
break;
|
||||
|
||||
case SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA:
|
||||
DPRINT("We were loaded by a Windows 2000 miniport driver.\n");
|
||||
break;
|
||||
|
||||
case sizeof(VIDEO_HW_INITIALIZATION_DATA):
|
||||
DPRINT("We were loaded by a Windows XP or later miniport driver.\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINT("Invalid HwInitializationData size.\n");
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/* Set dispatching routines */
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = IntVideoPortDispatchOpen;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = IntVideoPortDispatchClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
|
||||
IntVideoPortDispatchDeviceControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] =
|
||||
IntVideoPortDispatchDeviceControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] =
|
||||
IntVideoPortDispatchWrite; // ReactOS-specific hack
|
||||
DriverObject->DriverUnload = IntVideoPortUnload;
|
||||
|
||||
/* Determine type of the miniport driver */
|
||||
if ((HwInitializationData->HwInitDataSize >=
|
||||
FIELD_OFFSET(VIDEO_HW_INITIALIZATION_DATA, HwQueryInterface))
|
||||
&& HwInitializationData->HwSetPowerState
|
||||
&& HwInitializationData->HwGetPowerState
|
||||
&& HwInitializationData->HwGetVideoChildDescriptor)
|
||||
{
|
||||
DPRINT("The miniport is a PnP miniport driver\n");
|
||||
PnpDriver = TRUE;
|
||||
}
|
||||
|
||||
/* Check if legacy detection should be applied */
|
||||
if (!PnpDriver || HwContext)
|
||||
{
|
||||
DPRINT("Legacy detection for adapter interface %d\n",
|
||||
HwInitializationData->AdapterInterfaceType);
|
||||
|
||||
/* FIXME: Move the code for legacy detection
|
||||
to another function and call it here */
|
||||
LegacyDetection = TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE:
|
||||
* The driver extension can be already allocated in case that we were
|
||||
|
@ -643,45 +700,6 @@ VideoPortInitialize(
|
|||
}
|
||||
DriverExtension->HwContext = HwContext;
|
||||
|
||||
switch (HwInitializationData->HwInitDataSize)
|
||||
{
|
||||
/*
|
||||
* NT4 drivers are special case, because we must use legacy method
|
||||
* of detection instead of the Plug & Play one.
|
||||
*/
|
||||
|
||||
case SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA:
|
||||
DPRINT("We were loaded by a Windows NT miniport driver.\n");
|
||||
LegacyDetection = TRUE;
|
||||
break;
|
||||
|
||||
case SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA:
|
||||
DPRINT("We were loaded by a Windows 2000 miniport driver.\n");
|
||||
break;
|
||||
|
||||
case sizeof(VIDEO_HW_INITIALIZATION_DATA):
|
||||
DPRINT("We were loaded by a Windows XP or later miniport driver.\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINT("Invalid HwInitializationData size.\n");
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/* We can't check HwInitializationData->AdapterInterfaceType to know if
|
||||
* we have to use legacy detection, as MSDN states that this member is
|
||||
* ignored by videoprt and should remain zero-initialized.
|
||||
* Force legacy detection, so NT4 drivers will still work on ReactOS.
|
||||
* WARNING: this will cause all Plug-and-Play IRPs to fail.
|
||||
*/
|
||||
LegacyDetection = TRUE;
|
||||
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = IntVideoPortDispatchOpen;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = IntVideoPortDispatchClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = IntVideoPortDispatchDeviceControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = IntVideoPortDispatchWrite;
|
||||
DriverObject->DriverUnload = IntVideoPortUnload;
|
||||
|
||||
/*
|
||||
* Plug & Play drivers registers the device in AddDevice routine. For
|
||||
* legacy drivers we must do it now.
|
||||
|
@ -710,6 +728,7 @@ VideoPortInitialize(
|
|||
DriverObject->DriverExtension->AddDevice = IntVideoPortAddDevice;
|
||||
DriverObject->MajorFunction[IRP_MJ_PNP] = IntVideoPortDispatchPnp;
|
||||
DriverObject->MajorFunction[IRP_MJ_POWER] = IntVideoPortDispatchPower;
|
||||
DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = IntVideoPortDispatchSystemControl;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -164,6 +164,11 @@ IntVideoPortDispatchPower(
|
|||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
NTSTATUS NTAPI
|
||||
IntVideoPortDispatchSystemControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
NTSTATUS NTAPI
|
||||
IntVideoPortDispatchWrite(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue