4 * Copyright (C) 2002-2004, 2007 ReactOS Team
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 /* GLOBAL VARIABLES ***********************************************************/
28 ULONG CsrssInitialized
= FALSE
;
29 PKPROCESS Csrss
= NULL
;
30 ULONG VideoPortDeviceNumber
= 0;
32 /* PRIVATE FUNCTIONS **********************************************************/
36 IN PDRIVER_OBJECT DriverObject
,
37 IN PUNICODE_STRING RegistryPath
)
39 return STATUS_SUCCESS
;
43 IntVideoPortImageDirectoryEntryToData(
47 PIMAGE_NT_HEADERS NtHeader
;
50 NtHeader
= RtlImageNtHeader(BaseAddress
);
54 if (Directory
>= NtHeader
->OptionalHeader
.NumberOfRvaAndSizes
)
57 Va
= NtHeader
->OptionalHeader
.DataDirectory
[Directory
].VirtualAddress
;
61 return (PVOID
)((ULONG_PTR
)BaseAddress
+ Va
);
65 IntVideoPortDeferredRoutine(
67 IN PVOID DeferredContext
,
68 IN PVOID SystemArgument1
,
69 IN PVOID SystemArgument2
)
71 PVOID HwDeviceExtension
=
72 &((PVIDEO_PORT_DEVICE_EXTENSION
)DeferredContext
)->MiniPortDeviceExtension
;
73 ((PMINIPORT_DPC_ROUTINE
)SystemArgument1
)(HwDeviceExtension
, SystemArgument2
);
77 IntCreateRegistryPath(
78 IN PCUNICODE_STRING DriverRegistryPath
,
79 OUT PUNICODE_STRING DeviceRegistryPath
)
81 static WCHAR RegistryMachineSystem
[] = L
"\\REGISTRY\\MACHINE\\SYSTEM\\";
82 static WCHAR CurrentControlSet
[] = L
"CURRENTCONTROLSET\\";
83 static WCHAR ControlSet
[] = L
"CONTROLSET";
84 static WCHAR Insert1
[] = L
"Hardware Profiles\\Current\\System\\CurrentControlSet\\";
85 static WCHAR Insert2
[] = L
"\\Device0";
86 LPWSTR ProfilePath
= NULL
;
88 PWCHAR AfterControlSet
;
90 Valid
= (0 == _wcsnicmp(DriverRegistryPath
->Buffer
, RegistryMachineSystem
,
91 wcslen(RegistryMachineSystem
)));
93 AfterControlSet
= DriverRegistryPath
->Buffer
+ wcslen(RegistryMachineSystem
);
94 if (0 == _wcsnicmp(AfterControlSet
, CurrentControlSet
, wcslen(CurrentControlSet
)))
96 AfterControlSet
+= wcslen(CurrentControlSet
);
98 else if (0 == _wcsnicmp(AfterControlSet
, ControlSet
, wcslen(ControlSet
)))
100 AfterControlSet
+= wcslen(ControlSet
);
101 while (L
'0' <= *AfterControlSet
&& L
'9' <= *AfterControlSet
)
105 Valid
= (L
'\\' == *AfterControlSet
);
116 ProfilePath
= ExAllocatePoolWithTag(PagedPool
,
117 (wcslen(DriverRegistryPath
->Buffer
) +
118 wcslen(Insert1
) + wcslen(Insert2
) + 1) * sizeof(WCHAR
),
120 if (NULL
!= ProfilePath
)
122 wcsncpy(ProfilePath
, DriverRegistryPath
->Buffer
, AfterControlSet
- DriverRegistryPath
->Buffer
);
123 wcscpy(ProfilePath
+ (AfterControlSet
- DriverRegistryPath
->Buffer
), Insert1
);
124 wcscat(ProfilePath
, AfterControlSet
);
125 wcscat(ProfilePath
, Insert2
);
127 Valid
= NT_SUCCESS(RtlCheckRegistryKey(RTL_REGISTRY_ABSOLUTE
, ProfilePath
));
136 WARN_(VIDEOPRT
, "Unparsable registry path %wZ", DriverRegistryPath
);
141 RtlInitUnicodeString(DeviceRegistryPath
, ProfilePath
);
146 ExFreePoolWithTag(ProfilePath
, TAG_VIDEO_PORT
);
148 DeviceRegistryPath
->Length
=
149 DeviceRegistryPath
->MaximumLength
=
150 DriverRegistryPath
->Length
+ (9 * sizeof(WCHAR
));
151 DeviceRegistryPath
->Length
-= sizeof(WCHAR
);
152 DeviceRegistryPath
->Buffer
= ExAllocatePoolWithTag(
154 DeviceRegistryPath
->MaximumLength
,
156 if (!DeviceRegistryPath
->Buffer
)
157 return STATUS_NO_MEMORY
;
158 swprintf(DeviceRegistryPath
->Buffer
, L
"%s\\Device0",
159 DriverRegistryPath
->Buffer
);
161 return STATUS_SUCCESS
;
165 IntVideoPortCreateAdapterDeviceObject(
166 IN PDRIVER_OBJECT DriverObject
,
167 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension
,
168 IN PDEVICE_OBJECT PhysicalDeviceObject
,
169 OUT PDEVICE_OBJECT
*DeviceObject OPTIONAL
)
171 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
174 PCI_SLOT_NUMBER SlotNumber
;
177 WCHAR DeviceBuffer
[20];
178 UNICODE_STRING DeviceName
;
179 PDEVICE_OBJECT DeviceObject_
;
181 if (DeviceObject
== NULL
)
182 DeviceObject
= &DeviceObject_
;
185 * Find the first free device number that can be used for video device
186 * object names and symlinks.
189 DeviceNumber
= VideoPortDeviceNumber
;
190 if (DeviceNumber
== 0xFFFFFFFF)
192 WARN_(VIDEOPRT
, "Can't find free device number\n");
193 return STATUS_UNSUCCESSFUL
;
197 * Create the device object.
200 /* Create a unicode device name. */
201 swprintf(DeviceBuffer
, L
"\\Device\\Video%lu", DeviceNumber
);
202 RtlInitUnicodeString(&DeviceName
, DeviceBuffer
);
204 INFO_(VIDEOPRT
, "HwDeviceExtension size is: 0x%x\n",
205 DriverExtension
->InitializationData
.HwDeviceExtensionSize
);
207 /* Create the device object. */
208 Status
= IoCreateDevice(
210 sizeof(VIDEO_PORT_DEVICE_EXTENSION
) +
211 DriverExtension
->InitializationData
.HwDeviceExtensionSize
,
218 if (!NT_SUCCESS(Status
))
220 WARN_(VIDEOPRT
, "IoCreateDevice call failed with status 0x%08x\n", Status
);
225 * Set the buffering strategy here. If you change this, remember
226 * to change VidDispatchDeviceControl too.
229 (*DeviceObject
)->Flags
|= DO_BUFFERED_IO
;
232 * Initialize device extension.
235 DeviceExtension
= (PVIDEO_PORT_DEVICE_EXTENSION
)((*DeviceObject
)->DeviceExtension
);
236 DeviceExtension
->DeviceNumber
= DeviceNumber
;
237 DeviceExtension
->DriverObject
= DriverObject
;
238 DeviceExtension
->PhysicalDeviceObject
= PhysicalDeviceObject
;
239 DeviceExtension
->FunctionalDeviceObject
= *DeviceObject
;
240 DeviceExtension
->DriverExtension
= DriverExtension
;
243 * Get the registry path associated with this driver.
246 Status
= IntCreateRegistryPath(
247 &DriverExtension
->RegistryPath
,
248 &DeviceExtension
->RegistryPath
);
249 if (!NT_SUCCESS(Status
))
251 WARN_(VIDEOPRT
, "IntCreateRegistryPath() call failed with status 0x%08x\n", Status
);
252 IoDeleteDevice(*DeviceObject
);
253 *DeviceObject
= NULL
;
257 if (PhysicalDeviceObject
!= NULL
)
259 /* Get bus number from the upper level bus driver. */
260 Size
= sizeof(ULONG
);
261 Status
= IoGetDeviceProperty(
262 PhysicalDeviceObject
,
263 DevicePropertyBusNumber
,
265 &DeviceExtension
->SystemIoBusNumber
,
267 if (!NT_SUCCESS(Status
))
269 WARN_(VIDEOPRT
, "Couldn't get an information from bus driver. We will try to\n"
270 "use legacy detection method, but even that doesn't mean that\n"
272 DeviceExtension
->PhysicalDeviceObject
= NULL
;
276 DeviceExtension
->AdapterInterfaceType
=
277 DriverExtension
->InitializationData
.AdapterInterfaceType
;
279 if (PhysicalDeviceObject
!= NULL
)
281 /* Get bus type from the upper level bus driver. */
282 Size
= sizeof(ULONG
);
284 PhysicalDeviceObject
,
285 DevicePropertyLegacyBusType
,
287 &DeviceExtension
->AdapterInterfaceType
,
290 /* Get bus device address from the upper level bus driver. */
291 Size
= sizeof(ULONG
);
293 PhysicalDeviceObject
,
294 DevicePropertyAddress
,
299 /* Convert slotnumber to PCI_SLOT_NUMBER */
300 SlotNumber
.u
.AsULONG
= 0;
301 SlotNumber
.u
.bits
.DeviceNumber
= (PciSlotNumber
>> 16) & 0xFFFF;
302 SlotNumber
.u
.bits
.FunctionNumber
= PciSlotNumber
& 0xFFFF;
303 DeviceExtension
->SystemIoSlotNumber
= SlotNumber
.u
.AsULONG
;
306 InitializeListHead(&DeviceExtension
->AddressMappingListHead
);
308 &DeviceExtension
->DpcObject
,
309 IntVideoPortDeferredRoutine
,
312 KeInitializeMutex(&DeviceExtension
->DeviceLock
, 0);
314 /* Attach the device. */
315 if (PhysicalDeviceObject
!= NULL
)
316 DeviceExtension
->NextDeviceObject
= IoAttachDeviceToDeviceStack(
317 *DeviceObject
, PhysicalDeviceObject
);
319 /* Remove the initailizing flag */
320 (*DeviceObject
)->Flags
&= ~DO_DEVICE_INITIALIZING
;
321 return STATUS_SUCCESS
;
326 IntVideoPortFindAdapter(
327 IN PDRIVER_OBJECT DriverObject
,
328 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension
,
329 IN PDEVICE_OBJECT DeviceObject
)
331 WCHAR DeviceVideoBuffer
[20];
332 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
335 VIDEO_PORT_CONFIG_INFO ConfigInfo
;
336 SYSTEM_BASIC_INFORMATION SystemBasicInfo
;
338 WCHAR DeviceBuffer
[20];
339 UNICODE_STRING DeviceName
;
340 WCHAR SymlinkBuffer
[20];
341 UNICODE_STRING SymlinkName
;
342 BOOL LegacyDetection
= FALSE
;
343 ULONG DeviceNumber
, DisplayNumber
;
345 DeviceExtension
= (PVIDEO_PORT_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
346 DeviceNumber
= DeviceExtension
->DeviceNumber
;
349 * Setup a ConfigInfo structure that we will pass to HwFindAdapter.
352 RtlZeroMemory(&ConfigInfo
, sizeof(VIDEO_PORT_CONFIG_INFO
));
353 ConfigInfo
.Length
= sizeof(VIDEO_PORT_CONFIG_INFO
);
354 ConfigInfo
.AdapterInterfaceType
= DeviceExtension
->AdapterInterfaceType
;
355 if (ConfigInfo
.AdapterInterfaceType
== PCIBus
)
356 ConfigInfo
.InterruptMode
= LevelSensitive
;
358 ConfigInfo
.InterruptMode
= Latched
;
359 ConfigInfo
.DriverRegistryPath
= DriverExtension
->RegistryPath
.Buffer
;
360 ConfigInfo
.VideoPortGetProcAddress
= IntVideoPortGetProcAddress
;
361 ConfigInfo
.SystemIoBusNumber
= DeviceExtension
->SystemIoBusNumber
;
362 ConfigInfo
.BusInterruptLevel
= DeviceExtension
->InterruptLevel
;
363 ConfigInfo
.BusInterruptVector
= DeviceExtension
->InterruptVector
;
365 Size
= sizeof(SystemBasicInfo
);
366 Status
= ZwQuerySystemInformation(
367 SystemBasicInformation
,
372 if (NT_SUCCESS(Status
))
374 ConfigInfo
.SystemMemorySize
=
375 SystemBasicInfo
.NumberOfPhysicalPages
*
376 SystemBasicInfo
.PageSize
;
380 * Call miniport HwVidFindAdapter entry point to detect if
381 * particular device is present. There are two possible code
382 * paths. The first one is for Legacy drivers (NT4) and cases
383 * when we don't have information about what bus we're on. The
384 * second case is the standard one for Plug & Play drivers.
386 if (DeviceExtension
->PhysicalDeviceObject
== NULL
)
388 LegacyDetection
= TRUE
;
393 ULONG BusNumber
, MaxBuses
;
395 MaxBuses
= DeviceExtension
->AdapterInterfaceType
== PCIBus
? 8 : 1;
397 for (BusNumber
= 0; BusNumber
< MaxBuses
; BusNumber
++)
399 DeviceExtension
->SystemIoBusNumber
=
400 ConfigInfo
.SystemIoBusNumber
= BusNumber
;
402 RtlZeroMemory(&DeviceExtension
->MiniPortDeviceExtension
,
403 DriverExtension
->InitializationData
.HwDeviceExtensionSize
);
405 /* FIXME: Need to figure out what string to pass as param 3. */
406 Status
= DriverExtension
->InitializationData
.HwFindAdapter(
407 &DeviceExtension
->MiniPortDeviceExtension
,
408 DriverExtension
->HwContext
,
413 if (Status
== ERROR_DEV_NOT_EXIST
)
417 else if (Status
== NO_ERROR
)
423 WARN_(VIDEOPRT
, "HwFindAdapter call failed with error 0x%X\n", Status
);
424 RtlFreeUnicodeString(&DeviceExtension
->RegistryPath
);
425 if (DeviceExtension
->NextDeviceObject
)
426 IoDetachDevice(DeviceExtension
->NextDeviceObject
);
427 IoDeleteDevice(DeviceObject
);
435 /* FIXME: Need to figure out what string to pass as param 3. */
436 Status
= DriverExtension
->InitializationData
.HwFindAdapter(
437 &DeviceExtension
->MiniPortDeviceExtension
,
438 DriverExtension
->HwContext
,
444 if (Status
!= NO_ERROR
)
446 WARN_(VIDEOPRT
, "HwFindAdapter call failed with error 0x%X\n", Status
);
447 RtlFreeUnicodeString(&DeviceExtension
->RegistryPath
);
448 if (DeviceExtension
->NextDeviceObject
)
449 IoDetachDevice(DeviceExtension
->NextDeviceObject
);
450 IoDeleteDevice(DeviceObject
);
455 * Now we know the device is present, so let's do all additional tasks
456 * such as creating symlinks or setting up interrupts and timer.
459 /* Create a unicode device name. */
460 swprintf(DeviceBuffer
, L
"\\Device\\Video%lu", DeviceNumber
);
461 RtlInitUnicodeString(&DeviceName
, DeviceBuffer
);
463 /* Create symbolic link "\??\DISPLAYx" */
465 /* HACK: We need this to find the first available display to
466 * use. We can't use the device number because then we could
467 * end up with \Device\Video0 being non-functional because
468 * HwFindAdapter returned an error. \Device\Video1 would be
469 * the correct primary display but it would be set to DISPLAY2
470 * so it would never be used and ROS would bugcheck on boot.
471 * By doing it this way, we ensure that DISPLAY1 is always
472 * functional. Another idea would be letting the IO manager
473 * give our video devices names then getting those names
474 * somehow and creating symbolic links to \Device\VideoX
475 * and \??\DISPLAYX once we know that HwFindAdapter has succeeded.
481 swprintf(SymlinkBuffer
, L
"\\??\\DISPLAY%lu", DisplayNumber
);
482 RtlInitUnicodeString(&SymlinkName
, SymlinkBuffer
);
484 while (IoCreateSymbolicLink(&SymlinkName
, &DeviceName
) != STATUS_SUCCESS
);
486 /* Add entry to DEVICEMAP\VIDEO key in registry. */
487 swprintf(DeviceVideoBuffer
, L
"\\Device\\Video%d", DisplayNumber
- 1);
488 RtlWriteRegistryValue(
489 RTL_REGISTRY_DEVICEMAP
,
493 DeviceExtension
->RegistryPath
.Buffer
,
494 DeviceExtension
->RegistryPath
.MaximumLength
);
496 RtlWriteRegistryValue(
497 RTL_REGISTRY_DEVICEMAP
,
502 sizeof(DeviceNumber
));
504 /* FIXME: Allocate hardware resources for device. */
507 * Allocate interrupt for device.
510 if (!IntVideoPortSetupInterrupt(DeviceObject
, DriverExtension
, &ConfigInfo
))
512 RtlFreeUnicodeString(&DeviceExtension
->RegistryPath
);
513 if (DeviceExtension
->NextDeviceObject
)
514 IoDetachDevice(DeviceExtension
->NextDeviceObject
);
515 IoDeleteDevice(DeviceObject
);
516 return STATUS_INSUFFICIENT_RESOURCES
;
520 * Allocate timer for device.
523 if (!IntVideoPortSetupTimer(DeviceObject
, DriverExtension
))
525 if (DeviceExtension
->InterruptObject
!= NULL
)
526 IoDisconnectInterrupt(DeviceExtension
->InterruptObject
);
527 if (DeviceExtension
->NextDeviceObject
)
528 IoDetachDevice(DeviceExtension
->NextDeviceObject
);
529 RtlFreeUnicodeString(&DeviceExtension
->RegistryPath
);
530 IoDeleteDevice(DeviceObject
);
531 WARN_(VIDEOPRT
, "STATUS_INSUFFICIENT_RESOURCES\n");
532 return STATUS_INSUFFICIENT_RESOURCES
;
536 * Query children of the device.
538 VideoPortEnumerateChildren(&DeviceExtension
->MiniPortDeviceExtension
, NULL
);
540 INFO_(VIDEOPRT
, "STATUS_SUCCESS\n");
541 return STATUS_SUCCESS
;
545 IntAttachToCSRSS(PKPROCESS
*CallingProcess
, PKAPC_STATE ApcState
)
547 *CallingProcess
= (PKPROCESS
)PsGetCurrentProcess();
548 if (*CallingProcess
!= Csrss
)
550 KeStackAttachProcess(Csrss
, ApcState
);
555 IntDetachFromCSRSS(PKPROCESS
*CallingProcess
, PKAPC_STATE ApcState
)
557 if (*CallingProcess
!= Csrss
)
559 KeUnstackDetachProcess(ApcState
);
563 /* PUBLIC FUNCTIONS ***********************************************************/
573 IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData
,
576 PDRIVER_OBJECT DriverObject
= Context1
;
577 PUNICODE_STRING RegistryPath
= Context2
;
579 PVIDEO_PORT_DRIVER_EXTENSION DriverExtension
;
580 BOOLEAN PnpDriver
= FALSE
, LegacyDetection
= FALSE
;
582 TRACE_(VIDEOPRT
, "VideoPortInitialize\n");
585 * As a first thing do parameter checks.
588 if (HwInitializationData
->HwInitDataSize
> sizeof(VIDEO_HW_INITIALIZATION_DATA
))
590 return STATUS_REVISION_MISMATCH
;
593 if (HwInitializationData
->HwFindAdapter
== NULL
||
594 HwInitializationData
->HwInitialize
== NULL
||
595 HwInitializationData
->HwStartIO
== NULL
)
597 return STATUS_INVALID_PARAMETER
;
600 switch (HwInitializationData
->HwInitDataSize
)
603 * NT4 drivers are special case, because we must use legacy method
604 * of detection instead of the Plug & Play one.
607 case SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA
:
608 INFO_(VIDEOPRT
, "We were loaded by a Windows NT miniport driver.\n");
611 case SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA
:
612 INFO_(VIDEOPRT
, "We were loaded by a Windows 2000 miniport driver.\n");
615 case sizeof(VIDEO_HW_INITIALIZATION_DATA
):
616 INFO_(VIDEOPRT
, "We were loaded by a Windows XP or later miniport driver.\n");
620 WARN_(VIDEOPRT
, "Invalid HwInitializationData size.\n");
621 return STATUS_UNSUCCESSFUL
;
624 /* Set dispatching routines */
625 DriverObject
->MajorFunction
[IRP_MJ_CREATE
] = IntVideoPortDispatchOpen
;
626 DriverObject
->MajorFunction
[IRP_MJ_CLOSE
] = IntVideoPortDispatchClose
;
627 DriverObject
->MajorFunction
[IRP_MJ_DEVICE_CONTROL
] =
628 IntVideoPortDispatchDeviceControl
;
629 DriverObject
->MajorFunction
[IRP_MJ_INTERNAL_DEVICE_CONTROL
] =
630 IntVideoPortDispatchDeviceControl
;
631 DriverObject
->MajorFunction
[IRP_MJ_WRITE
] =
632 IntVideoPortDispatchWrite
; // ReactOS-specific hack
633 DriverObject
->DriverUnload
= IntVideoPortUnload
;
635 /* Determine type of the miniport driver */
636 if ((HwInitializationData
->HwInitDataSize
>=
637 FIELD_OFFSET(VIDEO_HW_INITIALIZATION_DATA
, HwQueryInterface
))
638 && HwInitializationData
->HwSetPowerState
639 && HwInitializationData
->HwGetPowerState
640 && HwInitializationData
->HwGetVideoChildDescriptor
)
642 INFO_(VIDEOPRT
, "The miniport is a PnP miniport driver\n");
646 /* Check if legacy detection should be applied */
647 if (!PnpDriver
|| HwContext
)
649 INFO_(VIDEOPRT
, "Legacy detection for adapter interface %d\n",
650 HwInitializationData
->AdapterInterfaceType
);
652 /* FIXME: Move the code for legacy detection
653 to another function and call it here */
654 LegacyDetection
= TRUE
;
659 * The driver extension can be already allocated in case that we were
660 * called by legacy driver and failed detecting device. Some miniport
661 * drivers in that case adjust parameters and call VideoPortInitialize
665 DriverExtension
= IoGetDriverObjectExtension(DriverObject
, DriverObject
);
666 if (DriverExtension
== NULL
)
668 Status
= IoAllocateDriverObjectExtension(
671 sizeof(VIDEO_PORT_DRIVER_EXTENSION
),
672 (PVOID
*)&DriverExtension
);
674 if (!NT_SUCCESS(Status
))
680 * Save the registry path. This should be done only once even if
681 * VideoPortInitialize is called multiple times.
684 if (RegistryPath
->Length
!= 0)
686 DriverExtension
->RegistryPath
.Length
= 0;
687 DriverExtension
->RegistryPath
.MaximumLength
=
688 RegistryPath
->Length
+ sizeof(UNICODE_NULL
);
689 DriverExtension
->RegistryPath
.Buffer
=
690 ExAllocatePoolWithTag(
692 DriverExtension
->RegistryPath
.MaximumLength
,
694 if (DriverExtension
->RegistryPath
.Buffer
== NULL
)
696 RtlInitUnicodeString(&DriverExtension
->RegistryPath
, NULL
);
697 return STATUS_INSUFFICIENT_RESOURCES
;
700 RtlCopyUnicodeString(&DriverExtension
->RegistryPath
, RegistryPath
);
701 INFO_(VIDEOPRT
, "RegistryPath: %wZ\n", &DriverExtension
->RegistryPath
);
705 RtlInitUnicodeString(&DriverExtension
->RegistryPath
, NULL
);
710 * Copy the correct miniport initialization data to the device extension.
714 &DriverExtension
->InitializationData
,
715 HwInitializationData
,
716 HwInitializationData
->HwInitDataSize
);
717 if (HwInitializationData
->HwInitDataSize
<
718 sizeof(VIDEO_HW_INITIALIZATION_DATA
))
720 RtlZeroMemory((PVOID
)((ULONG_PTR
)&DriverExtension
->InitializationData
+
721 HwInitializationData
->HwInitDataSize
),
722 sizeof(VIDEO_HW_INITIALIZATION_DATA
) -
723 HwInitializationData
->HwInitDataSize
);
725 DriverExtension
->HwContext
= HwContext
;
728 * Plug & Play drivers registers the device in AddDevice routine. For
729 * legacy drivers we must do it now.
734 PDEVICE_OBJECT DeviceObject
;
736 if (HwInitializationData
->HwInitDataSize
!= SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA
)
738 /* power management */
739 DriverObject
->MajorFunction
[IRP_MJ_POWER
] = IntVideoPortDispatchPower
;
741 Status
= IntVideoPortCreateAdapterDeviceObject(DriverObject
, DriverExtension
,
742 NULL
, &DeviceObject
);
743 INFO_(VIDEOPRT
, "IntVideoPortCreateAdapterDeviceObject returned 0x%x\n", Status
);
744 if (!NT_SUCCESS(Status
))
746 Status
= IntVideoPortFindAdapter(DriverObject
, DriverExtension
, DeviceObject
);
747 INFO_(VIDEOPRT
, "IntVideoPortFindAdapter returned 0x%x\n", Status
);
748 if (NT_SUCCESS(Status
))
749 VideoPortDeviceNumber
++;
754 DriverObject
->DriverExtension
->AddDevice
= IntVideoPortAddDevice
;
755 DriverObject
->MajorFunction
[IRP_MJ_PNP
] = IntVideoPortDispatchPnp
;
756 DriverObject
->MajorFunction
[IRP_MJ_POWER
] = IntVideoPortDispatchPower
;
757 DriverObject
->MajorFunction
[IRP_MJ_SYSTEM_CONTROL
] = IntVideoPortDispatchSystemControl
;
759 return STATUS_SUCCESS
;
769 IN VIDEO_DEBUG_LEVEL DebugPrintLevel
,
770 IN PCHAR DebugMessage
, ...)
774 va_start(ap
, DebugMessage
);
775 vDbgPrintEx(DPFLTR_IHVVIDEO_ID
, DebugPrintLevel
, DebugMessage
, ap
);
785 IN PVOID HwDeviceExtension
,
786 IN PVIDEO_REQUEST_PACKET Vrp OPTIONAL
,
787 IN VP_STATUS ErrorCode
,
792 INFO_(VIDEOPRT
, "VideoPortLogError ErrorCode %d (0x%x) UniqueId %lu (0x%lx)\n",
793 ErrorCode
, ErrorCode
, UniqueId
, UniqueId
);
795 INFO_(VIDEOPRT
, "Vrp->IoControlCode %lu (0x%lx)\n", Vrp
->IoControlCode
, Vrp
->IoControlCode
);
803 VideoPortGetCurrentIrql(VOID
)
805 return KeGetCurrentIrql();
808 typedef struct QueryRegistryCallbackContext
810 PVOID HwDeviceExtension
;
812 PMINIPORT_GET_REGISTRY_ROUTINE HwGetRegistryRoutine
;
813 } QUERY_REGISTRY_CALLBACK_CONTEXT
, *PQUERY_REGISTRY_CALLBACK_CONTEXT
;
815 static NTSTATUS NTAPI
816 QueryRegistryCallback(
820 IN ULONG ValueLength
,
822 IN PVOID EntryContext
)
824 PQUERY_REGISTRY_CALLBACK_CONTEXT CallbackContext
= (PQUERY_REGISTRY_CALLBACK_CONTEXT
) Context
;
826 INFO_(VIDEOPRT
, "Found registry value for name %S: type %d, length %d\n",
827 ValueName
, ValueType
, ValueLength
);
828 return (*(CallbackContext
->HwGetRegistryRoutine
))(
829 CallbackContext
->HwDeviceExtension
,
830 CallbackContext
->HwContext
,
841 VideoPortGetRegistryParameters(
842 IN PVOID HwDeviceExtension
,
843 IN PWSTR ParameterName
,
844 IN UCHAR IsParameterFileName
,
845 IN PMINIPORT_GET_REGISTRY_ROUTINE GetRegistryRoutine
,
848 RTL_QUERY_REGISTRY_TABLE QueryTable
[2] = {{0}};
849 QUERY_REGISTRY_CALLBACK_CONTEXT Context
;
850 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
852 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
854 TRACE_(VIDEOPRT
, "VideoPortGetRegistryParameters ParameterName %S, RegPath: %wZ\n",
855 ParameterName
, &DeviceExtension
->RegistryPath
);
857 Context
.HwDeviceExtension
= HwDeviceExtension
;
858 Context
.HwContext
= HwContext
;
859 Context
.HwGetRegistryRoutine
= GetRegistryRoutine
;
861 QueryTable
[0].QueryRoutine
= QueryRegistryCallback
;
862 QueryTable
[0].Flags
= RTL_QUERY_REGISTRY_REQUIRED
;
863 QueryTable
[0].Name
= ParameterName
;
865 if (!NT_SUCCESS(RtlQueryRegistryValues(
866 RTL_REGISTRY_ABSOLUTE
,
867 DeviceExtension
->RegistryPath
.Buffer
,
872 WARN_(VIDEOPRT
, "VideoPortGetRegistryParameters could not find the "
873 "requested parameter\n");
874 return ERROR_INVALID_PARAMETER
;
877 if (IsParameterFileName
)
879 /* FIXME: need to read the contents of the file */
891 VideoPortSetRegistryParameters(
892 IN PVOID HwDeviceExtension
,
895 IN ULONG ValueLength
)
899 TRACE_(VIDEOPRT
, "VideoPortSetRegistryParameters ParameterName %S, RegPath: %wZ\n",
901 &VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
)->RegistryPath
);
902 ASSERT_IRQL_LESS_OR_EQUAL(PASSIVE_LEVEL
);
903 Status
= RtlWriteRegistryValue(
904 RTL_REGISTRY_ABSOLUTE
,
905 VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
)->RegistryPath
.Buffer
,
911 if (Status
!= NO_ERROR
)
912 WARN_(VIDEOPRT
, "VideoPortSetRegistryParameters error 0x%x\n", Status
);
922 VideoPortGetVgaStatus(
923 IN PVOID HwDeviceExtension
,
924 OUT PULONG VgaStatus
)
926 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
928 TRACE_(VIDEOPRT
, "VideoPortGetVgaStatus\n");
930 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
931 if (KeGetCurrentIrql() == PASSIVE_LEVEL
)
933 if (DeviceExtension
->AdapterInterfaceType
== PCIBus
)
935 /* VgaStatus: 0 == VGA not enabled, 1 == VGA enabled. */
936 /* Assumed for now */
942 return ERROR_INVALID_FUNCTION
;
950 VideoPortGetRomImage(
951 IN PVOID HwDeviceExtension
,
956 static PVOID RomImageBuffer
= NULL
;
957 PKPROCESS CallingProcess
;
960 TRACE_(VIDEOPRT
, "VideoPortGetRomImage(HwDeviceExtension 0x%X Length 0x%X)\n",
961 HwDeviceExtension
, Length
);
963 /* If the length is zero then free the existing buffer. */
966 if (RomImageBuffer
!= NULL
)
968 ExFreePool(RomImageBuffer
);
969 RomImageBuffer
= NULL
;
976 * The DDK says we shouldn't use the legacy C0000 method but get the
977 * rom base address from the corresponding pci or acpi register but
978 * lets ignore that and use C0000 anyway. We have already mapped the
979 * bios area into memory so we'll copy from there.
983 Length
= min(Length
, 0x10000);
984 if (RomImageBuffer
!= NULL
)
986 ExFreePool(RomImageBuffer
);
989 RomImageBuffer
= ExAllocatePool(PagedPool
, Length
);
990 if (RomImageBuffer
== NULL
)
995 IntAttachToCSRSS(&CallingProcess
, &ApcState
);
996 RtlCopyMemory(RomImageBuffer
, (PUCHAR
)0xC0000, Length
);
997 IntDetachFromCSRSS(&CallingProcess
, &ApcState
);
999 return RomImageBuffer
;
1009 IN PVOID HwDeviceExtension
,
1016 PUCHAR SearchLocation
;
1018 TRACE_(VIDEOPRT
, "VideoPortScanRom RomBase %p RomLength 0x%x String %s\n", RomBase
, RomLength
, String
);
1020 StringLength
= strlen((PCHAR
)String
);
1022 SearchLocation
= RomBase
;
1023 for (SearchLocation
= RomBase
;
1024 !Found
&& SearchLocation
< RomBase
+ RomLength
- StringLength
;
1027 Found
= (RtlCompareMemory(SearchLocation
, String
, StringLength
) == StringLength
);
1030 INFO_(VIDEOPRT
, "Match found at %p\n", SearchLocation
);
1042 VideoPortSynchronizeExecution(
1043 IN PVOID HwDeviceExtension
,
1044 IN VIDEO_SYNCHRONIZE_PRIORITY Priority
,
1045 IN PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine
,
1049 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
1055 Ret
= (*SynchronizeRoutine
)(Context
);
1058 case VpMediumPriority
:
1059 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
1060 if (DeviceExtension
->InterruptObject
== NULL
)
1061 Ret
= (*SynchronizeRoutine
)(Context
);
1063 Ret
= KeSynchronizeExecution(
1064 DeviceExtension
->InterruptObject
,
1069 case VpHighPriority
:
1070 OldIrql
= KeGetCurrentIrql();
1071 if (OldIrql
< SYNCH_LEVEL
)
1072 KeRaiseIrql(SYNCH_LEVEL
, &OldIrql
);
1074 Ret
= (*SynchronizeRoutine
)(Context
);
1076 if (OldIrql
< SYNCH_LEVEL
)
1077 KeLowerIrql(OldIrql
);
1092 VideoPortEnumerateChildren(
1093 IN PVOID HwDeviceExtension
,
1096 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
1098 VIDEO_CHILD_ENUM_INFO ChildEnumInfo
;
1099 VIDEO_CHILD_TYPE ChildType
;
1100 BOOLEAN bHaveLastMonitorID
= FALSE
;
1101 UCHAR LastMonitorID
[10];
1102 UCHAR ChildDescriptor
[256];
1107 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
1108 if (DeviceExtension
->DriverExtension
->InitializationData
.HwGetVideoChildDescriptor
== NULL
)
1110 WARN_(VIDEOPRT
, "Miniport's HwGetVideoChildDescriptor is NULL!\n");
1114 /* Setup the ChildEnumInfo */
1115 ChildEnumInfo
.Size
= sizeof (ChildEnumInfo
);
1116 ChildEnumInfo
.ChildDescriptorSize
= sizeof (ChildDescriptor
);
1117 ChildEnumInfo
.ACPIHwId
= 0;
1118 ChildEnumInfo
.ChildHwDeviceExtension
= NULL
; /* FIXME: must be set to
1119 ChildHwDeviceExtension... */
1121 /* Enumerate the children */
1124 ChildEnumInfo
.ChildIndex
= i
;
1125 RtlZeroMemory(ChildDescriptor
, sizeof(ChildDescriptor
));
1126 Status
= DeviceExtension
->DriverExtension
->InitializationData
.HwGetVideoChildDescriptor(
1133 if (Status
== VIDEO_ENUM_MORE_DEVICES
)
1135 if (ChildType
== Monitor
)
1137 // Check if the EDID is valid
1138 if (ChildDescriptor
[0] == 0x00 &&
1139 ChildDescriptor
[1] == 0xFF &&
1140 ChildDescriptor
[2] == 0xFF &&
1141 ChildDescriptor
[3] == 0xFF &&
1142 ChildDescriptor
[4] == 0xFF &&
1143 ChildDescriptor
[5] == 0xFF &&
1144 ChildDescriptor
[6] == 0xFF &&
1145 ChildDescriptor
[7] == 0x00)
1147 if (bHaveLastMonitorID
)
1149 // Compare the previous monitor ID with the current one, break the loop if they are identical
1150 if (RtlCompareMemory(LastMonitorID
, &ChildDescriptor
[8], sizeof(LastMonitorID
)) == sizeof(LastMonitorID
))
1152 INFO_(VIDEOPRT
, "Found identical Monitor ID two times, stopping enumeration\n");
1157 // Copy 10 bytes from the EDID, which can be used to uniquely identify the monitor
1158 RtlCopyMemory(LastMonitorID
, &ChildDescriptor
[8], sizeof(LastMonitorID
));
1159 bHaveLastMonitorID
= TRUE
;
1163 else if (Status
== VIDEO_ENUM_INVALID_DEVICE
)
1165 WARN_(VIDEOPRT
, "Child device %d is invalid!\n", ChildEnumInfo
.ChildIndex
);
1168 else if (Status
== VIDEO_ENUM_NO_MORE_DEVICES
)
1170 INFO_(VIDEOPRT
, "End of child enumeration! (%d children enumerated)\n", i
- 1);
1175 WARN_(VIDEOPRT
, "HwGetVideoChildDescriptor returned unknown status code 0x%x!\n", Status
);
1180 if (ChildType
== Monitor
)
1183 PUCHAR p
= ChildDescriptor
;
1184 INFO_(VIDEOPRT
, "Monitor device enumerated! (ChildId = 0x%x)\n", ChildId
);
1185 for (j
= 0; j
< sizeof (ChildDescriptor
); j
+= 8)
1187 INFO_(VIDEOPRT
, "%02x %02x %02x %02x %02x %02x %02x %02x\n",
1188 p
[j
+0], p
[j
+1], p
[j
+2], p
[j
+3],
1189 p
[j
+4], p
[j
+5], p
[j
+6], p
[j
+7]);
1192 else if (ChildType
== Other
)
1194 INFO_(VIDEOPRT
, "\"Other\" device enumerated: DeviceId = %S\n", (PWSTR
)ChildDescriptor
);
1198 WARN_(VIDEOPRT
, "HwGetVideoChildDescriptor returned unsupported type: %d\n", ChildType
);
1212 VideoPortCreateSecondaryDisplay(
1213 IN PVOID HwDeviceExtension
,
1214 IN OUT PVOID
*SecondaryDeviceExtension
,
1218 return ERROR_DEV_NOT_EXIST
;
1227 IN PVOID HwDeviceExtension
,
1228 IN PMINIPORT_DPC_ROUTINE CallbackRoutine
,
1231 return KeInsertQueueDpc(
1232 &VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
)->DpcObject
,
1233 (PVOID
)CallbackRoutine
,
1242 VideoPortGetAssociatedDeviceExtension(IN PVOID DeviceObject
)
1244 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
1246 TRACE_(VIDEOPRT
, "VideoPortGetAssociatedDeviceExtension\n");
1247 DeviceExtension
= ((PDEVICE_OBJECT
)DeviceObject
)->DeviceExtension
;
1248 if (!DeviceExtension
)
1250 return DeviceExtension
->MiniPortDeviceExtension
;
1258 VideoPortGetVersion(
1259 IN PVOID HwDeviceExtension
,
1260 IN OUT PVPOSVERSIONINFO VpOsVersionInfo
)
1262 RTL_OSVERSIONINFOEXW Version
;
1264 Version
.dwOSVersionInfoSize
= sizeof(RTL_OSVERSIONINFOEXW
);
1265 if (VpOsVersionInfo
->Size
>= sizeof(VPOSVERSIONINFO
))
1268 if (NT_SUCCESS(RtlGetVersion((PRTL_OSVERSIONINFOW
)&Version
)))
1270 VpOsVersionInfo
->MajorVersion
= Version
.dwMajorVersion
;
1271 VpOsVersionInfo
->MinorVersion
= Version
.dwMinorVersion
;
1272 VpOsVersionInfo
->BuildNumber
= Version
.dwBuildNumber
;
1273 VpOsVersionInfo
->ServicePackMajor
= Version
.wServicePackMajor
;
1274 VpOsVersionInfo
->ServicePackMinor
= Version
.wServicePackMinor
;
1277 return ERROR_INVALID_PARAMETER
;
1279 VpOsVersionInfo
->MajorVersion
= 5;
1280 VpOsVersionInfo
->MinorVersion
= 0;
1281 VpOsVersionInfo
->BuildNumber
= 2195;
1282 VpOsVersionInfo
->ServicePackMajor
= 4;
1283 VpOsVersionInfo
->ServicePackMinor
= 0;
1288 return ERROR_INVALID_PARAMETER
;
1296 VideoPortCheckForDeviceExistence(
1297 IN PVOID HwDeviceExtension
,
1300 IN UCHAR RevisionId
,
1301 IN USHORT SubVendorId
,
1302 IN USHORT SubSystemId
,
1305 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
1306 PCI_DEVICE_PRESENT_INTERFACE PciDevicePresentInterface
;
1307 IO_STATUS_BLOCK IoStatusBlock
;
1308 IO_STACK_LOCATION IoStack
;
1313 TRACE_(VIDEOPRT
, "VideoPortCheckForDeviceExistence\n");
1315 if (Flags
& ~(CDE_USE_REVISION
| CDE_USE_SUBSYSTEM_IDS
))
1317 WARN_(VIDEOPRT
, "VideoPortCheckForDeviceExistence: Unknown flags 0x%lx\n", Flags
& ~(CDE_USE_REVISION
| CDE_USE_SUBSYSTEM_IDS
));
1321 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
1323 PciDevicePresentInterface
.Size
= sizeof(PCI_DEVICE_PRESENT_INTERFACE
);
1324 PciDevicePresentInterface
.Version
= 1;
1325 IoStack
.Parameters
.QueryInterface
.Size
= PciDevicePresentInterface
.Size
;
1326 IoStack
.Parameters
.QueryInterface
.Version
= PciDevicePresentInterface
.Version
;
1327 IoStack
.Parameters
.QueryInterface
.Interface
= (PINTERFACE
)&PciDevicePresentInterface
;
1328 IoStack
.Parameters
.QueryInterface
.InterfaceType
=
1329 &GUID_PCI_DEVICE_PRESENT_INTERFACE
;
1330 Status
= IopInitiatePnpIrp(DeviceExtension
->NextDeviceObject
,
1331 &IoStatusBlock
, IRP_MN_QUERY_INTERFACE
, &IoStack
);
1332 if (!NT_SUCCESS(Status
))
1334 WARN_(VIDEOPRT
, "IopInitiatePnpIrp() failed! (Status 0x%lx)\n", Status
);
1338 if (Flags
& CDE_USE_REVISION
)
1339 PciFlags
|= PCI_USE_REVISION
;
1340 if (Flags
& CDE_USE_SUBSYSTEM_IDS
)
1341 PciFlags
|= PCI_USE_SUBSYSTEM_IDS
;
1343 DevicePresent
= PciDevicePresentInterface
.IsDevicePresent(
1344 VendorId
, DeviceId
, RevisionId
,
1345 SubVendorId
, SubSystemId
, PciFlags
);
1347 PciDevicePresentInterface
.InterfaceDereference(PciDevicePresentInterface
.Context
);
1349 return DevicePresent
;
1357 VideoPortRegisterBugcheckCallback(
1358 IN PVOID HwDeviceExtension
,
1359 IN ULONG BugcheckCode
,
1361 IN ULONG BugcheckDataSize
)
1372 VideoPortQueryPerformanceCounter(
1373 IN PVOID HwDeviceExtension
,
1374 OUT PLONGLONG PerformanceFrequency OPTIONAL
)
1376 LARGE_INTEGER Result
;
1378 TRACE_(VIDEOPRT
, "VideoPortQueryPerformanceCounter\n");
1379 Result
= KeQueryPerformanceCounter((PLARGE_INTEGER
)PerformanceFrequency
);
1380 return Result
.QuadPart
;
1388 VideoPortAcquireDeviceLock(
1389 IN PVOID HwDeviceExtension
)
1391 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
1395 TRACE_(VIDEOPRT
, "VideoPortAcquireDeviceLock\n");
1396 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
1397 Status
= KeWaitForMutexObject(&DeviceExtension
->DeviceLock
, Executive
,
1398 KernelMode
, FALSE
, NULL
);
1399 // ASSERT(Status == STATUS_SUCCESS);
1407 VideoPortReleaseDeviceLock(
1408 IN PVOID HwDeviceExtension
)
1410 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
1414 TRACE_(VIDEOPRT
, "VideoPortReleaseDeviceLock\n");
1415 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
1416 Status
= KeReleaseMutex(&DeviceExtension
->DeviceLock
, FALSE
);
1417 //ASSERT(Status == STATUS_SUCCESS);
1426 IN PDEVICE_OBJECT DeviceObject
,
1436 VideoPortAllocateContiguousMemory(
1437 IN PVOID HwDeviceExtension
,
1438 IN ULONG NumberOfBytes
,
1439 IN PHYSICAL_ADDRESS HighestAcceptableAddress
1443 return MmAllocateContiguousMemory(NumberOfBytes
, HighestAcceptableAddress
);
1450 VideoPortIsNoVesa(VOID
)
1454 UNICODE_STRING Path
= RTL_CONSTANT_STRING(L
"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control");
1455 UNICODE_STRING ValueName
= RTL_CONSTANT_STRING(L
"SystemStartOptions");
1456 OBJECT_ATTRIBUTES ObjectAttributes
;
1457 PKEY_VALUE_PARTIAL_INFORMATION KeyInfo
;
1458 ULONG Length
, NewLength
;
1460 /* Initialize object attributes with the path we want */
1461 InitializeObjectAttributes(&ObjectAttributes
,
1463 OBJ_CASE_INSENSITIVE
| OBJ_KERNEL_HANDLE
,
1468 Status
= ZwOpenKey(&KeyHandle
,
1472 if (!NT_SUCCESS(Status
))
1474 VideoPortDebugPrint(Error
, "ZwOpenKey failed (0x%x)\n", Status
);
1478 /* Find out how large our buffer should be */
1479 Status
= ZwQueryValueKey(KeyHandle
,
1481 KeyValuePartialInformation
,
1485 if (Status
!= STATUS_BUFFER_OVERFLOW
&& Status
!= STATUS_BUFFER_TOO_SMALL
)
1487 VideoPortDebugPrint(Error
, "ZwQueryValueKey failed (0x%x)\n", Status
);
1493 KeyInfo
= ExAllocatePool(PagedPool
, Length
);
1496 VideoPortDebugPrint(Error
, "Out of memory\n");
1501 /* Now for real this time */
1502 Status
= ZwQueryValueKey(KeyHandle
,
1504 KeyValuePartialInformation
,
1511 if (!NT_SUCCESS(Status
))
1513 VideoPortDebugPrint(Error
, "ZwQueryValueKey failed (0x%x)\n", Status
);
1514 ExFreePool(KeyInfo
);
1519 if (KeyInfo
->Type
!= REG_SZ
)
1521 VideoPortDebugPrint(Error
, "Invalid type for SystemStartOptions\n");
1522 ExFreePool(KeyInfo
);
1526 /* Check if NOVESA is present in the start options */
1527 if (wcsstr((PWCHAR
)KeyInfo
->Data
, L
"NOVESA"))
1529 VideoPortDebugPrint(Info
, "VESA mode disabled\n");
1530 ExFreePool(KeyInfo
);
1534 ExFreePool(KeyInfo
);
1536 VideoPortDebugPrint(Info
, "VESA mode enabled\n");