ReactOS 0.4.16-dev-2284-g3529151
videoprt.c
Go to the documentation of this file.
1/*
2 * VideoPort driver
3 *
4 * Copyright (C) 2002-2004, 2007 ReactOS Team
5 *
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.
10 *
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.
15 *
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
19 *
20 */
21
22#include "videoprt.h"
23
24#include <stdio.h>
25#include <ndk/exfuncs.h>
26#include <ndk/obfuncs.h>
27#include <ndk/rtlfuncs.h>
28
29#define NDEBUG
30#include <debug.h>
31
32/* GLOBAL VARIABLES ***********************************************************/
33
35
38
42
49
50/* PRIVATE FUNCTIONS **********************************************************/
51
52static BOOLEAN
54{
55 static const UNICODE_STRING VgaSave = RTL_CONSTANT_STRING(L"\\Driver\\VgaSave");
56 return RtlEqualUnicodeString(&VgaSave, &DriverObject->DriverName, TRUE);
57}
58
64{
65 return STATUS_SUCCESS;
66}
67
68static
71 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
72{
74 WCHAR DeviceBuffer[20];
76 WCHAR SymlinkBuffer[20];
77 UNICODE_STRING SymlinkName;
80
81 /* Create a unicode device name. */
82 DeviceNumber = DeviceExtension->DeviceNumber;
83 swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
84
86 RegistryPath = &DeviceExtension->NewRegistryPath;
87 else
88 RegistryPath = &DeviceExtension->RegistryPath;
89
90 /* Add entry to DEVICEMAP\VIDEO key in registry. */
92 L"VIDEO",
93 DeviceBuffer,
94 REG_SZ,
95 RegistryPath->Buffer,
96 RegistryPath->Length + sizeof(UNICODE_NULL));
97 if (!NT_SUCCESS(Status))
98 {
99 ERR_(VIDEOPRT, "Failed to create DEVICEMAP registry entry: 0x%X\n", Status);
100 return Status;
101 }
102
104 L"VIDEO",
105 L"MaxObjectNumber",
106 REG_DWORD,
108 sizeof(DeviceNumber));
109 if (!NT_SUCCESS(Status))
110 {
111 ERR_(VIDEOPRT, "Failed to write MaxObjectNumber: 0x%X\n", Status);
112 return Status;
113 }
114
115 /* Create symbolic link "\??\DISPLAYx" */
116 swprintf(SymlinkBuffer, L"\\??\\DISPLAY%lu", DeviceNumber + 1);
117 RtlInitUnicodeString(&SymlinkName, SymlinkBuffer);
118 RtlInitUnicodeString(&DeviceName, DeviceBuffer);
119 Status = IoCreateSymbolicLink(&SymlinkName, &DeviceName);
120 if (!NT_SUCCESS(Status))
121 {
122 ERR_(VIDEOPRT, "Failed to create symbolic link: 0x%X\n", Status);
123 return Status;
124 }
125
126 /* Update MaxObjectNumber */
128
129 return STATUS_SUCCESS;
130}
131
132PVOID
133NTAPI
137{
138 PIMAGE_NT_HEADERS NtHeader;
139 ULONG Va;
140
141 NtHeader = RtlImageNtHeader(BaseAddress);
142 if (NtHeader == NULL)
143 return NULL;
144
146 return NULL;
147
149 if (Va == 0)
150 return NULL;
151
152 return (PVOID)((ULONG_PTR)BaseAddress + Va);
153}
154
155VOID
156NTAPI
158 IN PKDPC Dpc,
162{
163 PVOID HwDeviceExtension =
164 &((PVIDEO_PORT_DEVICE_EXTENSION)DeferredContext)->MiniPortDeviceExtension;
166}
167
169NTAPI
174 _In_ USHORT AdapterNumber,
175 _In_ USHORT DisplayNumber,
177{
178 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
180 ULONG PciSlotNumber;
182 ULONG Size;
184 WCHAR DeviceBuffer[20];
186 PDEVICE_OBJECT DeviceObject_;
187
188 if (DeviceObject == NULL)
189 DeviceObject = &DeviceObject_;
190
191 /*
192 * Find the first free device number that can be used for video device
193 * object names and symlinks.
194 */
196 if (DeviceNumber == (ULONG)-1)
197 {
198 WARN_(VIDEOPRT, "Can't find free device number\n");
199 return STATUS_UNSUCCESSFUL;
200 }
201
202 /*
203 * Create the device object.
204 */
205
206 /* Create a unicode device name. */
207 swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
208 RtlInitUnicodeString(&DeviceName, DeviceBuffer);
209
210 INFO_(VIDEOPRT, "HwDeviceExtension size is: 0x%x\n",
211 DriverExtension->InitializationData.HwDeviceExtensionSize);
212
213 /* Create the device object. */
215 DriverExtension->InitializationData.HwDeviceExtensionSize;
217 Size,
218 &DeviceName,
220 0,
221 TRUE,
223
224 if (!NT_SUCCESS(Status))
225 {
226 WARN_(VIDEOPRT, "IoCreateDevice call failed with status 0x%08x\n", Status);
227 return Status;
228 }
229
230 /*
231 * Set the buffering strategy here. If you change this, remember
232 * to change VidDispatchDeviceControl too.
233 */
234
235 (*DeviceObject)->Flags |= DO_BUFFERED_IO;
236
237 /* Initialize device extension. */
238 DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)((*DeviceObject)->DeviceExtension);
239 DeviceExtension->Common.Fdo = TRUE;
240 DeviceExtension->DeviceNumber = DeviceNumber;
241 DeviceExtension->DriverObject = DriverObject;
243 DeviceExtension->FunctionalDeviceObject = *DeviceObject;
244 DeviceExtension->DriverExtension = DriverExtension;
245 DeviceExtension->SessionId = -1;
246 DeviceExtension->AdapterNumber = AdapterNumber;
247 DeviceExtension->DisplayNumber = DisplayNumber;
248
249 InitializeListHead(&DeviceExtension->ChildDeviceList);
250
251 /*
252 * Miniport owns this blob; many miniports assume it's initially zeroed.
253 * Removing this crashes the NVIDIA gpu driver
254 */
255 RtlZeroMemory(DeviceExtension->MiniPortDeviceExtension,
256 DriverExtension->InitializationData.HwDeviceExtensionSize);
257
258 /* Get the registry path associated with this device. */
260 DeviceExtension->AdapterNumber,
261 &DeviceExtension->RegistryPath);
262 if (!NT_SUCCESS(Status))
263 {
264 WARN_(VIDEOPRT, "IntCreateRegistryPath() call failed with status 0x%08x\n", Status);
265 goto Failure;
266 }
267
269 {
270 /* Get bus number from the upper level bus driver. */
271 Size = sizeof(ULONG);
274 Size,
275 &DeviceExtension->SystemIoBusNumber,
276 &Size);
277 if (!NT_SUCCESS(Status))
278 {
279 WARN_(VIDEOPRT, "Couldn't get an information from bus driver. We will try to\n"
280 "use legacy detection method, but even that doesn't mean that\n"
281 "it will work.\n");
282 DeviceExtension->PhysicalDeviceObject = NULL;
283 }
284 }
285
286 DeviceExtension->AdapterInterfaceType =
287 DriverExtension->InitializationData.AdapterInterfaceType;
288
290 {
291 /* Get bus type from the upper level bus driver. */
292 Size = sizeof(ULONG);
295 Size,
296 &DeviceExtension->AdapterInterfaceType,
297 &Size);
298
299 /* Get bus device address from the upper level bus driver. */
300 Size = sizeof(ULONG);
303 Size,
304 &PciSlotNumber,
305 &Size);
306
307 /* Convert slotnumber to PCI_SLOT_NUMBER */
308 SlotNumber.u.AsULONG = 0;
309 SlotNumber.u.bits.DeviceNumber = (PciSlotNumber >> 16) & 0xFFFF;
310 SlotNumber.u.bits.FunctionNumber = PciSlotNumber & 0xFFFF;
311 DeviceExtension->SystemIoSlotNumber = SlotNumber.u.AsULONG;
312 }
313
315 InitializeListHead(&DeviceExtension->DmaAdapterList);
316
317 KeInitializeDpc(&DeviceExtension->DpcObject,
319 DeviceExtension);
320
321 KeInitializeMutex(&DeviceExtension->DeviceLock, 0);
322
323 /* Attach the device. */
324 if ((PhysicalDeviceObject != NULL) && (DisplayNumber == 0))
328
329 Status = IntCreateNewRegistryPath(DeviceExtension);
330 if (!NT_SUCCESS(Status))
331 {
332 ERR_(VIDEOPRT, "IntCreateNewRegistryPath() failed with status 0x%08x\n", Status);
333 goto Failure;
334 }
335
336 IntSetupDeviceSettingsKey(DeviceExtension);
337
338 /* Remove the initializing flag */
339 (*DeviceObject)->Flags &= ~DO_DEVICE_INITIALIZING;
340
341 /* Set up the VIDEO/DEVICEMAP registry keys */
342 Status = IntVideoPortAddDeviceMapLink(DeviceExtension);
343 if (!NT_SUCCESS(Status))
344 {
345 ERR_(VIDEOPRT, "IntVideoPortAddDeviceMapLink() failed with status 0x%08x\n", Status);
346 goto Failure;
347 }
348
349 if (DisplayNumber == 0)
350 {
351 DriverExtension->InitializationData.StartingDeviceNumber++;
352 }
353
354 return STATUS_SUCCESS;
355
356Failure:
357 if (DeviceExtension->NextDeviceObject)
358 IoDetachDevice(DeviceExtension->NextDeviceObject);
361 return Status;
362}
363
369static NTSTATUS
370NTAPI
373 _In_ PUNICODE_STRING PathName,
377 _In_ CONFIGURATION_TYPE ControllerType,
378 _In_ ULONG ControllerNumber,
379 _In_ PKEY_VALUE_FULL_INFORMATION* ControllerInformation,
380 _In_ CONFIGURATION_TYPE PeripheralType,
381 _In_ ULONG PeripheralNumber,
382 _In_ PKEY_VALUE_FULL_INFORMATION* PeripheralInformation)
383{
385 UNREFERENCED_PARAMETER(PathName);
389 UNREFERENCED_PARAMETER(ControllerType);
390 UNREFERENCED_PARAMETER(ControllerNumber);
391 UNREFERENCED_PARAMETER(ControllerInformation);
392 UNREFERENCED_PARAMETER(PeripheralType);
393 UNREFERENCED_PARAMETER(PeripheralNumber);
394 UNREFERENCED_PARAMETER(PeripheralInformation);
395
396 /* The bus has been found */
397 return STATUS_SUCCESS;
398}
399
404static NTSTATUS
406 _In_ INTERFACE_TYPE AdapterInterfaceType,
408{
409 // TODO: Forward-compatibility with Windows 7+:
410 // In case AdapterInterfaceType == PCIBus, check for the
411 // \Registry\HARDWARE\DESCRIPTION\System\VideoAdapterBusses
412 // key (created by pci.sys) that enumerates the PCI buses that
413 // are known to have video display adapters on them.
414 // This is a handy shortcut for videoprt, that would otherwise
415 // have to enumerate all the PCI buses (PCI_MAX_BRIDGE_NUMBER)
416 // to locate any video adapter.
417 // Otherwise, fall back to the usual method done below.
418
419 /* Find the next bus of the given type */
420 return IoQueryDeviceDescription(&AdapterInterfaceType,
421 BusNumber,
422 NULL,
423 NULL,
424 NULL,
425 NULL,
427 NULL);
428}
429
431NTAPI
436{
437 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
439 VP_STATUS vpStatus;
440 VIDEO_PORT_CONFIG_INFO ConfigInfo;
442 UCHAR Again = FALSE;
443 BOOL LegacyDetection = FALSE;
444 BOOLEAN VgaResourcesReleased = FALSE;
445
446 DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
448 DeviceExtension->IsVgaDetect = DeviceExtension->IsVgaDriver;
449 DeviceExtension->IsLegacyDetect = FALSE;
450 DeviceExtension->ReportDevice = FALSE;
451
452 /* Setup a ConfigInfo structure that we will pass to HwFindAdapter. */
453 RtlZeroMemory(&ConfigInfo, sizeof(VIDEO_PORT_CONFIG_INFO));
454 ConfigInfo.Length = sizeof(VIDEO_PORT_CONFIG_INFO);
455 ConfigInfo.AdapterInterfaceType = DeviceExtension->AdapterInterfaceType;
456 if (ConfigInfo.AdapterInterfaceType == PCIBus)
457 ConfigInfo.InterruptMode = LevelSensitive;
458 else
459 ConfigInfo.InterruptMode = Latched;
460 ConfigInfo.DriverRegistryPath = DriverExtension->RegistryPath.Buffer;
462 ConfigInfo.SystemIoBusNumber = DeviceExtension->SystemIoBusNumber;
463 ConfigInfo.BusInterruptLevel = DeviceExtension->InterruptLevel;
464 ConfigInfo.BusInterruptVector = DeviceExtension->InterruptVector;
465
468 sizeof(SystemBasicInfo),
469 NULL);
470 if (NT_SUCCESS(Status))
471 {
474 }
475
476 // FIXME: Check the adapter key and update VideoDebugLevel variable.
477
478 /*
479 * Call miniport HwVidFindAdapter entry point to detect if
480 * particular device is present. There are two possible code
481 * paths. The first one is for Legacy drivers (NT4) and cases
482 * when we don't have information about what bus we're on. The
483 * second case is the standard one for Plug & Play drivers.
484 */
485 if (DeviceExtension->PhysicalDeviceObject == NULL)
486 {
487 LegacyDetection = TRUE;
488 DeviceExtension->IsLegacyDevice = TRUE;
489 DeviceExtension->IsLegacyDetect = TRUE;
490 }
491 else
492 {
493 DeviceExtension->IsLegacyDevice = FALSE;
494 }
495
496 /* If we already have a VGA miniport and are about to probe for additional adapters,
497 * release its resources temporarily so conflicts are visible during detection.
498 * We'll reclaim them later if no new adapter successfully claims them. */
501 {
502 INFO_(VIDEOPRT, "Temporarily releasing VGA resources for adapter probing\n");
504 VgaResourcesReleased = TRUE;
505 }
507
508 if (LegacyDetection)
509 {
511
512 /* Suppose first we may not find any suitable device */
513 vpStatus = ERROR_DEV_NOT_EXIST; // ERROR_NO_MORE_DEVICES;
514
515 /* Enumerate all buses of the given type, call HwFindAdapter for each
516 * to find whether a video adapter is recognized there. Stop when an
517 * adapter has been found. */
518 for (BusNumber = 0;
519 (BusNumber < MAXULONG) &&
521 &BusNumber));
522 ++BusNumber)
523 {
524 DPRINT("Bus Type %lu, Number %lu\n",
525 DeviceExtension->AdapterInterfaceType, BusNumber);
526
527 DeviceExtension->SystemIoBusNumber =
528 ConfigInfo.SystemIoBusNumber = BusNumber;
529
530 RtlZeroMemory(&DeviceExtension->MiniPortDeviceExtension,
531 DriverExtension->InitializationData.HwDeviceExtensionSize);
532
533 /* FIXME: Need to figure out what string to pass as param 3. */
534 // FIXME: Handle the 'Again' parameter for legacy detection.
535 vpStatus = DriverExtension->InitializationData.HwFindAdapter(
536 &DeviceExtension->MiniPortDeviceExtension,
537 DriverExtension->HwContext,
538 NULL,
539 &ConfigInfo,
540 &Again);
541
542 if (vpStatus == ERROR_DEV_NOT_EXIST)
543 {
544 continue;
545 }
546 else
547 {
548 break;
549 }
550 }
551 }
552 else
553 {
554 /* FIXME: Need to figure out what string to pass as param 3. */
555 vpStatus = DriverExtension->InitializationData.HwFindAdapter(
556 &DeviceExtension->MiniPortDeviceExtension,
557 DriverExtension->HwContext,
558 NULL,
559 &ConfigInfo,
560 &Again);
561 }
562
563 if (vpStatus != NO_ERROR)
564 {
565 ERR_(VIDEOPRT, "HwFindAdapter failed (vpStatus=0x%X) bus=%u iface=%u legacy=%u vga=%u detect(VGA=%u LEGACY=%u)\n",
566 vpStatus,
567 DeviceExtension->SystemIoBusNumber,
568 DeviceExtension->AdapterInterfaceType,
569 DeviceExtension->IsLegacyDevice,
570 DeviceExtension->IsVgaDriver,
571 DeviceExtension->IsVgaDetect,
572 DeviceExtension->IsLegacyDetect);
573 /* If we released VGA resources, reclaim them so VGA fallback still works */
574 if (VgaResourcesReleased)
575 {
577 {
578 INFO_(VIDEOPRT, "Reclaiming VGA resources after failed probe\n");
582 {
583 WARN_(VIDEOPRT, "Failed to reclaim VGA resources after probe failure\n");
584 }
585 }
586 }
588 goto Failure;
589 }
590
591 /*
592 * Now we know the device is present, so let's do all additional tasks
593 * such as creating symlinks or setting up interrupts and timer.
594 */
595
596 /* FIXME: Allocate hardware resources for device. */
597
598 /* Allocate interrupt for device. */
600 {
602 goto Failure;
603 }
604
605 /* Allocate timer for device. */
607 {
608 if (DeviceExtension->InterruptObject != NULL)
609 IoDisconnectInterrupt(DeviceExtension->InterruptObject);
610 ERR_(VIDEOPRT, "IntVideoPortSetupTimer failed\n");
612 goto Failure;
613 }
614
615 /* If the device can be reset, insert it in the list of resettable adapters */
616 InitializeListHead(&DeviceExtension->HwResetListEntry);
617 if (DriverExtension->InitializationData.HwResetHw != NULL)
618 {
620 &DeviceExtension->HwResetListEntry,
622 }
623
624 if (DeviceExtension->IsVgaDriver)
625 {
628 {
629 VgaDeviceExtension = DeviceExtension;
630 }
632 }
633
634 DeviceExtension->IsVgaDetect = FALSE;
635 DeviceExtension->IsLegacyDetect = FALSE;
636
637 /* For legacy (non-PnP) adapters we should report a detected device so that
638 * a PDO exists for higher layers to enumerate consistently (mirrors ScsiPort).*/
639 if (DeviceExtension->IsLegacyDevice && !DeviceExtension->ReportDevice)
640 {
641 PDEVICE_OBJECT ReportedPdo = NULL;
643 DeviceExtension->AdapterInterfaceType,
644 DeviceExtension->SystemIoBusNumber,
645 DeviceExtension->SystemIoSlotNumber,
646 NULL,
647 NULL,
648 FALSE,
649 &ReportedPdo);
650 if (!NT_SUCCESS(repStatus))
651 {
652 WARN_(VIDEOPRT, "IoReportDetectedDevice failed 0x%08lx (bus=%u slot=%u)\n",
653 repStatus,
654 DeviceExtension->SystemIoBusNumber,
655 DeviceExtension->SystemIoSlotNumber);
656 }
657 else
658 {
659 INFO_(VIDEOPRT, "Reported legacy adapter PDO %p (bus=%u slot=%u)\n",
660 ReportedPdo,
661 DeviceExtension->SystemIoBusNumber,
662 DeviceExtension->SystemIoSlotNumber);
663 DeviceExtension->ReportDevice = TRUE;
664 }
665 }
666
667 /* Attempt to reclaim VGA resources after probing if a VGA device exists */
669 {
670 VP_STATUS vr;
671 INFO_(VIDEOPRT, "Attempt VGA reclaim after probe (ranges=%lu)\n", NumOfVgaRanges);
674 VgaRanges);
675 if (vr != NO_ERROR)
676 {
677 /* Another driver has taken VGA resources; drop fallback state */
678 WARN_(VIDEOPRT, "VGA reclaim failed (vpStatus=0x%X); releasing fallback state\n", vr);
681 VgaRanges = NULL;
682 NumOfVgaRanges = 0;
685
686 }
687 else
688 {
689 INFO_(VIDEOPRT, "VGA reclaim succeeded\n");
690 }
691 }
692
693 INFO_(VIDEOPRT, "STATUS_SUCCESS\n");
694 return STATUS_SUCCESS;
695
696Failure:
697 RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
698 if (DeviceExtension->NextDeviceObject)
699 IoDetachDevice(DeviceExtension->NextDeviceObject);
700
701 /* Explicitly reclaim VGA resources on complete failure */
702 if (VgaResourcesReleased)
703 {
705 {
706 INFO_(VIDEOPRT, "Final reclaim attempt of VGA resources during failure cleanup\n");
710 {
711 WARN_(VIDEOPRT, "VGA reclaim failed during failure cleanup\n");
712 }
713 }
714 }
716 return Status;
717}
718
736 _Outptr_ PKPROCESS* CallingProcess,
738{
739 if (!CsrProcess)
740 return FALSE;
741
742 *CallingProcess = (PKPROCESS)PsGetCurrentProcess();
743 if (*CallingProcess != CsrProcess)
745 return TRUE;
746}
747
760VOID
763 _In_ PKPROCESS CallingProcess,
765{
767 if (CallingProcess != CsrProcess)
769}
770
771VOID
774{
777 UNICODE_STRING KeyPath;
778 UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"SystemStartOptions");
782
783 /* Check if we need to use new registry */
784 RtlInitUnicodeString(&KeyPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\GraphicsDrivers\\UseNewKey");
786 &KeyPath,
788 NULL,
789 NULL);
790 Status = ZwOpenKey(&KeyHandle,
793 if (NT_SUCCESS(Status))
794 {
797 }
798
799#ifdef _M_IX86
800 /* Check whether we need to use the 32-bit x86 emulator instead of V86 mode */
801 RtlInitUnicodeString(&KeyPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\GraphicsDrivers\\DisableEmulator");
803 &KeyPath,
805 NULL,
806 NULL);
807 Status = ZwOpenKey(&KeyHandle,
810 if (NT_SUCCESS(Status))
811 {
812 VideoPortDisableX86Emulator = TRUE;
814 }
815 DPRINT1("Using %s\n", VideoPortDisableX86Emulator ? "V86 mode" : "x86 emulator");
816#endif // _M_IX86
817
818 /* Initialize object attributes with the path we want */
819 RtlInitUnicodeString(&KeyPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control");
821 &KeyPath,
823 NULL,
824 NULL);
825
826 /* Open the key */
827 Status = ZwOpenKey(&KeyHandle,
830 if (!NT_SUCCESS(Status))
831 {
832 VideoPortDebugPrint(Error, "ZwOpenKey failed (0x%x)\n", Status);
833 return;
834 }
835
836 /* Find out how large our buffer should be */
837 Status = ZwQueryValueKey(KeyHandle,
838 &ValueName,
840 NULL,
841 0,
842 &Length);
844 {
845 VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status);
847 return;
848 }
849
850 /* Allocate it */
852 if (!KeyInfo)
853 {
854 VideoPortDebugPrint(Error, "Out of memory\n");
856 return;
857 }
858
859 /* Now for real this time */
860 Status = ZwQueryValueKey(KeyHandle,
861 &ValueName,
863 KeyInfo,
864 Length,
865 &NewLength);
867
868 if (!NT_SUCCESS(Status))
869 {
870 VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status);
872 return;
873 }
874
875 /* Sanity check */
876 if (KeyInfo->Type != REG_SZ)
877 {
878 VideoPortDebugPrint(Error, "Invalid type for SystemStartOptions\n");
880 return;
881 }
882
883 /* Check if BASEVIDEO or NOVESA is present in the start options */
884 if (wcsstr((PWCHAR)KeyInfo->Data, L"BASEVIDEO"))
886 if (wcsstr((PWCHAR)KeyInfo->Data, L"NOVESA"))
887 VpNoVesa = TRUE;
888
890
891 /* FIXME: Old ReactOS-compatibility... */
893
894 if (VpNoVesa)
895 VideoPortDebugPrint(Info, "VESA mode disabled\n");
896 else
897 VideoPortDebugPrint(Info, "VESA mode enabled\n");
898
899 /* If we are in BASEVIDEO, create the volatile registry key for Win32k */
900 if (VpBaseVideo)
901 {
902 RtlInitUnicodeString(&KeyPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\GraphicsDrivers\\BaseVideo");
904 &KeyPath,
906 NULL,
907 NULL);
908
909 Status = ZwCreateKey(&KeyHandle,
910 READ_CONTROL, // Non-0 placeholder: no use for this handle.
912 0,
913 NULL,
915 NULL);
916 if (NT_SUCCESS(Status))
918 else
919 ERR_(VIDEOPRT, "Failed to create the BaseVideo key (0x%x)\n", Status);
920 }
921
922 return;
923}
924
925/* PUBLIC FUNCTIONS ***********************************************************/
926
927/*
928 * @implemented
929 */
930ULONG
931NTAPI
937{
942 BOOLEAN PnpDriver = FALSE, LegacyDetection = FALSE;
943 static BOOLEAN FirstInitialization;
944
945 TRACE_(VIDEOPRT, "VideoPortInitialize\n");
946
947 if (!FirstInitialization)
948 {
949 FirstInitialization = TRUE;
954 }
955
956 /* As a first thing do parameter checks. */
957 if (HwInitializationData->HwInitDataSize > sizeof(VIDEO_HW_INITIALIZATION_DATA))
958 {
959 ERR_(VIDEOPRT, "Invalid HwInitializationData\n");
961 }
962
963 if ((HwInitializationData->HwFindAdapter == NULL) ||
964 (HwInitializationData->HwInitialize == NULL) ||
965 (HwInitializationData->HwStartIO == NULL))
966 {
967 ERR_(VIDEOPRT, "Invalid HwInitializationData\n");
969 }
970
971 switch (HwInitializationData->HwInitDataSize)
972 {
973 /*
974 * NT4 drivers are special case, because we must use legacy method
975 * of detection instead of the Plug & Play one.
976 */
978 INFO_(VIDEOPRT, "We were loaded by a Windows NT miniport driver.\n");
979 break;
980
982 INFO_(VIDEOPRT, "We were loaded by a Windows 2000 miniport driver.\n");
983 break;
984
985 case sizeof(VIDEO_HW_INITIALIZATION_DATA):
986 INFO_(VIDEOPRT, "We were loaded by a Windows XP or later miniport driver.\n");
987 break;
988
989 default:
990 ERR_(VIDEOPRT, "Invalid HwInitializationData size %lu (expected %lu, %lu or %lu)\n",
991 HwInitializationData->HwInitDataSize,
995 return STATUS_UNSUCCESSFUL;
996 }
997
998 /* Set dispatching routines */
1001 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
1003 DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] =
1005 DriverObject->DriverUnload = IntVideoPortUnload;
1006
1007 /* Determine type of the miniport driver */
1008 if ((HwInitializationData->HwInitDataSize >=
1009 FIELD_OFFSET(VIDEO_HW_INITIALIZATION_DATA, HwQueryInterface)) &&
1010 (HwInitializationData->HwSetPowerState != NULL) &&
1011 (HwInitializationData->HwGetPowerState != NULL) &&
1012 (HwInitializationData->HwGetVideoChildDescriptor != NULL))
1013 {
1014 INFO_(VIDEOPRT, "The miniport is a PnP miniport driver\n");
1015 PnpDriver = TRUE;
1016 }
1017
1018 /* Check if legacy detection should be applied */
1019 if (!PnpDriver || HwContext)
1020 {
1021 INFO_(VIDEOPRT, "Legacy detection for adapter interface %d\n",
1022 HwInitializationData->AdapterInterfaceType);
1023
1024 /* FIXME: Move the code for legacy detection
1025 to another function and call it here */
1026 LegacyDetection = TRUE;
1027 }
1028
1029 /*
1030 * NOTE:
1031 * The driver extension can be already allocated in case that we were
1032 * called by legacy driver and failed detecting device. Some miniport
1033 * drivers in that case adjust parameters and call VideoPortInitialize
1034 * again.
1035 */
1037 if (DriverExtension == NULL)
1038 {
1043 if (!NT_SUCCESS(Status))
1044 {
1045 ERR_(VIDEOPRT, "IoAllocateDriverObjectExtension failed 0x%x\n", Status);
1046 return Status;
1047 }
1048
1049 /*
1050 * Save the registry path. This should be done only once even if
1051 * VideoPortInitialize is called multiple times.
1052 */
1053 if (RegistryPath->Length != 0)
1054 {
1055 DriverExtension->RegistryPath.Length = 0;
1056 DriverExtension->RegistryPath.MaximumLength =
1057 RegistryPath->Length + sizeof(UNICODE_NULL);
1058 DriverExtension->RegistryPath.Buffer =
1060 PagedPool,
1061 DriverExtension->RegistryPath.MaximumLength,
1062 'RTSU');
1063 if (DriverExtension->RegistryPath.Buffer == NULL)
1064 {
1065 RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL);
1067 }
1068
1070
1071 /* There is a bug in Spice guest agent, which searches 'System' case-sensitively.
1072 * Replace 'SYSTEM' by 'System' to fix that.
1073 * Probably for similar reason, Windows also replaces 'MACHINE' by 'Machine'.
1074 */
1075 wcsncpy(wcsstr(DriverExtension->RegistryPath.Buffer, L"\\SYSTEM\\"), L"\\System\\", ARRAYSIZE(L"\\SYSTEM\\") - 1);
1076 wcsncpy(wcsstr(DriverExtension->RegistryPath.Buffer, L"\\MACHINE\\"), L"\\Machine\\", ARRAYSIZE(L"\\MACHINE\\") - 1);
1077
1078 INFO_(VIDEOPRT, "RegistryPath: %wZ\n", &DriverExtension->RegistryPath);
1079 }
1080 else
1081 {
1082 RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL);
1083 }
1084 }
1085
1086 /* Copy the correct miniport initialization data to the device extension. */
1087 RtlCopyMemory(&DriverExtension->InitializationData,
1089 HwInitializationData->HwInitDataSize);
1090 if (HwInitializationData->HwInitDataSize <
1092 {
1093 RtlZeroMemory((PVOID)((ULONG_PTR)&DriverExtension->InitializationData +
1094 HwInitializationData->HwInitDataSize),
1096 HwInitializationData->HwInitDataSize);
1097 }
1098 DriverExtension->HwContext = HwContext;
1099
1100 /*
1101 * Plug & Play drivers registers the device in AddDevice routine.
1102 * For legacy drivers we must do it now.
1103 */
1104 if (LegacyDetection)
1105 {
1107
1109 {
1110 /* Power management */
1112 }
1113
1116 NULL,
1117 DriverExtension->InitializationData.StartingDeviceNumber,
1118 0,
1119 &DeviceObject);
1120 if (!NT_SUCCESS(Status))
1121 {
1122 ERR_(VIDEOPRT, "IntVideoPortCreateAdapterDeviceObject returned 0x%x\n", Status);
1123 return Status;
1124 }
1125
1127 if (!NT_SUCCESS(Status))
1128 ERR_(VIDEOPRT, "IntVideoPortFindAdapter returned 0x%x\n", Status);
1129
1130 return Status;
1131 }
1132 else
1133 {
1134 DriverObject->DriverExtension->AddDevice = IntVideoPortAddDevice;
1138
1139 return STATUS_SUCCESS;
1140 }
1141}
1142
1143/*
1144 * @implemented
1145 */
1146VOID
1148 IN VIDEO_DEBUG_LEVEL DebugPrintLevel,
1149 IN PCHAR DebugMessage,
1150 ...)
1151{
1152 va_list ap;
1153
1154 if (VideoDebugLevel >= DebugPrintLevel)
1155 DebugPrintLevel = Error;
1156
1157 va_start(ap, DebugMessage);
1158 vDbgPrintEx(DPFLTR_IHVVIDEO_ID, DebugPrintLevel, DebugMessage, ap);
1159 va_end(ap);
1160}
1161
1162/*
1163 * @unimplemented
1164 */
1165VOID
1166NTAPI
1168 IN PVOID HwDeviceExtension,
1171 IN ULONG UniqueId)
1172{
1174
1175 INFO_(VIDEOPRT, "VideoPortLogError ErrorCode %d (0x%x) UniqueId %lu (0x%lx)\n",
1176 ErrorCode, ErrorCode, UniqueId, UniqueId);
1177 if (Vrp)
1178 INFO_(VIDEOPRT, "Vrp->IoControlCode %lu (0x%lx)\n", Vrp->IoControlCode, Vrp->IoControlCode);
1179}
1180
1181/*
1182 * @implemented
1183 */
1184UCHAR
1185NTAPI
1187{
1188 return KeGetCurrentIrql();
1189}
1190
1192{
1197
1198static
1200NTAPI
1208{
1210
1211 INFO_(VIDEOPRT, "Found registry value for name %S: type %d, length %d\n",
1213 return (*(CallbackContext->HwGetRegistryRoutine))(
1214 CallbackContext->HwDeviceExtension,
1215 CallbackContext->HwContext,
1216 ValueName,
1217 ValueData,
1218 ValueLength);
1219}
1220
1221/*
1222 * @unimplemented
1223 */
1224
1226NTAPI
1228 IN PVOID HwDeviceExtension,
1230 IN UCHAR IsParameterFileName,
1231 IN PMINIPORT_GET_REGISTRY_ROUTINE GetRegistryRoutine,
1233{
1236 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1238
1239 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1240
1241 TRACE_(VIDEOPRT, "VideoPortGetRegistryParameters ParameterName %S, RegPath: %wZ\n",
1242 ParameterName, &DeviceExtension->RegistryPath);
1243
1244 Context.HwDeviceExtension = HwDeviceExtension;
1245 Context.HwContext = HwContext;
1246 Context.HwGetRegistryRoutine = GetRegistryRoutine;
1247
1251
1253 DeviceExtension->RegistryPath.Buffer,
1254 QueryTable,
1255 &Context,
1256 NULL);
1257 if (!NT_SUCCESS(Status))
1258 {
1259 WARN_(VIDEOPRT, "VideoPortGetRegistryParameters could not find the "
1260 "requested parameter\n");
1262 }
1263
1264 if (IsParameterFileName)
1265 {
1266 /* FIXME: need to read the contents of the file */
1268 }
1269
1270 return NO_ERROR;
1271}
1272
1273/*
1274 * @implemented
1275 */
1277NTAPI
1279 IN PVOID HwDeviceExtension,
1283{
1284 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1286
1287 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1288 TRACE_(VIDEOPRT, "VideoPortSetRegistryParameters ParameterName %S, RegPath: %wZ\n",
1289 ValueName,
1290 &DeviceExtension->RegistryPath);
1293 DeviceExtension->RegistryPath.Buffer,
1294 ValueName,
1295 REG_BINARY,
1296 ValueData,
1297 ValueLength);
1298 if (Status != NO_ERROR)
1299 WARN_(VIDEOPRT, "VideoPortSetRegistryParameters error 0x%x\n", Status);
1300
1301 return Status;
1302}
1303
1304/*
1305 * @implemented
1306 */
1308NTAPI
1310 IN PVOID HwDeviceExtension,
1311 OUT PULONG VgaStatus)
1312{
1313 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1314
1315 TRACE_(VIDEOPRT, "VideoPortGetVgaStatus\n");
1316
1317 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1319 {
1320 if (DeviceExtension->AdapterInterfaceType == PCIBus)
1321 {
1322 /* VgaStatus: 0 == VGA not enabled, 1 == VGA enabled. */
1323 /* Assumed for now */
1324 *VgaStatus = 1;
1325 return NO_ERROR;
1326 }
1327 }
1328
1330}
1331
1332/*
1333 * @implemented
1334 */
1335PVOID
1336NTAPI
1338 IN PVOID HwDeviceExtension,
1339 IN PVOID Unused1,
1340 IN ULONG Unused2,
1341 IN ULONG Length)
1342{
1343 static PVOID RomImageBuffer = NULL;
1344 PKPROCESS CallingProcess;
1346
1347 TRACE_(VIDEOPRT, "VideoPortGetRomImage(HwDeviceExtension 0x%X Length 0x%X)\n",
1348 HwDeviceExtension, Length);
1349
1350 /* If the length is zero then free the existing buffer */
1351 if (Length == 0)
1352 {
1353 if (RomImageBuffer != NULL)
1354 {
1355 ExFreePool(RomImageBuffer);
1356 RomImageBuffer = NULL;
1357 }
1358 return NULL;
1359 }
1360 else
1361 {
1362 /*
1363 * The DDK says we shouldn't use the legacy C0000 method but get the
1364 * ROM base address from the corresponding PCI or ACPI register but
1365 * lets ignore that and use C0000 anyway. We have already mapped the
1366 * BIOS area into memory so we'll copy from there.
1367 */
1368
1369 /* Copy the BIOS */
1370 Length = min(Length, 0x10000);
1371 if (RomImageBuffer != NULL)
1372 ExFreePool(RomImageBuffer);
1373
1374 RomImageBuffer = ExAllocatePool(PagedPool, Length);
1375 if (RomImageBuffer == NULL)
1376 return NULL;
1377
1378 /* Perform the copy in the CSRSS context */
1379 if (IntAttachToCSRSS(&CallingProcess, &ApcState))
1380 {
1381 RtlCopyMemory(RomImageBuffer, (PUCHAR)0xC0000, Length);
1382 IntDetachFromCSRSS(CallingProcess, &ApcState);
1383 }
1384 else
1385 {
1386 ExFreePool(RomImageBuffer);
1387 RomImageBuffer = NULL;
1388 }
1389 return RomImageBuffer;
1390 }
1391}
1392
1393/*
1394 * @implemented
1395 */
1396BOOLEAN
1397NTAPI
1399 IN PVOID HwDeviceExtension,
1400 IN PUCHAR RomBase,
1401 IN ULONG RomLength,
1403{
1404 SIZE_T StringLength;
1405 BOOLEAN Found;
1406 PUCHAR SearchLocation;
1407
1408 TRACE_(VIDEOPRT, "VideoPortScanRom RomBase %p RomLength 0x%x String %s\n", RomBase, RomLength, String);
1409
1410 StringLength = strlen((PCHAR)String);
1411 Found = FALSE;
1412 for (SearchLocation = RomBase;
1413 !Found && SearchLocation < RomBase + RomLength - StringLength;
1414 SearchLocation++)
1415 {
1416 Found = (RtlCompareMemory(SearchLocation, String, StringLength) == StringLength);
1417 if (Found)
1418 {
1419 INFO_(VIDEOPRT, "Match found at %p\n", SearchLocation);
1420 }
1421 }
1422
1423 return Found;
1424}
1425
1426/*
1427 * @implemented
1428 */
1429BOOLEAN
1430NTAPI
1432 IN PVOID HwDeviceExtension,
1436{
1437 BOOLEAN Ret;
1438 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1439 KIRQL OldIrql;
1440
1441 switch (Priority)
1442 {
1443 case VpLowPriority:
1444 Ret = (*SynchronizeRoutine)(Context);
1445 break;
1446
1447 case VpMediumPriority:
1448 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1449 if (DeviceExtension->InterruptObject == NULL)
1450 Ret = (*SynchronizeRoutine)(Context);
1451 else
1453 DeviceExtension->InterruptObject,
1455 Context);
1456 break;
1457
1458 case VpHighPriority:
1460 if (OldIrql < SYNCH_LEVEL)
1462
1463 Ret = (*SynchronizeRoutine)(Context);
1464
1465 if (OldIrql < SYNCH_LEVEL)
1467 break;
1468
1469 default:
1470 Ret = FALSE;
1471 }
1472
1473 return Ret;
1474}
1475
1476/*
1477 * @implemented
1478 */
1482 IN PIRP Irp)
1483{
1484 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1485 ULONG Status;
1486 VIDEO_CHILD_ENUM_INFO ChildEnumInfo;
1487 BOOLEAN bHaveLastMonitorID = FALSE;
1488 UCHAR LastMonitorID[10];
1489 ULONG Uid, Unused;
1490 UINT i;
1491 PDEVICE_OBJECT ChildDeviceObject;
1492 PVIDEO_PORT_CHILD_EXTENSION ChildExtension;
1493
1494 INFO_(VIDEOPRT, "Starting child device probe\n");
1495 DeviceExtension = DeviceObject->DeviceExtension;
1497 {
1498 WARN_(VIDEOPRT, "Miniport's HwGetVideoChildDescriptor is NULL!\n");
1499 return STATUS_SUCCESS;
1500 }
1501
1502 if (!IsListEmpty(&DeviceExtension->ChildDeviceList))
1503 {
1504 ERR_(VIDEOPRT, "FIXME: Support calling VideoPortEnumerateChildren again!\n");
1505 return STATUS_SUCCESS;
1506 }
1507
1508 /* Enumerate the children */
1509 for (i = 1; ; i++)
1510 {
1511 Status = IoCreateDevice(DeviceExtension->DriverObject,
1514 NULL,
1517 FALSE,
1518 &ChildDeviceObject);
1519 if (!NT_SUCCESS(Status))
1520 return Status;
1521
1522 ChildExtension = ChildDeviceObject->DeviceExtension;
1523
1524 RtlZeroMemory(ChildExtension,
1527
1528 ChildExtension->Common.Fdo = FALSE;
1529 ChildExtension->ChildId = i;
1530 ChildExtension->PhysicalDeviceObject = ChildDeviceObject;
1531 ChildExtension->DriverObject = DeviceExtension->DriverObject;
1532
1533 /* Setup the ChildEnumInfo */
1534 ChildEnumInfo.Size = sizeof(ChildEnumInfo);
1535 ChildEnumInfo.ChildDescriptorSize = sizeof(ChildExtension->ChildDescriptor);
1536 ChildEnumInfo.ACPIHwId = 0;
1537
1539 ChildEnumInfo.ChildHwDeviceExtension = VIDEO_PORT_GET_CHILD_EXTENSION(ChildExtension);
1540 else
1541 ChildEnumInfo.ChildHwDeviceExtension = NULL;
1542
1543 ChildEnumInfo.ChildIndex = ChildExtension->ChildId;
1544
1545 INFO_(VIDEOPRT, "Probing child: %d\n", ChildEnumInfo.ChildIndex);
1547 DeviceExtension->MiniPortDeviceExtension,
1548 &ChildEnumInfo,
1549 &ChildExtension->ChildType,
1550 ChildExtension->ChildDescriptor,
1551 &Uid,
1552 &Unused);
1554 {
1555 if (ChildExtension->ChildType == Monitor)
1556 {
1557 // Check if the EDID is valid
1558 if (ChildExtension->ChildDescriptor[0] == 0x00 &&
1559 ChildExtension->ChildDescriptor[1] == 0xFF &&
1560 ChildExtension->ChildDescriptor[2] == 0xFF &&
1561 ChildExtension->ChildDescriptor[3] == 0xFF &&
1562 ChildExtension->ChildDescriptor[4] == 0xFF &&
1563 ChildExtension->ChildDescriptor[5] == 0xFF &&
1564 ChildExtension->ChildDescriptor[6] == 0xFF &&
1565 ChildExtension->ChildDescriptor[7] == 0x00)
1566 {
1567 if (bHaveLastMonitorID)
1568 {
1569 // Compare the previous monitor ID with the current one, break the loop if they are identical
1570 if (RtlCompareMemory(LastMonitorID, &ChildExtension->ChildDescriptor[8], sizeof(LastMonitorID)) == sizeof(LastMonitorID))
1571 {
1572 INFO_(VIDEOPRT, "Found identical Monitor ID two times, stopping enumeration\n");
1573 IoDeleteDevice(ChildDeviceObject);
1574 break;
1575 }
1576 }
1577
1578 // Copy 10 bytes from the EDID, which can be used to uniquely identify the monitor
1579 RtlCopyMemory(LastMonitorID, &ChildExtension->ChildDescriptor[8], sizeof(LastMonitorID));
1580 bHaveLastMonitorID = TRUE;
1581
1582 /* Mark it valid */
1583 ChildExtension->EdidValid = TRUE;
1584 }
1585 else
1586 {
1587 /* Mark it invalid */
1588 ChildExtension->EdidValid = FALSE;
1589 }
1590 }
1591 }
1593 {
1594 WARN_(VIDEOPRT, "Child device %d is invalid!\n", ChildEnumInfo.ChildIndex);
1595 IoDeleteDevice(ChildDeviceObject);
1596 continue;
1597 }
1599 {
1600 INFO_(VIDEOPRT, "End of child enumeration! (%d children enumerated)\n", i - 1);
1601 IoDeleteDevice(ChildDeviceObject);
1602 break;
1603 }
1604 else
1605 {
1606 WARN_(VIDEOPRT, "HwGetVideoChildDescriptor returned unknown status code 0x%x!\n", Status);
1607 IoDeleteDevice(ChildDeviceObject);
1608 break;
1609 }
1610
1611 if (ChildExtension->ChildType == Monitor)
1612 {
1613 UINT j;
1614 PUCHAR p = ChildExtension->ChildDescriptor;
1615 INFO_(VIDEOPRT, "Monitor device enumerated! (ChildId = 0x%x)\n", ChildExtension->ChildId);
1616 for (j = 0; j < sizeof (ChildExtension->ChildDescriptor); j += 8)
1617 {
1618 INFO_(VIDEOPRT, "%02x %02x %02x %02x %02x %02x %02x %02x\n",
1619 p[j + 0], p[j + 1], p[j + 2], p[j + 3],
1620 p[j + 4], p[j + 5], p[j + 6], p[j + 7]);
1621 }
1622 }
1623 else if (ChildExtension->ChildType == Other)
1624 {
1625 INFO_(VIDEOPRT, "\"Other\" device enumerated: DeviceId = %S\n", (PWSTR)ChildExtension->ChildDescriptor);
1626 }
1627 else
1628 {
1629 ERR_(VIDEOPRT, "HwGetVideoChildDescriptor returned unsupported type: %d\n", ChildExtension->ChildType);
1630 }
1631
1632 /* Clear the init flag */
1633 ChildDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
1634
1635 InsertTailList(&DeviceExtension->ChildDeviceList,
1636 &ChildExtension->ListEntry);
1637 }
1638
1639 return STATUS_SUCCESS;
1640}
1641
1643NTAPI
1645 IN PVOID HwDeviceExtension,
1647{
1648 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1649
1650 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1651 ASSERT(DeviceExtension);
1652
1653 if (DeviceExtension->PhysicalDeviceObject)
1654 {
1655 /* Trigger reenumeration by the PnP manager */
1657 }
1658
1659 return NO_ERROR;
1660}
1661
1662/*
1663 * @unimplemented
1664 */
1666NTAPI
1668 IN PVOID HwDeviceExtension,
1669 IN OUT PVOID *SecondaryDeviceExtension,
1670 IN ULONG Flag)
1671{
1673 PVIDEO_PORT_DEVICE_EXTENSION FirstDeviceExtension, DeviceExtension;
1675
1676 ASSERT(SecondaryDeviceExtension);
1677
1678 if (Flag != 0)
1679 {
1681 }
1682
1683 FirstDeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1684
1685 if (FirstDeviceExtension->DisplayNumber != 0)
1686 {
1687 DPRINT1("Calling VideoPortCreateSecondaryDisplay for InstanceId %lu\n",
1688 FirstDeviceExtension->DisplayNumber);
1689 }
1690
1692 FirstDeviceExtension->DriverExtension,
1693 FirstDeviceExtension->PhysicalDeviceObject,
1694 FirstDeviceExtension->AdapterNumber,
1695 FirstDeviceExtension->NumberOfSecondaryDisplays + 1,
1696 &DeviceObject);
1697 if (!NT_SUCCESS(Status))
1698 {
1699 DPRINT1("IntVideoPortCreateAdapterDeviceObject() failed with status 0x%08x\n", Status);
1700 return ERROR_DEV_NOT_EXIST;
1701 }
1702
1703 DeviceExtension = DeviceObject->DeviceExtension;
1704
1705 /* Increment secondary display count */
1706 FirstDeviceExtension->NumberOfSecondaryDisplays++;
1707
1708 *SecondaryDeviceExtension = DeviceExtension->MiniPortDeviceExtension;
1709 return NO_ERROR;
1710}
1711
1712/*
1713 * @implemented
1714 */
1715BOOLEAN
1716NTAPI
1718 IN PVOID HwDeviceExtension,
1721{
1722 return KeInsertQueueDpc(
1723 &VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension)->DpcObject,
1725 (PVOID)Context);
1726}
1727
1728/*
1729 * @implemented
1730 */
1731PVOID
1732NTAPI
1735{
1736 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1737
1738 TRACE_(VIDEOPRT, "VideoPortGetAssociatedDeviceExtension\n");
1739 DeviceExtension = ((PDEVICE_OBJECT)DeviceObject)->DeviceExtension;
1740 if (!DeviceExtension)
1741 return NULL;
1742 return DeviceExtension->MiniPortDeviceExtension;
1743}
1744
1745/*
1746 * @implemented
1747 */
1749NTAPI
1751 IN PVOID HwDeviceExtension,
1752 IN OUT PVPOSVERSIONINFO VpOsVersionInfo)
1753{
1755
1756 Version.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
1757 if (VpOsVersionInfo->Size >= sizeof(VPOSVERSIONINFO))
1758 {
1759#if 1
1761 {
1762 VpOsVersionInfo->MajorVersion = Version.dwMajorVersion;
1763 VpOsVersionInfo->MinorVersion = Version.dwMinorVersion;
1764 VpOsVersionInfo->BuildNumber = Version.dwBuildNumber;
1765 VpOsVersionInfo->ServicePackMajor = Version.wServicePackMajor;
1766 VpOsVersionInfo->ServicePackMinor = Version.wServicePackMinor;
1767 return NO_ERROR;
1768 }
1770#else
1771 VpOsVersionInfo->MajorVersion = 5;
1772 VpOsVersionInfo->MinorVersion = 0;
1773 VpOsVersionInfo->BuildNumber = 2195;
1774 VpOsVersionInfo->ServicePackMajor = 4;
1775 VpOsVersionInfo->ServicePackMinor = 0;
1776 return NO_ERROR;
1777#endif
1778 }
1779
1781}
1782
1783/*
1784 * @implemented
1785 */
1786BOOLEAN
1787NTAPI
1789 IN PVOID HwDeviceExtension,
1790 IN USHORT VendorId,
1791 IN USHORT DeviceId,
1792 IN UCHAR RevisionId,
1793 IN USHORT SubVendorId,
1794 IN USHORT SubSystemId,
1795 IN ULONG Flags)
1796{
1797 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1800 IO_STACK_LOCATION IoStack;
1801 ULONG PciFlags = 0;
1803 BOOL DevicePresent;
1804
1805 TRACE_(VIDEOPRT, "VideoPortCheckForDeviceExistence\n");
1806
1808 {
1809 WARN_(VIDEOPRT, "VideoPortCheckForDeviceExistence: Unknown flags 0x%lx\n", Flags & ~(CDE_USE_REVISION | CDE_USE_SUBSYSTEM_IDS));
1810 return FALSE;
1811 }
1812
1813 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1814
1816 PciDevicePresentInterface.Version = 1;
1818 IoStack.Parameters.QueryInterface.Version = PciDevicePresentInterface.Version;
1820 IoStack.Parameters.QueryInterface.InterfaceType =
1821 &GUID_PCI_DEVICE_PRESENT_INTERFACE;
1822 Status = IopInitiatePnpIrp(DeviceExtension->NextDeviceObject,
1824 if (!NT_SUCCESS(Status))
1825 {
1826 WARN_(VIDEOPRT, "IopInitiatePnpIrp() failed! (Status 0x%lx)\n", Status);
1827 return FALSE;
1828 }
1829
1830 if (Flags & CDE_USE_REVISION)
1831 PciFlags |= PCI_USE_REVISION;
1833 PciFlags |= PCI_USE_SUBSYSTEM_IDS;
1834
1835 DevicePresent = PciDevicePresentInterface.IsDevicePresent(
1836 VendorId, DeviceId, RevisionId,
1837 SubVendorId, SubSystemId, PciFlags);
1838
1839 PciDevicePresentInterface.InterfaceDereference(PciDevicePresentInterface.Context);
1840
1841 return DevicePresent;
1842}
1843
1844/*
1845 * @unimplemented
1846 */
1848NTAPI
1850 IN PVOID HwDeviceExtension,
1851 IN ULONG BugcheckCode,
1853 IN ULONG BugcheckDataSize)
1854{
1856 return NO_ERROR;
1857}
1858
1859/*
1860 * @implemented
1861 */
1863NTAPI
1865 IN PVOID HwDeviceExtension,
1866 OUT PLONGLONG PerformanceFrequency OPTIONAL)
1867{
1869
1870 TRACE_(VIDEOPRT, "VideoPortQueryPerformanceCounter\n");
1871 Result = KeQueryPerformanceCounter((PLARGE_INTEGER)PerformanceFrequency);
1872 return Result.QuadPart;
1873}
1874
1875/*
1876 * @implemented
1877 */
1878VOID
1879NTAPI
1881 IN PVOID HwDeviceExtension)
1882{
1883 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1884
1885 TRACE_(VIDEOPRT, "VideoPortAcquireDeviceLock\n");
1886 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1888 // ASSERT(Status == STATUS_SUCCESS);
1889}
1890
1891/*
1892 * @implemented
1893 */
1894VOID
1895NTAPI
1897 IN PVOID HwDeviceExtension)
1898{
1899 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1900
1901 TRACE_(VIDEOPRT, "VideoPortReleaseDeviceLock\n");
1902 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1903 KeReleaseMutex(&DeviceExtension->DeviceLock, FALSE);
1904 //ASSERT(Status == STATUS_SUCCESS);
1905}
1906
1907/*
1908 * @unimplemented
1909 */
1910VOID
1911NTAPI
1914 IN PVOID Data)
1915{
1917}
1918
1919/*
1920 * @implemented
1921 */
1922PVOID
1923NTAPI
1925 IN PVOID HwDeviceExtension,
1928)
1929{
1931}
1932
1933/*
1934 * @implemented
1935 */
1936BOOLEAN
1937NTAPI
1939{
1940 return VpNoVesa;
1941}
static USHORT USHORT * NewLength
static KSYNCHRONIZE_ROUTINE SynchronizeRoutine
Definition: IoInterrupt.c:30
unsigned char BOOLEAN
Definition: actypes.h:127
NTSYSAPI ULONG NTAPI vDbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ PCCH Format, _In_ va_list ap)
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
BOOL Error
Definition: chkdsk.c:66
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
return Found
Definition: dirsup.c:1270
_In_opt_ PWSTR _In_ PWSTR ParameterName
Definition: cdrom.h:961
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
_In_ PCHAR _In_ ULONG DeviceNumber
Definition: classpnp.h:1230
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
PVOID NTAPI MmAllocateContiguousMemory(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: contmem.c:626
_In_ PIRP Irp
Definition: csq.h:116
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
NTSTATUS NTAPI RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
Definition: version.c:182
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRACE_(x)
Definition: compat.h:76
#define RtlImageNtHeader
Definition: compat.h:806
_ACRTIMP wchar_t *__cdecl wcsstr(const wchar_t *, const wchar_t *)
Definition: wcs.c:2993
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
char * va_list
Definition: vadefs.h:50
#define swprintf
Definition: precomp.h:40
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dpc.c:725
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:712
@ DPFLTR_IHVVIDEO_ID
Definition: dpfilter.h:106
DRIVER_INITIALIZE DriverEntry
Definition: condrv.c:21
#define L(x)
Definition: resources.c:13
#define ULONG_PTR
Definition: config.h:101
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define SYNCH_LEVEL
Definition: env_spec_w32.h:704
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
struct _DEVICE_OBJECT * PDEVICE_OBJECT
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
#define PagedPool
Definition: env_spec_w32.h:308
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
unsigned int BOOL
Definition: ntddk_ex.h:94
NTSYSAPI NTSTATUS NTAPI ZwQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
@ SystemBasicInformation
Definition: ntddk_ex.h:11
_Must_inspect_result_ _In_ PFLT_GET_OPERATION_STATUS_CALLBACK CallbackRoutine
Definition: fltkernel.h:1035
PVOID NTAPI IntVideoPortGetProcAddress(_In_ PVOID HwDeviceExtension, _In_ PUCHAR FunctionName)
Definition: funclist.c:106
Status
Definition: gdiplustypes.h:25
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
LARGE_INTEGER NTAPI KeQueryPerformanceCounter(IN PLARGE_INTEGER PerformanceFreq)
Definition: timer.c:138
_In_ GUID _In_ PVOID ValueData
Definition: hubbusif.h:312
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG, PCWSTR, PCWSTR, ULONG, PVOID, ULONG)
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
KMUTEX VideoPortInt10Mutex
Definition: int10.c:38
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:140
PCI_INTERFACE PciDevicePresentInterface
Definition: devhere.c:18
NTSTATUS NTAPI IoQueryDeviceDescription(_In_opt_ PINTERFACE_TYPE BusType, _In_opt_ PULONG BusNumber, _In_opt_ PCONFIGURATION_TYPE ControllerType, _In_opt_ PULONG ControllerNumber, _In_opt_ PCONFIGURATION_TYPE PeripheralType, _In_opt_ PULONG PeripheralNumber, _In_ PIO_QUERY_DEVICE_ROUTINE CalloutRoutine, _In_opt_ PVOID Context)
Reads and returns Hardware information from the appropriate hardware registry key.
Definition: iorsrce.c:1213
#define REG_SZ
Definition: layer.c:22
#define Unused(x)
Definition: atlwin.h:28
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
_Out_ PNDIS_HANDLE _Out_ PUINT _In_ PNDIS_STRING _In_ NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress
Definition: ndis.h:3230
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
#define KernelMode
Definition: asm.h:38
@ DpcObject
Definition: ketypes.h:425
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
_In_ PCWSTR _Inout_ _At_ QueryTable EntryContext
Definition: rtlfuncs.h:4210
_In_ PCWSTR _Inout_ _At_ QueryTable _Pre_unknown_ PRTL_QUERY_REGISTRY_TABLE QueryTable
Definition: rtlfuncs.h:4211
#define _Out_opt_
Definition: no_sal2.h:214
#define _Inout_
Definition: no_sal2.h:162
#define _Outptr_
Definition: no_sal2.h:262
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define REG_BINARY
Definition: nt_native.h:1499
@ KeyValuePartialInformation
Definition: nt_native.h:1185
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define RTL_REGISTRY_ABSOLUTE
Definition: nt_native.h:161
#define FASTCALL
Definition: nt_native.h:50
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
#define RTL_REGISTRY_DEVICEMAP
Definition: nt_native.h:165
#define RTL_QUERY_REGISTRY_REQUIRED
Definition: nt_native.h:132
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define READ_CONTROL
Definition: nt_native.h:58
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1063
#define UNICODE_NULL
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
__GNU_EXTENSION typedef __int64 * PLONGLONG
Definition: ntbasedef.h:394
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
NTSTATUS NTAPI IopInitiatePnpIrp(IN PDEVICE_OBJECT DeviceObject, IN PIO_STATUS_BLOCK IoStatusBlock, IN UCHAR MinorFunction, IN PIO_STACK_LOCATION Stack)
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1769
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1916
NTSTATUS NTAPI IoAllocateDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress, IN ULONG DriverObjectExtensionSize, OUT PVOID *DriverObjectExtension)
Definition: driver.c:1838
VOID NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
Definition: irq.c:142
BOOLEAN NTAPI KeSynchronizeExecution(IN OUT PKINTERRUPT Interrupt, IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, IN PVOID SynchronizeContext OPTIONAL)
Definition: interrupt.c:237
VOID NTAPI KeInitializeMutex(IN PKMUTEX Mutex, IN ULONG Level)
Definition: mutex.c:67
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
Definition: mutex.c:189
#define STATUS_REVISION_MISMATCH
Definition: ntstatus.h:419
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:31
unsigned short USHORT
Definition: pedump.c:61
SYSTEM_BASIC_INFORMATION SystemBasicInfo
Definition: perfdata.c:30
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:1382
VOID NTAPI IoInvalidateDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE Type)
Definition: pnpmgr.c:1772
NTSTATUS NTAPI IoReportDetectedDevice(_In_ PDRIVER_OBJECT DriverObject, _In_ INTERFACE_TYPE LegacyBusType, _In_ ULONG BusNumber, _In_ ULONG SlotNumber, _In_opt_ PCM_RESOURCE_LIST ResourceList, _In_opt_ PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements, _In_ BOOLEAN ResourceAssigned, _Inout_ PDEVICE_OBJECT *DeviceObject)
Definition: pnpreport.c:148
VOID NTAPI KeStackAttachProcess(IN PKPROCESS Process, OUT PRKAPC_STATE ApcState)
Definition: procobj.c:704
VOID NTAPI KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
Definition: procobj.c:756
#define FILE_DEVICE_VIDEO
Definition: winioctl.h:80
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:49
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
@ PCIBus
Definition: restypes.h:126
enum _INTERFACE_TYPE INTERFACE_TYPE
#define REG_DWORD
Definition: sdbapi.c:615
@ Latched
Definition: miniport.h:81
@ LevelSensitive
Definition: miniport.h:80
struct _INTERFACE * PINTERFACE
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA _In_ PVOID HwContext
Definition: srb.h:907
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA * HwInitializationData
Definition: srb.h:906
#define VIDEO_ENUM_INVALID_DEVICE
Definition: video.h:141
VIDEO_DEBUG_LEVEL
Definition: video.h:587
VPAPI VP_STATUS NTAPI VideoPortVerifyAccessRanges(_In_ PVOID HwDeviceExtension, _In_opt_ ULONG NumAccessRanges, _In_reads_opt_(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRanges)
Claims or releases a range of hardware resources and checks for conflicts.
Definition: resource.c:984
LONG VP_STATUS
Definition: video.h:153
#define VIDEO_ENUM_NO_MORE_DEVICES
Definition: video.h:140
VOID(NTAPI * PVIDEO_BUGCHECK_CALLBACK)(IN PVOID HwDeviceExtension, IN ULONG BugcheckCode, IN PUCHAR Buffer, IN ULONG BufferSize)
Definition: video.h:527
VIDEO_SYNCHRONIZE_PRIORITY
Definition: video.h:534
@ VpMediumPriority
Definition: video.h:536
@ VpLowPriority
Definition: video.h:535
@ VpHighPriority
Definition: video.h:537
VOID(NTAPI * PMINIPORT_DPC_ROUTINE)(IN PVOID HwDeviceExtension, IN PVOID Context)
Definition: video.h:518
struct _VIDEO_HW_INITIALIZATION_DATA VIDEO_HW_INITIALIZATION_DATA
#define SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA
Definition: video.h:119
#define CDE_USE_REVISION
Definition: video.h:147
@ Monitor
Definition: video.h:270
@ Other
Definition: video.h:273
#define VIDEO_ENUM_MORE_DEVICES
Definition: video.h:139
#define SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA
Definition: video.h:120
struct _VIDEO_PORT_CONFIG_INFO VIDEO_PORT_CONFIG_INFO
#define CDE_USE_SUBSYSTEM_IDS
Definition: video.h:146
VP_STATUS(NTAPI * PMINIPORT_GET_REGISTRY_ROUTINE)(IN PVOID HwDeviceExtension, IN PVOID Context, IN OUT PWSTR ValueName, IN OUT PVOID ValueData, IN ULONG ValueLength)
Definition: video.h:510
BOOLEAN(NTAPI * PMINIPORT_SYNCHRONIZE_ROUTINE)(IN PVOID Context)
Definition: video.h:523
enum _CONFIGURATION_TYPE CONFIGURATION_TYPE
#define ASSERT_IRQL_LESS_OR_EQUAL(x)
Definition: debug.h:251
#define INFO_(ch,...)
Definition: debug.h:159
#define ERR_(ch,...)
Definition: debug.h:156
#define WARN_(ch,...)
Definition: debug.h:157
wcsncpy
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define DPRINT
Definition: sndvol32.h:73
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
base for all directory entries
Definition: entries.h:138
Definition: xml2sdb.h:97
PMINIPORT_GET_REGISTRY_ROUTINE HwGetRegistryRoutine
Definition: videoprt.c:1195
PVOID DeviceExtension
Definition: env_spec_w32.h:418
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntddk_ex.h:178
union _IO_STACK_LOCATION::@1658 Parameters
struct _IO_STACK_LOCATION::@4254::@4280 QueryInterface
Definition: ketypes.h:751
PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine
Definition: nt_native.h:109
ULONG ChildDescriptorSize
Definition: video.h:262
PVOID ChildHwDeviceExtension
Definition: video.h:265
PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor
Definition: video.h:685
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:132
VIDEO_CHILD_TYPE ChildType
Definition: videoprt.h:126
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:131
VIDEO_PORT_COMMON_EXTENSION Common
Definition: videoprt.h:123
KINTERRUPT_MODE InterruptMode
Definition: video.h:172
INTERFACE_TYPE AdapterInterfaceType
Definition: video.h:169
PVIDEO_PORT_GET_PROC_ADDRESS VideoPortGetProcAddress
Definition: video.h:193
ULONG BusInterruptVector
Definition: video.h:171
ULONGLONG SystemMemorySize
Definition: video.h:195
PWSTR DriverRegistryPath
Definition: video.h:194
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:87
PDEVICE_OBJECT NextDeviceObject
Definition: videoprt.h:89
VIDEO_PORT_DRIVER_EXTENSION * DriverExtension
Definition: videoprt.h:103
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:98
CHAR POINTER_ALIGNMENT MiniPortDeviceExtension[1]
Definition: videoprt.h:118
UNICODE_STRING RegistryPath
Definition: videoprt.h:90
LIST_ENTRY AddressMappingListHead
Definition: videoprt.h:101
VIDEO_PORT_COMMON_EXTENSION Common
Definition: videoprt.h:84
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:86
UNICODE_STRING NewRegistryPath
Definition: videoprt.h:91
PDEVICE_OBJECT FunctionalDeviceObject
Definition: videoprt.h:88
VIDEO_HW_INITIALIZATION_DATA InitializationData
Definition: videoprt.h:72
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT Context1
Definition: tdikrnl.h:1095
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT _In_ PTDI_PNP_CONTEXT Context2
Definition: tdikrnl.h:1096
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint16_t * PWSTR
Definition: typedefs.h:56
#define MAXULONG
Definition: typedefs.h:251
uint32_t * PULONG
Definition: typedefs.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
int64_t LONGLONG
Definition: typedefs.h:68
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
ULONG NumOfVgaRanges
Definition: videoprt.c:48
VOID NTAPI VpNotifyEaData(IN PDEVICE_OBJECT DeviceObject, IN PVOID Data)
Definition: videoprt.c:1912
VOID NTAPI VideoPortAcquireDeviceLock(IN PVOID HwDeviceExtension)
Definition: videoprt.c:1880
PKPROCESS CsrProcess
Definition: videoprt.c:39
VOID NTAPI IntVideoPortDeferredRoutine(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: videoprt.c:157
BOOLEAN VideoPortUseNewKey
Definition: videoprt.c:41
BOOLEAN NTAPI VideoPortCheckForDeviceExistence(IN PVOID HwDeviceExtension, IN USHORT VendorId, IN USHORT DeviceId, IN UCHAR RevisionId, IN USHORT SubVendorId, IN USHORT SubSystemId, IN ULONG Flags)
Definition: videoprt.c:1788
PVOID NTAPI VideoPortAllocateContiguousMemory(IN PVOID HwDeviceExtension, IN ULONG NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: videoprt.c:1924
VOID NTAPI VideoPortLogError(IN PVOID HwDeviceExtension, IN PVIDEO_REQUEST_PACKET Vrp OPTIONAL, IN VP_STATUS ErrorCode, IN ULONG UniqueId)
Definition: videoprt.c:1167
VOID FASTCALL IntDetachFromCSRSS(_In_ PKPROCESS CallingProcess, _In_ PKAPC_STATE ApcState)
Detach the current thread from the CSRSS process. This routine is to be invoked after a previous succ...
Definition: videoprt.c:762
VP_STATUS NTAPI VideoPortSetRegistryParameters(IN PVOID HwDeviceExtension, IN PWSTR ValueName, IN PVOID ValueData, IN ULONG ValueLength)
Definition: videoprt.c:1278
PVOID NTAPI IntVideoPortImageDirectoryEntryToData(PVOID BaseAddress, ULONG Directory)
Definition: videoprt.c:134
VOID FASTCALL IntLoadRegistryParameters(VOID)
Definition: videoprt.c:773
VP_STATUS NTAPI VideoPortRegisterBugcheckCallback(IN PVOID HwDeviceExtension, IN ULONG BugcheckCode, IN PVIDEO_BUGCHECK_CALLBACK Callback, IN ULONG BugcheckDataSize)
Definition: videoprt.c:1849
ULONG VideoDebugLevel
Definition: videoprt.c:34
BOOLEAN NTAPI VideoPortScanRom(IN PVOID HwDeviceExtension, IN PUCHAR RomBase, IN ULONG RomLength, IN PUCHAR String)
Definition: videoprt.c:1398
VP_STATUS NTAPI VideoPortGetVersion(IN PVOID HwDeviceExtension, IN OUT PVPOSVERSIONINFO VpOsVersionInfo)
Definition: videoprt.c:1750
VP_STATUS NTAPI VideoPortGetRegistryParameters(IN PVOID HwDeviceExtension, IN PWSTR ParameterName, IN UCHAR IsParameterFileName, IN PMINIPORT_GET_REGISTRY_ROUTINE GetRegistryRoutine, IN PVOID HwContext)
Definition: videoprt.c:1227
struct QueryRegistryCallbackContext * PQUERY_REGISTRY_CALLBACK_CONTEXT
static ULONG VideoPortMaxObjectNumber
Definition: videoprt.c:40
static NTSTATUS NTAPI QueryRegistryCallback(IN PWSTR ValueName, IN ULONG ValueType, IN PVOID ValueData, IN ULONG ValueLength, IN PVOID Context, IN PVOID EntryContext)
Definition: videoprt.c:1201
BOOLEAN VpNoVesa
Definition: videoprt.c:37
UCHAR NTAPI VideoPortGetCurrentIrql(VOID)
Definition: videoprt.c:1186
VOID VideoPortDebugPrint(IN VIDEO_DEBUG_LEVEL DebugPrintLevel, IN PCHAR DebugMessage,...)
Definition: videoprt.c:1147
NTSTATUS NTAPI IntVideoPortCreateAdapterDeviceObject(_In_ PDRIVER_OBJECT DriverObject, _In_ PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, _In_opt_ PDEVICE_OBJECT PhysicalDeviceObject, _In_ USHORT AdapterNumber, _In_ USHORT DisplayNumber, _Out_opt_ PDEVICE_OBJECT *DeviceObject)
Definition: videoprt.c:170
NTSTATUS NTAPI IntVideoPortFindAdapter(IN PDRIVER_OBJECT DriverObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, IN PDEVICE_OBJECT DeviceObject)
Definition: videoprt.c:432
VOID NTAPI VideoPortReleaseDeviceLock(IN PVOID HwDeviceExtension)
Definition: videoprt.c:1896
static NTSTATUS IntVideoPortAddDeviceMapLink(PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: videoprt.c:70
VP_STATUS NTAPI VideoPortEnumerateChildren(IN PVOID HwDeviceExtension, IN PVOID Reserved)
Definition: videoprt.c:1644
PVIDEO_PORT_DEVICE_EXTENSION VgaDeviceExtension
Definition: videoprt.c:46
LONGLONG NTAPI VideoPortQueryPerformanceCounter(IN PVOID HwDeviceExtension, OUT PLONGLONG PerformanceFrequency OPTIONAL)
Definition: videoprt.c:1864
ULONG NTAPI VideoPortInitialize(IN PVOID Context1, IN PVOID Context2, IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData, IN PVOID HwContext)
Definition: videoprt.c:932
struct QueryRegistryCallbackContext QUERY_REGISTRY_CALLBACK_CONTEXT
BOOLEAN NTAPI VideoPortIsNoVesa(VOID)
Definition: videoprt.c:1938
BOOLEAN VpBaseVideo
Definition: videoprt.c:36
KMUTEX VgaSyncLock
Definition: videoprt.c:45
VP_STATUS NTAPI VideoPortCreateSecondaryDisplay(IN PVOID HwDeviceExtension, IN OUT PVOID *SecondaryDeviceExtension, IN ULONG Flag)
Definition: videoprt.c:1667
static NTSTATUS IntVideoPortEnumBuses(_In_ INTERFACE_TYPE AdapterInterfaceType, _Inout_ PULONG BusNumber)
Enumerates all supported buses on the system.
Definition: videoprt.c:405
static NTSTATUS NTAPI IntVideoPortEnumBusCallback(_In_ PVOID Context, _In_ PUNICODE_STRING PathName, _In_ INTERFACE_TYPE BusType, _In_ ULONG BusNumber, _In_ PKEY_VALUE_FULL_INFORMATION *BusInformation, _In_ CONFIGURATION_TYPE ControllerType, _In_ ULONG ControllerNumber, _In_ PKEY_VALUE_FULL_INFORMATION *ControllerInformation, _In_ CONFIGURATION_TYPE PeripheralType, _In_ ULONG PeripheralNumber, _In_ PKEY_VALUE_FULL_INFORMATION *PeripheralInformation)
A PIO_QUERY_DEVICE_ROUTINE callback for IoQueryDeviceDescription() to return success when an enumerat...
Definition: videoprt.c:371
KSPIN_LOCK HwResetAdaptersLock
Definition: videoprt.c:43
PVOID NTAPI VideoPortGetAssociatedDeviceExtension(IN PVOID DeviceObject)
Definition: videoprt.c:1733
PVOID NTAPI VideoPortGetRomImage(IN PVOID HwDeviceExtension, IN PVOID Unused1, IN ULONG Unused2, IN ULONG Length)
Definition: videoprt.c:1337
PVIDEO_ACCESS_RANGE VgaRanges
Definition: videoprt.c:47
NTSTATUS NTAPI IntVideoPortEnumerateChildren(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: videoprt.c:1480
BOOLEAN FASTCALL IntAttachToCSRSS(_Outptr_ PKPROCESS *CallingProcess, _Out_ PKAPC_STATE ApcState)
Attach the current thread to the CSRSS process. The caller must detach from the process by invoking I...
Definition: videoprt.c:735
BOOLEAN NTAPI VideoPortQueueDpc(IN PVOID HwDeviceExtension, IN PMINIPORT_DPC_ROUTINE CallbackRoutine, IN PVOID Context)
Definition: videoprt.c:1717
VP_STATUS NTAPI VideoPortGetVgaStatus(IN PVOID HwDeviceExtension, OUT PULONG VgaStatus)
Definition: videoprt.c:1309
BOOLEAN NTAPI VideoPortSynchronizeExecution(IN PVOID HwDeviceExtension, IN VIDEO_SYNCHRONIZE_PRIORITY Priority, IN PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine, OUT PVOID Context)
Definition: videoprt.c:1431
static BOOLEAN IntIsVgaSaveDriverName(_In_ PDRIVER_OBJECT DriverObject)
Definition: videoprt.c:53
LIST_ENTRY HwResetAdaptersList
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:145
#define TAG_VIDEO_PORT
Definition: videoprt.h:38
struct _VIDEO_PORT_DEVICE_EXTENSTION * PVIDEO_PORT_DEVICE_EXTENSION
#define VIDEO_PORT_GET_CHILD_EXTENSION(MiniportExtension)
Definition: videoprt.h:139
struct _VIDEO_PORT_DEVICE_EXTENSTION VIDEO_PORT_DEVICE_EXTENSION
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2439
_In_ WDFDEVICE _In_ PPNP_BUS_INFORMATION BusInformation
Definition: wdfdevice.h:3921
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3281
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
Definition: wdfdpc.h:112
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:655
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG _Out_opt_ PULONG _Out_opt_ PULONG ValueType
Definition: wdfregistry.h:282
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG ValueLength
Definition: wdfregistry.h:275
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:68
struct _KPROCESS * PKPROCESS
Definition: wdm.template.h:201
NTSTATUS NTAPI IntVideoPortDispatchClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:434
VOID NTAPI IntVideoPortUnload(PDRIVER_OBJECT DriverObject)
Definition: dispatch.c:1288
NTSTATUS NTAPI IntVideoPortDispatchOpen(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:369
NTSTATUS NTAPI IntVideoPortDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:766
NTSTATUS NTAPI IntVideoPortDispatchSystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:1266
NTSTATUS NTAPI IntVideoPortDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:1200
NTSTATUS NTAPI IntVideoPortAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
Definition: dispatch.c:334
NTSTATUS NTAPI IntVideoPortDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:1232
BOOLEAN NTAPI IntVideoPortSetupInterrupt(IN PDEVICE_OBJECT DeviceObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, IN PVIDEO_PORT_CONFIG_INFO ConfigInfo)
Definition: interrupt.c:45
NTSTATUS NTAPI IntCreateRegistryPath(IN PCUNICODE_STRING DriverRegistryPath, IN ULONG DeviceNumber, OUT PUNICODE_STRING DeviceRegistryPath)
Definition: registry.c:603
NTSTATUS NTAPI IntCreateNewRegistryPath(PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: registry.c:408
NTSTATUS NTAPI IntSetupDeviceSettingsKey(PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: registry.c:298
VOID IntVideoPortReleaseResources(_In_ PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: resource.c:206
BOOLEAN NTAPI IntVideoPortSetupTimer(IN PDEVICE_OBJECT DeviceObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension)
Definition: timer.c:43
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR _In_ ULONGLONG _In_ ULONGLONG _In_opt_ PEVENT_FILTER_DESCRIPTOR _Inout_opt_ PVOID CallbackContext
Definition: wmitypes.h:60
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE BusType
Definition: halfuncs.h:159
@ BusRelations
Definition: iotypes.h:2154
#define IRP_MN_QUERY_INTERFACE
struct _PCI_DEVICE_PRESENT_INTERFACE PCI_DEVICE_PRESENT_INTERFACE
@ DevicePropertyAddress
Definition: iotypes.h:1211
@ DevicePropertyBusNumber
Definition: iotypes.h:1209
@ DevicePropertyLegacyBusType
Definition: iotypes.h:1208
#define IRP_MJ_SYSTEM_CONTROL
#define PCI_USE_REVISION
Definition: iotypes.h:867
#define IRP_MJ_SHUTDOWN
#define IRP_MJ_POWER
#define PCI_USE_SUBSYSTEM_IDS
Definition: iotypes.h:866
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036
#define KeWaitForMutexObject
Definition: kefuncs.h:543
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
@ Executive
Definition: ketypes.h:467
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:740
* PKAPC_STATE
Definition: ketypes.h:1711
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:739
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:741
KAPC_STATE
Definition: ketypes.h:1711
#define PsGetCurrentProcess
Definition: psfuncs.h:17
#define RTL_STATIC_LIST_HEAD(x)
Definition: rtlfuncs.h:47
struct _OSVERSIONINFOEXW RTL_OSVERSIONINFOEXW
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180