diff --git a/reactos/drivers/video/miniport/vbe/vbemp.c b/reactos/drivers/video/miniport/vbe/vbemp.c index a207c3eb2ba..242f87f57ab 100644 --- a/reactos/drivers/video/miniport/vbe/vbemp.c +++ b/reactos/drivers/video/miniport/vbe/vbemp.c @@ -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); diff --git a/reactos/drivers/video/videoprt/dispatch.c b/reactos/drivers/video/videoprt/dispatch.c index 631dad5c4bf..1ead689cbdd 100644 --- a/reactos/drivers/video/videoprt/dispatch.c +++ b/reactos/drivers/video/videoprt/dispatch.c @@ -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) { diff --git a/reactos/drivers/video/videoprt/videoprt.c b/reactos/drivers/video/videoprt/videoprt.c index 93e4eca9a25..02a0ac1ba05 100644 --- a/reactos/drivers/video/videoprt/videoprt.c +++ b/reactos/drivers/video/videoprt/videoprt.c @@ -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; } diff --git a/reactos/drivers/video/videoprt/videoprt.h b/reactos/drivers/video/videoprt/videoprt.h index 0a36827b8ff..872d40573a6 100644 --- a/reactos/drivers/video/videoprt/videoprt.h +++ b/reactos/drivers/video/videoprt/videoprt.h @@ -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,