ReactOS  0.4.15-dev-425-gc40b086
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 
36 
42 
43 /* PRIVATE FUNCTIONS **********************************************************/
44 
45 ULONG
46 NTAPI
50 {
51  return STATUS_SUCCESS;
52 }
53 
54 PVOID
55 NTAPI
59 {
60  PIMAGE_NT_HEADERS NtHeader;
61  ULONG Va;
62 
63  NtHeader = RtlImageNtHeader(BaseAddress);
64  if (NtHeader == NULL)
65  return NULL;
66 
68  return NULL;
69 
71  if (Va == 0)
72  return NULL;
73 
74  return (PVOID)((ULONG_PTR)BaseAddress + Va);
75 }
76 
77 VOID
78 NTAPI
80  IN PKDPC Dpc,
84 {
85  PVOID HwDeviceExtension =
86  &((PVIDEO_PORT_DEVICE_EXTENSION)DeferredContext)->MiniPortDeviceExtension;
88 }
89 
91 NTAPI
97 {
98  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
100  ULONG PciSlotNumber;
102  ULONG Size;
104  WCHAR DeviceBuffer[20];
106  PDEVICE_OBJECT DeviceObject_;
107 
108  if (DeviceObject == NULL)
109  DeviceObject = &DeviceObject_;
110 
111  /*
112  * Find the first free device number that can be used for video device
113  * object names and symlinks.
114  */
116  if (DeviceNumber == 0xFFFFFFFF)
117  {
118  WARN_(VIDEOPRT, "Can't find free device number\n");
119  return STATUS_UNSUCCESSFUL;
120  }
121 
122  /*
123  * Create the device object.
124  */
125 
126  /* Create a unicode device name. */
127  swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
128  RtlInitUnicodeString(&DeviceName, DeviceBuffer);
129 
130  INFO_(VIDEOPRT, "HwDeviceExtension size is: 0x%x\n",
131  DriverExtension->InitializationData.HwDeviceExtensionSize);
132 
133  /* Create the device object. */
135  DriverExtension->InitializationData.HwDeviceExtensionSize;
137  Size,
138  &DeviceName,
140  0,
141  TRUE,
142  DeviceObject);
143 
144  if (!NT_SUCCESS(Status))
145  {
146  WARN_(VIDEOPRT, "IoCreateDevice call failed with status 0x%08x\n", Status);
147  return Status;
148  }
149 
150  /*
151  * Set the buffering strategy here. If you change this, remember
152  * to change VidDispatchDeviceControl too.
153  */
154 
155  (*DeviceObject)->Flags |= DO_BUFFERED_IO;
156 
157  /* Initialize device extension. */
158  DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)((*DeviceObject)->DeviceExtension);
159  DeviceExtension->Common.Fdo = TRUE;
160  DeviceExtension->DeviceNumber = DeviceNumber;
161  DeviceExtension->DriverObject = DriverObject;
162  DeviceExtension->PhysicalDeviceObject = PhysicalDeviceObject;
163  DeviceExtension->FunctionalDeviceObject = *DeviceObject;
164  DeviceExtension->DriverExtension = DriverExtension;
165  DeviceExtension->SessionId = -1;
166 
167  InitializeListHead(&DeviceExtension->ChildDeviceList);
168 
169  /* Get the registry path associated with this device. */
171  &DeviceExtension->RegistryPath);
172  if (!NT_SUCCESS(Status))
173  {
174  WARN_(VIDEOPRT, "IntCreateRegistryPath() call failed with status 0x%08x\n", Status);
176  *DeviceObject = NULL;
177  return Status;
178  }
179 
180  if (PhysicalDeviceObject != NULL)
181  {
182  /* Get bus number from the upper level bus driver. */
183  Size = sizeof(ULONG);
186  Size,
187  &DeviceExtension->SystemIoBusNumber,
188  &Size);
189  if (!NT_SUCCESS(Status))
190  {
191  WARN_(VIDEOPRT, "Couldn't get an information from bus driver. We will try to\n"
192  "use legacy detection method, but even that doesn't mean that\n"
193  "it will work.\n");
194  DeviceExtension->PhysicalDeviceObject = NULL;
195  }
196  }
197 
198  DeviceExtension->AdapterInterfaceType =
199  DriverExtension->InitializationData.AdapterInterfaceType;
200 
201  if (PhysicalDeviceObject != NULL)
202  {
203  /* Get bus type from the upper level bus driver. */
204  Size = sizeof(ULONG);
207  Size,
208  &DeviceExtension->AdapterInterfaceType,
209  &Size);
210 
211  /* Get bus device address from the upper level bus driver. */
212  Size = sizeof(ULONG);
215  Size,
216  &PciSlotNumber,
217  &Size);
218 
219  /* Convert slotnumber to PCI_SLOT_NUMBER */
220  SlotNumber.u.AsULONG = 0;
221  SlotNumber.u.bits.DeviceNumber = (PciSlotNumber >> 16) & 0xFFFF;
222  SlotNumber.u.bits.FunctionNumber = PciSlotNumber & 0xFFFF;
223  DeviceExtension->SystemIoSlotNumber = SlotNumber.u.AsULONG;
224  }
225 
226  InitializeListHead(&DeviceExtension->AddressMappingListHead);
227  InitializeListHead(&DeviceExtension->DmaAdapterList);
228 
229  KeInitializeDpc(&DeviceExtension->DpcObject,
231  DeviceExtension);
232 
233  KeInitializeMutex(&DeviceExtension->DeviceLock, 0);
234 
235  /* Attach the device. */
236  if (PhysicalDeviceObject != NULL)
238  *DeviceObject,
240 
241  IntCreateNewRegistryPath(DeviceExtension);
242  IntSetupDeviceSettingsKey(DeviceExtension);
243 
244  /* Remove the initailizing flag */
245  (*DeviceObject)->Flags &= ~DO_DEVICE_INITIALIZING;
246  return STATUS_SUCCESS;
247 }
248 
249 
250 NTSTATUS
251 NTAPI
256 {
257  WCHAR DeviceVideoBuffer[20];
258  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
260  VIDEO_PORT_CONFIG_INFO ConfigInfo;
262  UCHAR Again = FALSE;
263  WCHAR DeviceBuffer[20];
265  WCHAR SymlinkBuffer[20];
266  UNICODE_STRING SymlinkName;
267  BOOL LegacyDetection = FALSE;
269 
271  DeviceNumber = DeviceExtension->DeviceNumber;
272 
273  /* Setup a ConfigInfo structure that we will pass to HwFindAdapter. */
274  RtlZeroMemory(&ConfigInfo, sizeof(VIDEO_PORT_CONFIG_INFO));
275  ConfigInfo.Length = sizeof(VIDEO_PORT_CONFIG_INFO);
276  ConfigInfo.AdapterInterfaceType = DeviceExtension->AdapterInterfaceType;
277  if (ConfigInfo.AdapterInterfaceType == PCIBus)
278  ConfigInfo.InterruptMode = LevelSensitive;
279  else
280  ConfigInfo.InterruptMode = Latched;
281  ConfigInfo.DriverRegistryPath = DriverExtension->RegistryPath.Buffer;
283  ConfigInfo.SystemIoBusNumber = DeviceExtension->SystemIoBusNumber;
284  ConfigInfo.BusInterruptLevel = DeviceExtension->InterruptLevel;
285  ConfigInfo.BusInterruptVector = DeviceExtension->InterruptVector;
286 
289  sizeof(SystemBasicInfo),
290  NULL);
291  if (NT_SUCCESS(Status))
292  {
295  }
296 
297  /*
298  * Call miniport HwVidFindAdapter entry point to detect if
299  * particular device is present. There are two possible code
300  * paths. The first one is for Legacy drivers (NT4) and cases
301  * when we don't have information about what bus we're on. The
302  * second case is the standard one for Plug & Play drivers.
303  */
304  if (DeviceExtension->PhysicalDeviceObject == NULL)
305  {
306  LegacyDetection = TRUE;
307  }
308 
309  if (LegacyDetection)
310  {
311  ULONG BusNumber, MaxBuses;
312 
313  MaxBuses = DeviceExtension->AdapterInterfaceType == PCIBus ? PCI_MAX_BRIDGE_NUMBER : 1;
314 
315  for (BusNumber = 0; BusNumber < MaxBuses; BusNumber++)
316  {
317  DeviceExtension->SystemIoBusNumber =
318  ConfigInfo.SystemIoBusNumber = BusNumber;
319 
320  RtlZeroMemory(&DeviceExtension->MiniPortDeviceExtension,
321  DriverExtension->InitializationData.HwDeviceExtensionSize);
322 
323  /* FIXME: Need to figure out what string to pass as param 3. */
324  Status = DriverExtension->InitializationData.HwFindAdapter(
325  &DeviceExtension->MiniPortDeviceExtension,
326  DriverExtension->HwContext,
327  NULL,
328  &ConfigInfo,
329  &Again);
330 
332  {
333  continue;
334  }
335  else if (Status == NO_ERROR)
336  {
337  break;
338  }
339  else
340  {
341  ERR_(VIDEOPRT, "HwFindAdapter call failed with error 0x%X\n", Status);
342  goto Failure;
343  }
344  }
345  }
346  else
347  {
348  /* FIXME: Need to figure out what string to pass as param 3. */
349  Status = DriverExtension->InitializationData.HwFindAdapter(
350  &DeviceExtension->MiniPortDeviceExtension,
351  DriverExtension->HwContext,
352  NULL,
353  &ConfigInfo,
354  &Again);
355  }
356 
357  if (Status != NO_ERROR)
358  {
359  ERR_(VIDEOPRT, "HwFindAdapter call failed with error 0x%X\n", Status);
360  goto Failure;
361  }
362 
363  /*
364  * Now we know the device is present, so let's do all additional tasks
365  * such as creating symlinks or setting up interrupts and timer.
366  */
367 
368  /* Create a unicode device name. */
369  swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
370  RtlInitUnicodeString(&DeviceName, DeviceBuffer);
371 
372  /* Create symbolic link "\??\DISPLAYx" */
373  swprintf(SymlinkBuffer, L"\\??\\DISPLAY%lu", DeviceNumber + 1);
374  RtlInitUnicodeString(&SymlinkName, SymlinkBuffer);
375  IoCreateSymbolicLink(&SymlinkName, &DeviceName);
376 
377  /* Add entry to DEVICEMAP\VIDEO key in registry. */
378  swprintf(DeviceVideoBuffer, L"\\Device\\Video%d", DeviceNumber);
381  L"VIDEO",
382  DeviceVideoBuffer,
383  REG_SZ,
384  DeviceExtension->RegistryPath.Buffer,
385  DeviceExtension->RegistryPath.Length + sizeof(UNICODE_NULL));
386 
389  L"VIDEO",
390  L"MaxObjectNumber",
391  REG_DWORD,
392  &DeviceNumber,
393  sizeof(DeviceNumber));
394 
395  /* FIXME: Allocate hardware resources for device. */
396 
397  /* Allocate interrupt for device. */
399  {
401  goto Failure;
402  }
403 
404  /* Allocate timer for device. */
406  {
407  if (DeviceExtension->InterruptObject != NULL)
408  IoDisconnectInterrupt(DeviceExtension->InterruptObject);
409  ERR_(VIDEOPRT, "IntVideoPortSetupTimer failed\n");
411  goto Failure;
412  }
413 
414  /* If the device can be reset, insert it in the list of resettable adapters */
415  InitializeListHead(&DeviceExtension->HwResetListEntry);
416  if (DriverExtension->InitializationData.HwResetHw != NULL)
417  {
419  &DeviceExtension->HwResetListEntry,
421  }
422 
423  /* Query children of the device. */
425 
426  INFO_(VIDEOPRT, "STATUS_SUCCESS\n");
427  return STATUS_SUCCESS;
428 
429 Failure:
430  RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
431  if (DeviceExtension->NextDeviceObject)
432  IoDetachDevice(DeviceExtension->NextDeviceObject);
434  return Status;
435 }
436 
437 VOID
438 FASTCALL
440  PKPROCESS *CallingProcess,
442 {
443  *CallingProcess = (PKPROCESS)PsGetCurrentProcess();
444  if (*CallingProcess != CsrProcess)
445  {
447  }
448 }
449 
450 VOID
451 FASTCALL
453  PKPROCESS *CallingProcess,
455 {
456  if (*CallingProcess != CsrProcess)
457  {
459  }
460 }
461 
462 VOID
463 FASTCALL
465 {
468  UNICODE_STRING Path = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control");
469  UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"SystemStartOptions");
473 
474  /* Initialize object attributes with the path we want */
476  &Path,
478  NULL,
479  NULL);
480 
481  /* Open the key */
482  Status = ZwOpenKey(&KeyHandle,
485  if (!NT_SUCCESS(Status))
486  {
487  VideoPortDebugPrint(Error, "ZwOpenKey failed (0x%x)\n", Status);
488  return;
489  }
490 
491  /* Find out how large our buffer should be */
492  Status = ZwQueryValueKey(KeyHandle,
493  &ValueName,
495  NULL,
496  0,
497  &Length);
499  {
500  VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status);
502  return;
503  }
504 
505  /* Allocate it */
507  if (!KeyInfo)
508  {
509  VideoPortDebugPrint(Error, "Out of memory\n");
511  return;
512  }
513 
514  /* Now for real this time */
515  Status = ZwQueryValueKey(KeyHandle,
516  &ValueName,
518  KeyInfo,
519  Length,
520  &NewLength);
522 
523  if (!NT_SUCCESS(Status))
524  {
525  VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status);
527  return;
528  }
529 
530  /* Sanity check */
531  if (KeyInfo->Type != REG_SZ)
532  {
533  VideoPortDebugPrint(Error, "Invalid type for SystemStartOptions\n");
535  return;
536  }
537 
538  /* Check if BASEVIDEO or NOVESA is present in the start options */
539  if (wcsstr((PWCHAR)KeyInfo->Data, L"BASEVIDEO"))
540  VpBaseVideo = TRUE;
541  if (wcsstr((PWCHAR)KeyInfo->Data, L"NOVESA"))
542  VpNoVesa = TRUE;
543 
545 
546  /* FIXME: Old ReactOS-compatibility... */
547  if (VpBaseVideo) VpNoVesa = TRUE;
548 
549  if (VpNoVesa)
550  VideoPortDebugPrint(Info, "VESA mode disabled\n");
551  else
552  VideoPortDebugPrint(Info, "VESA mode enabled\n");
553 
554  /* If we are in BASEVIDEO, create the volatile registry key for Win32k */
555  if (VpBaseVideo)
556  {
557  RtlInitUnicodeString(&Path, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\GraphicsDrivers\\BaseVideo");
558 
560  &Path,
562  NULL,
563  NULL);
564 
565  Status = ZwCreateKey(&KeyHandle,
566  KEY_WRITE,
568  0,
569  NULL,
571  NULL);
572  if (NT_SUCCESS(Status))
574  else
575  ERR_(VIDEOPRT, "Failed to create the BaseVideo key (0x%x)\n", Status);
576  }
577 
578  return;
579 }
580 
581 /* PUBLIC FUNCTIONS ***********************************************************/
582 
583 /*
584  * @implemented
585  */
586 ULONG
587 NTAPI
589  IN PVOID Context1,
590  IN PVOID Context2,
593 {
598  BOOLEAN PnpDriver = FALSE, LegacyDetection = FALSE;
599  static BOOLEAN FirstInitialization;
600 
601  TRACE_(VIDEOPRT, "VideoPortInitialize\n");
602 
603  if (!FirstInitialization)
604  {
605  FirstInitialization = TRUE;
609  }
610 
611  /* As a first thing do parameter checks. */
612  if (HwInitializationData->HwInitDataSize > sizeof(VIDEO_HW_INITIALIZATION_DATA))
613  {
614  ERR_(VIDEOPRT, "Invalid HwInitializationData\n");
616  }
617 
618  if ((HwInitializationData->HwFindAdapter == NULL) ||
619  (HwInitializationData->HwInitialize == NULL) ||
620  (HwInitializationData->HwStartIO == NULL))
621  {
622  ERR_(VIDEOPRT, "Invalid HwInitializationData\n");
624  }
625 
626  switch (HwInitializationData->HwInitDataSize)
627  {
628  /*
629  * NT4 drivers are special case, because we must use legacy method
630  * of detection instead of the Plug & Play one.
631  */
633  INFO_(VIDEOPRT, "We were loaded by a Windows NT miniport driver.\n");
634  break;
635 
637  INFO_(VIDEOPRT, "We were loaded by a Windows 2000 miniport driver.\n");
638  break;
639 
640  case sizeof(VIDEO_HW_INITIALIZATION_DATA):
641  INFO_(VIDEOPRT, "We were loaded by a Windows XP or later miniport driver.\n");
642  break;
643 
644  default:
645  ERR_(VIDEOPRT, "Invalid HwInitializationData size.\n");
646  return STATUS_UNSUCCESSFUL;
647  }
648 
649  /* Set dispatching routines */
657 
658  /* Determine type of the miniport driver */
659  if ((HwInitializationData->HwInitDataSize >=
660  FIELD_OFFSET(VIDEO_HW_INITIALIZATION_DATA, HwQueryInterface)) &&
661  (HwInitializationData->HwSetPowerState != NULL) &&
662  (HwInitializationData->HwGetPowerState != NULL) &&
663  (HwInitializationData->HwGetVideoChildDescriptor != NULL))
664  {
665  INFO_(VIDEOPRT, "The miniport is a PnP miniport driver\n");
666  PnpDriver = TRUE;
667  }
668 
669  /* Check if legacy detection should be applied */
670  if (!PnpDriver || HwContext)
671  {
672  INFO_(VIDEOPRT, "Legacy detection for adapter interface %d\n",
673  HwInitializationData->AdapterInterfaceType);
674 
675  /* FIXME: Move the code for legacy detection
676  to another function and call it here */
677  LegacyDetection = TRUE;
678  }
679 
680  /*
681  * NOTE:
682  * The driver extension can be already allocated in case that we were
683  * called by legacy driver and failed detecting device. Some miniport
684  * drivers in that case adjust parameters and call VideoPortInitialize
685  * again.
686  */
688  if (DriverExtension == NULL)
689  {
691  DriverObject,
693  (PVOID *)&DriverExtension);
694  if (!NT_SUCCESS(Status))
695  {
696  ERR_(VIDEOPRT, "IoAllocateDriverObjectExtension failed 0x%x\n", Status);
697  return Status;
698  }
699 
700  /*
701  * Save the registry path. This should be done only once even if
702  * VideoPortInitialize is called multiple times.
703  */
704  if (RegistryPath->Length != 0)
705  {
706  DriverExtension->RegistryPath.Length = 0;
707  DriverExtension->RegistryPath.MaximumLength =
708  RegistryPath->Length + sizeof(UNICODE_NULL);
709  DriverExtension->RegistryPath.Buffer =
711  PagedPool,
712  DriverExtension->RegistryPath.MaximumLength,
713  'RTSU');
714  if (DriverExtension->RegistryPath.Buffer == NULL)
715  {
716  RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL);
718  }
719 
721  INFO_(VIDEOPRT, "RegistryPath: %wZ\n", &DriverExtension->RegistryPath);
722  }
723  else
724  {
725  RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL);
726  }
727  }
728 
729  /* Copy the correct miniport initialization data to the device extension. */
730  RtlCopyMemory(&DriverExtension->InitializationData,
732  HwInitializationData->HwInitDataSize);
733  if (HwInitializationData->HwInitDataSize <
735  {
736  RtlZeroMemory((PVOID)((ULONG_PTR)&DriverExtension->InitializationData +
737  HwInitializationData->HwInitDataSize),
739  HwInitializationData->HwInitDataSize);
740  }
741  DriverExtension->HwContext = HwContext;
742 
743  /*
744  * Plug & Play drivers registers the device in AddDevice routine.
745  * For legacy drivers we must do it now.
746  */
747  if (LegacyDetection)
748  {
750 
752  {
753  /* Power management */
755  }
756 
759  NULL,
760  &DeviceObject);
761  if (!NT_SUCCESS(Status))
762  {
763  ERR_(VIDEOPRT, "IntVideoPortCreateAdapterDeviceObject returned 0x%x\n", Status);
764  return Status;
765  }
766 
768  if (NT_SUCCESS(Status))
770  else
771  ERR_(VIDEOPRT, "IntVideoPortFindAdapter returned 0x%x\n", Status);
772 
773  return Status;
774  }
775  else
776  {
781 
782  return STATUS_SUCCESS;
783  }
784 }
785 
786 /*
787  * @implemented
788  */
789 VOID
791  IN VIDEO_DEBUG_LEVEL DebugPrintLevel,
792  IN PCHAR DebugMessage,
793  ...)
794 {
795  va_list ap;
796 
797  va_start(ap, DebugMessage);
798  vDbgPrintEx(DPFLTR_IHVVIDEO_ID, DebugPrintLevel, DebugMessage, ap);
799  va_end(ap);
800 }
801 
802 /*
803  * @unimplemented
804  */
805 VOID
806 NTAPI
808  IN PVOID HwDeviceExtension,
811  IN ULONG UniqueId)
812 {
814 
815  INFO_(VIDEOPRT, "VideoPortLogError ErrorCode %d (0x%x) UniqueId %lu (0x%lx)\n",
816  ErrorCode, ErrorCode, UniqueId, UniqueId);
817  if (Vrp)
818  INFO_(VIDEOPRT, "Vrp->IoControlCode %lu (0x%lx)\n", Vrp->IoControlCode, Vrp->IoControlCode);
819 }
820 
821 /*
822  * @implemented
823  */
824 UCHAR
825 NTAPI
827 {
828  return KeGetCurrentIrql();
829 }
830 
832 {
837 
838 static
839 NTSTATUS
840 NTAPI
846  IN PVOID Context,
848 {
850 
851  INFO_(VIDEOPRT, "Found registry value for name %S: type %d, length %d\n",
853  return (*(CallbackContext->HwGetRegistryRoutine))(
854  CallbackContext->HwDeviceExtension,
855  CallbackContext->HwContext,
856  ValueName,
857  ValueData,
858  ValueLength);
859 }
860 
861 /*
862  * @unimplemented
863  */
864 
865 VP_STATUS
866 NTAPI
868  IN PVOID HwDeviceExtension,
870  IN UCHAR IsParameterFileName,
871  IN PMINIPORT_GET_REGISTRY_ROUTINE GetRegistryRoutine,
873 {
876  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
878 
879  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
880 
881  TRACE_(VIDEOPRT, "VideoPortGetRegistryParameters ParameterName %S, RegPath: %wZ\n",
882  ParameterName, &DeviceExtension->RegistryPath);
883 
884  Context.HwDeviceExtension = HwDeviceExtension;
885  Context.HwContext = HwContext;
886  Context.HwGetRegistryRoutine = GetRegistryRoutine;
887 
891 
893  DeviceExtension->RegistryPath.Buffer,
894  QueryTable,
895  &Context,
896  NULL);
897  if (!NT_SUCCESS(Status))
898  {
899  WARN_(VIDEOPRT, "VideoPortGetRegistryParameters could not find the "
900  "requested parameter\n");
902  }
903 
904  if (IsParameterFileName)
905  {
906  /* FIXME: need to read the contents of the file */
908  }
909 
910  return NO_ERROR;
911 }
912 
913 /*
914  * @implemented
915  */
916 VP_STATUS
917 NTAPI
919  IN PVOID HwDeviceExtension,
923 {
924  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
926 
927  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
928  TRACE_(VIDEOPRT, "VideoPortSetRegistryParameters ParameterName %S, RegPath: %wZ\n",
929  ValueName,
930  &DeviceExtension->RegistryPath);
933  DeviceExtension->RegistryPath.Buffer,
934  ValueName,
935  REG_BINARY,
936  ValueData,
937  ValueLength);
938  if (Status != NO_ERROR)
939  WARN_(VIDEOPRT, "VideoPortSetRegistryParameters error 0x%x\n", Status);
940 
941  return Status;
942 }
943 
944 /*
945  * @implemented
946  */
947 VP_STATUS
948 NTAPI
950  IN PVOID HwDeviceExtension,
951  OUT PULONG VgaStatus)
952 {
953  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
954 
955  TRACE_(VIDEOPRT, "VideoPortGetVgaStatus\n");
956 
957  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
959  {
960  if (DeviceExtension->AdapterInterfaceType == PCIBus)
961  {
962  /* VgaStatus: 0 == VGA not enabled, 1 == VGA enabled. */
963  /* Assumed for now */
964  *VgaStatus = 1;
965  return NO_ERROR;
966  }
967  }
968 
969  return ERROR_INVALID_FUNCTION;
970 }
971 
972 /*
973  * @implemented
974  */
975 PVOID
976 NTAPI
978  IN PVOID HwDeviceExtension,
979  IN PVOID Unused1,
980  IN ULONG Unused2,
981  IN ULONG Length)
982 {
983  static PVOID RomImageBuffer = NULL;
984  PKPROCESS CallingProcess;
986 
987  TRACE_(VIDEOPRT, "VideoPortGetRomImage(HwDeviceExtension 0x%X Length 0x%X)\n",
988  HwDeviceExtension, Length);
989 
990  /* If the length is zero then free the existing buffer. */
991  if (Length == 0)
992  {
993  if (RomImageBuffer != NULL)
994  {
995  ExFreePool(RomImageBuffer);
996  RomImageBuffer = NULL;
997  }
998  return NULL;
999  }
1000  else
1001  {
1002  /*
1003  * The DDK says we shouldn't use the legacy C0000 method but get the
1004  * rom base address from the corresponding pci or acpi register but
1005  * lets ignore that and use C0000 anyway. We have already mapped the
1006  * bios area into memory so we'll copy from there.
1007  */
1008 
1009  /* Copy the bios. */
1010  Length = min(Length, 0x10000);
1011  if (RomImageBuffer != NULL)
1012  {
1013  ExFreePool(RomImageBuffer);
1014  }
1015 
1016  RomImageBuffer = ExAllocatePool(PagedPool, Length);
1017  if (RomImageBuffer == NULL)
1018  {
1019  return NULL;
1020  }
1021 
1022  IntAttachToCSRSS(&CallingProcess, &ApcState);
1023  RtlCopyMemory(RomImageBuffer, (PUCHAR)0xC0000, Length);
1024  IntDetachFromCSRSS(&CallingProcess, &ApcState);
1025 
1026  return RomImageBuffer;
1027  }
1028 }
1029 
1030 /*
1031  * @implemented
1032  */
1033 BOOLEAN
1034 NTAPI
1036  IN PVOID HwDeviceExtension,
1037  IN PUCHAR RomBase,
1038  IN ULONG RomLength,
1039  IN PUCHAR String)
1040 {
1041  SIZE_T StringLength;
1042  BOOLEAN Found;
1043  PUCHAR SearchLocation;
1044 
1045  TRACE_(VIDEOPRT, "VideoPortScanRom RomBase %p RomLength 0x%x String %s\n", RomBase, RomLength, String);
1046 
1047  StringLength = strlen((PCHAR)String);
1048  Found = FALSE;
1049  for (SearchLocation = RomBase;
1050  !Found && SearchLocation < RomBase + RomLength - StringLength;
1051  SearchLocation++)
1052  {
1053  Found = (RtlCompareMemory(SearchLocation, String, StringLength) == StringLength);
1054  if (Found)
1055  {
1056  INFO_(VIDEOPRT, "Match found at %p\n", SearchLocation);
1057  }
1058  }
1059 
1060  return Found;
1061 }
1062 
1063 /*
1064  * @implemented
1065  */
1066 BOOLEAN
1067 NTAPI
1069  IN PVOID HwDeviceExtension,
1072  OUT PVOID Context)
1073 {
1074  BOOLEAN Ret;
1075  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1076  KIRQL OldIrql;
1077 
1078  switch (Priority)
1079  {
1080  case VpLowPriority:
1081  Ret = (*SynchronizeRoutine)(Context);
1082  break;
1083 
1084  case VpMediumPriority:
1085  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1086  if (DeviceExtension->InterruptObject == NULL)
1087  Ret = (*SynchronizeRoutine)(Context);
1088  else
1089  Ret = KeSynchronizeExecution(
1090  DeviceExtension->InterruptObject,
1092  Context);
1093  break;
1094 
1095  case VpHighPriority:
1097  if (OldIrql < SYNCH_LEVEL)
1099 
1100  Ret = (*SynchronizeRoutine)(Context);
1101 
1102  if (OldIrql < SYNCH_LEVEL)
1104  break;
1105 
1106  default:
1107  Ret = FALSE;
1108  }
1109 
1110  return Ret;
1111 }
1112 
1113 /*
1114  * @implemented
1115  */
1116 VP_STATUS
1117 NTAPI
1119  IN PVOID HwDeviceExtension,
1120  IN PVOID Reserved)
1121 {
1122  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1123  ULONG Status;
1124  VIDEO_CHILD_ENUM_INFO ChildEnumInfo;
1125  BOOLEAN bHaveLastMonitorID = FALSE;
1126  UCHAR LastMonitorID[10];
1127  ULONG Unused;
1128  UINT i;
1129  PDEVICE_OBJECT ChildDeviceObject;
1130  PVIDEO_PORT_CHILD_EXTENSION ChildExtension;
1131 
1132  INFO_(VIDEOPRT, "Starting child device probe\n");
1133  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1135  {
1136  WARN_(VIDEOPRT, "Miniport's HwGetVideoChildDescriptor is NULL!\n");
1137  return NO_ERROR;
1138  }
1139 
1140  if (!IsListEmpty(&DeviceExtension->ChildDeviceList))
1141  {
1142  ERR_(VIDEOPRT, "FIXME: Support calling VideoPortEnumerateChildren again!\n");
1143  return NO_ERROR;
1144  }
1145 
1146  /* Enumerate the children */
1147  for (i = 1; ; i++)
1148  {
1149  Status = IoCreateDevice(DeviceExtension->DriverObject,
1150  sizeof(VIDEO_PORT_CHILD_EXTENSION) +
1152  NULL,
1155  FALSE,
1156  &ChildDeviceObject);
1157  if (!NT_SUCCESS(Status))
1158  return Status;
1159 
1160  ChildExtension = ChildDeviceObject->DeviceExtension;
1161 
1162  RtlZeroMemory(ChildExtension,
1163  sizeof(VIDEO_PORT_CHILD_EXTENSION) +
1165 
1166  ChildExtension->Common.Fdo = FALSE;
1167  ChildExtension->ChildId = i;
1168  ChildExtension->PhysicalDeviceObject = ChildDeviceObject;
1169  ChildExtension->DriverObject = DeviceExtension->DriverObject;
1170 
1171  /* Setup the ChildEnumInfo */
1172  ChildEnumInfo.Size = sizeof(ChildEnumInfo);
1173  ChildEnumInfo.ChildDescriptorSize = sizeof(ChildExtension->ChildDescriptor);
1174  ChildEnumInfo.ACPIHwId = 0;
1175 
1177  ChildEnumInfo.ChildHwDeviceExtension = VIDEO_PORT_GET_CHILD_EXTENSION(ChildExtension);
1178  else
1179  ChildEnumInfo.ChildHwDeviceExtension = NULL;
1180 
1181  ChildEnumInfo.ChildIndex = ChildExtension->ChildId;
1182 
1183  INFO_(VIDEOPRT, "Probing child: %d\n", ChildEnumInfo.ChildIndex);
1185  HwDeviceExtension,
1186  &ChildEnumInfo,
1187  &ChildExtension->ChildType,
1188  ChildExtension->ChildDescriptor,
1189  &ChildExtension->ChildId,
1190  &Unused);
1192  {
1193  if (ChildExtension->ChildType == Monitor)
1194  {
1195  // Check if the EDID is valid
1196  if (ChildExtension->ChildDescriptor[0] == 0x00 &&
1197  ChildExtension->ChildDescriptor[1] == 0xFF &&
1198  ChildExtension->ChildDescriptor[2] == 0xFF &&
1199  ChildExtension->ChildDescriptor[3] == 0xFF &&
1200  ChildExtension->ChildDescriptor[4] == 0xFF &&
1201  ChildExtension->ChildDescriptor[5] == 0xFF &&
1202  ChildExtension->ChildDescriptor[6] == 0xFF &&
1203  ChildExtension->ChildDescriptor[7] == 0x00)
1204  {
1205  if (bHaveLastMonitorID)
1206  {
1207  // Compare the previous monitor ID with the current one, break the loop if they are identical
1208  if (RtlCompareMemory(LastMonitorID, &ChildExtension->ChildDescriptor[8], sizeof(LastMonitorID)) == sizeof(LastMonitorID))
1209  {
1210  INFO_(VIDEOPRT, "Found identical Monitor ID two times, stopping enumeration\n");
1211  IoDeleteDevice(ChildDeviceObject);
1212  break;
1213  }
1214  }
1215 
1216  // Copy 10 bytes from the EDID, which can be used to uniquely identify the monitor
1217  RtlCopyMemory(LastMonitorID, &ChildExtension->ChildDescriptor[8], sizeof(LastMonitorID));
1218  bHaveLastMonitorID = TRUE;
1219 
1220  /* Mark it valid */
1221  ChildExtension->EdidValid = TRUE;
1222  }
1223  else
1224  {
1225  /* Mark it invalid */
1226  ChildExtension->EdidValid = FALSE;
1227  // FIXME: the following break workarounds CORE-16695
1228  // but prevents graphic cards to return an invalid
1229  // EDID as first child, and a valid one as second child.
1230  break;
1231  }
1232  }
1233  }
1234  else if (Status == VIDEO_ENUM_INVALID_DEVICE)
1235  {
1236  WARN_(VIDEOPRT, "Child device %d is invalid!\n", ChildEnumInfo.ChildIndex);
1237  IoDeleteDevice(ChildDeviceObject);
1238  continue;
1239  }
1240  else if (Status == VIDEO_ENUM_NO_MORE_DEVICES)
1241  {
1242  INFO_(VIDEOPRT, "End of child enumeration! (%d children enumerated)\n", i - 1);
1243  IoDeleteDevice(ChildDeviceObject);
1244  break;
1245  }
1246  else
1247  {
1248  WARN_(VIDEOPRT, "HwGetVideoChildDescriptor returned unknown status code 0x%x!\n", Status);
1249  IoDeleteDevice(ChildDeviceObject);
1250  break;
1251  }
1252 
1253  if (ChildExtension->ChildType == Monitor)
1254  {
1255  UINT j;
1256  PUCHAR p = ChildExtension->ChildDescriptor;
1257  INFO_(VIDEOPRT, "Monitor device enumerated! (ChildId = 0x%x)\n", ChildExtension->ChildId);
1258  for (j = 0; j < sizeof (ChildExtension->ChildDescriptor); j += 8)
1259  {
1260  INFO_(VIDEOPRT, "%02x %02x %02x %02x %02x %02x %02x %02x\n",
1261  p[j + 0], p[j + 1], p[j + 2], p[j + 3],
1262  p[j + 4], p[j + 5], p[j + 6], p[j + 7]);
1263  }
1264  }
1265  else if (ChildExtension->ChildType == Other)
1266  {
1267  INFO_(VIDEOPRT, "\"Other\" device enumerated: DeviceId = %S\n", (PWSTR)ChildExtension->ChildDescriptor);
1268  }
1269  else
1270  {
1271  ERR_(VIDEOPRT, "HwGetVideoChildDescriptor returned unsupported type: %d\n", ChildExtension->ChildType);
1272  }
1273 
1274  /* Clear the init flag */
1275  ChildDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
1276 
1277  InsertTailList(&DeviceExtension->ChildDeviceList,
1278  &ChildExtension->ListEntry);
1279  }
1280 
1281  /* Trigger reenumeration by the PnP manager */
1283 
1284  return NO_ERROR;
1285 }
1286 
1287 /*
1288  * @unimplemented
1289  */
1290 VP_STATUS
1291 NTAPI
1293  IN PVOID HwDeviceExtension,
1294  IN OUT PVOID *SecondaryDeviceExtension,
1295  IN ULONG Flag)
1296 {
1297  UNIMPLEMENTED;
1298  return ERROR_DEV_NOT_EXIST;
1299 }
1300 
1301 /*
1302  * @implemented
1303  */
1304 BOOLEAN
1305 NTAPI
1307  IN PVOID HwDeviceExtension,
1309  IN PVOID Context)
1310 {
1311  return KeInsertQueueDpc(
1312  &VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension)->DpcObject,
1314  (PVOID)Context);
1315 }
1316 
1317 /*
1318  * @implemented
1319  */
1320 PVOID
1321 NTAPI
1324 {
1325  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1326 
1327  TRACE_(VIDEOPRT, "VideoPortGetAssociatedDeviceExtension\n");
1328  DeviceExtension = ((PDEVICE_OBJECT)DeviceObject)->DeviceExtension;
1329  if (!DeviceExtension)
1330  return NULL;
1331  return DeviceExtension->MiniPortDeviceExtension;
1332 }
1333 
1334 /*
1335  * @implemented
1336  */
1337 VP_STATUS
1338 NTAPI
1340  IN PVOID HwDeviceExtension,
1341  IN OUT PVPOSVERSIONINFO VpOsVersionInfo)
1342 {
1344 
1345  Version.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
1346  if (VpOsVersionInfo->Size >= sizeof(VPOSVERSIONINFO))
1347  {
1348 #if 1
1350  {
1351  VpOsVersionInfo->MajorVersion = Version.dwMajorVersion;
1352  VpOsVersionInfo->MinorVersion = Version.dwMinorVersion;
1353  VpOsVersionInfo->BuildNumber = Version.dwBuildNumber;
1354  VpOsVersionInfo->ServicePackMajor = Version.wServicePackMajor;
1355  VpOsVersionInfo->ServicePackMinor = Version.wServicePackMinor;
1356  return NO_ERROR;
1357  }
1358  return ERROR_INVALID_PARAMETER;
1359 #else
1360  VpOsVersionInfo->MajorVersion = 5;
1361  VpOsVersionInfo->MinorVersion = 0;
1362  VpOsVersionInfo->BuildNumber = 2195;
1363  VpOsVersionInfo->ServicePackMajor = 4;
1364  VpOsVersionInfo->ServicePackMinor = 0;
1365  return NO_ERROR;
1366 #endif
1367  }
1368 
1369  return ERROR_INVALID_PARAMETER;
1370 }
1371 
1372 /*
1373  * @implemented
1374  */
1375 BOOLEAN
1376 NTAPI
1378  IN PVOID HwDeviceExtension,
1379  IN USHORT VendorId,
1380  IN USHORT DeviceId,
1381  IN UCHAR RevisionId,
1382  IN USHORT SubVendorId,
1383  IN USHORT SubSystemId,
1384  IN ULONG Flags)
1385 {
1386  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1389  IO_STACK_LOCATION IoStack;
1390  ULONG PciFlags = 0;
1391  NTSTATUS Status;
1392  BOOL DevicePresent;
1393 
1394  TRACE_(VIDEOPRT, "VideoPortCheckForDeviceExistence\n");
1395 
1397  {
1398  WARN_(VIDEOPRT, "VideoPortCheckForDeviceExistence: Unknown flags 0x%lx\n", Flags & ~(CDE_USE_REVISION | CDE_USE_SUBSYSTEM_IDS));
1399  return FALSE;
1400  }
1401 
1402  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1403 
1405  PciDevicePresentInterface.Version = 1;
1407  IoStack.Parameters.QueryInterface.Version = PciDevicePresentInterface.Version;
1409  IoStack.Parameters.QueryInterface.InterfaceType =
1410  &GUID_PCI_DEVICE_PRESENT_INTERFACE;
1411  Status = IopInitiatePnpIrp(DeviceExtension->NextDeviceObject,
1413  if (!NT_SUCCESS(Status))
1414  {
1415  WARN_(VIDEOPRT, "IopInitiatePnpIrp() failed! (Status 0x%lx)\n", Status);
1416  return FALSE;
1417  }
1418 
1419  if (Flags & CDE_USE_REVISION)
1420  PciFlags |= PCI_USE_REVISION;
1422  PciFlags |= PCI_USE_SUBSYSTEM_IDS;
1423 
1424  DevicePresent = PciDevicePresentInterface.IsDevicePresent(
1425  VendorId, DeviceId, RevisionId,
1426  SubVendorId, SubSystemId, PciFlags);
1427 
1428  PciDevicePresentInterface.InterfaceDereference(PciDevicePresentInterface.Context);
1429 
1430  return DevicePresent;
1431 }
1432 
1433 /*
1434  * @unimplemented
1435  */
1436 VP_STATUS
1437 NTAPI
1439  IN PVOID HwDeviceExtension,
1440  IN ULONG BugcheckCode,
1442  IN ULONG BugcheckDataSize)
1443 {
1444  UNIMPLEMENTED;
1445  return NO_ERROR;
1446 }
1447 
1448 /*
1449  * @implemented
1450  */
1451 LONGLONG
1452 NTAPI
1454  IN PVOID HwDeviceExtension,
1455  OUT PLONGLONG PerformanceFrequency OPTIONAL)
1456 {
1458 
1459  TRACE_(VIDEOPRT, "VideoPortQueryPerformanceCounter\n");
1460  Result = KeQueryPerformanceCounter((PLARGE_INTEGER)PerformanceFrequency);
1461  return Result.QuadPart;
1462 }
1463 
1464 /*
1465  * @implemented
1466  */
1467 VOID
1468 NTAPI
1470  IN PVOID HwDeviceExtension)
1471 {
1472  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1473  NTSTATUS Status;
1474 
1476 
1477  TRACE_(VIDEOPRT, "VideoPortAcquireDeviceLock\n");
1478  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1479  Status = KeWaitForMutexObject(&DeviceExtension->DeviceLock, Executive,
1480  KernelMode, FALSE, NULL);
1481  // ASSERT(Status == STATUS_SUCCESS);
1482 }
1483 
1484 /*
1485  * @implemented
1486  */
1487 VOID
1488 NTAPI
1490  IN PVOID HwDeviceExtension)
1491 {
1492  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1493  LONG Status;
1494 
1496 
1497  TRACE_(VIDEOPRT, "VideoPortReleaseDeviceLock\n");
1498  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1499  Status = KeReleaseMutex(&DeviceExtension->DeviceLock, FALSE);
1500  //ASSERT(Status == STATUS_SUCCESS);
1501 }
1502 
1503 /*
1504  * @unimplemented
1505  */
1506 VOID
1507 NTAPI
1510  IN PVOID Data)
1511 {
1512  UNIMPLEMENTED;
1513 }
1514 
1515 /*
1516  * @implemented
1517  */
1518 PVOID
1519 NTAPI
1521  IN PVOID HwDeviceExtension,
1524 )
1525 {
1527 }
1528 
1529 /*
1530  * @implemented
1531  */
1532 BOOLEAN
1533 NTAPI
1535 {
1536  return VpNoVesa;
1537 }
VOID FASTCALL IntLoadRegistryParameters(VOID)
Definition: videoprt.c:464
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
NTSTATUS NTAPI IntVideoPortFindAdapter(IN PDRIVER_OBJECT DriverObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, IN PDEVICE_OBJECT DeviceObject)
Definition: videoprt.c:252
#define STATUS_REVISION_MISMATCH
Definition: ntstatus.h:311
signed char * PCHAR
Definition: retypes.h:7
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
PVOID NTAPI IntVideoPortImageDirectoryEntryToData(PVOID BaseAddress, ULONG Directory)
Definition: videoprt.c:56
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ typedef _In_ PVOID Unused
Definition: iotypes.h:1129
#define ASSERT_IRQL_LESS_OR_EQUAL(x)
Definition: debug.h:251
_In_ PCWSTR _Inout_ _At_ QueryTable _Pre_unknown_ PRTL_QUERY_REGISTRY_TABLE QueryTable
Definition: rtlfuncs.h:4050
#define IN
Definition: typedefs.h:39
VOID NTAPI VpNotifyEaData(IN PDEVICE_OBJECT DeviceObject, IN PVOID Data)
Definition: videoprt.c:1508
NTSTATUS NTAPI IntVideoPortDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:1115
LARGE_INTEGER NTAPI KeQueryPerformanceCounter(IN PLARGE_INTEGER PerformanceFreq)
Definition: timer.c:138
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define TAG_VIDEO_PORT
Definition: videoprt.h:38
NTSTATUS NTAPI IntVideoPortCreateAdapterDeviceObject(_In_ PDRIVER_OBJECT DriverObject, _In_ PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, _In_opt_ PDEVICE_OBJECT PhysicalDeviceObject, _Out_opt_ PDEVICE_OBJECT *DeviceObject)
Definition: videoprt.c:92
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
KAPC_STATE
Definition: ketypes.h:1273
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:361
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define PCI_MAX_BRIDGE_NUMBER
Definition: iotypes.h:3244
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
PDEVICE_OBJECT FunctionalDeviceObject
Definition: videoprt.h:88
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
VIDEO_CHILD_TYPE ChildType
Definition: videoprt.h:118
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR _In_ ULONGLONG _In_ ULONGLONG _In_opt_ PEVENT_FILTER_DESCRIPTOR _Inout_opt_ PVOID CallbackContext
Definition: wmitypes.h:55
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntddk_ex.h:178
NTSTATUS NTAPI IntCreateNewRegistryPath(PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: registry.c:357
VOID NTAPI IntVideoPortDeferredRoutine(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: videoprt.c:79
BOOLEAN VpBaseVideo
Definition: videoprt.c:34
NTSTATUS NTAPI RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
Definition: version.c:158
#define INFO_(ch,...)
Definition: debug.h:159
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
NTSTATUS NTAPI IoAllocateDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress, IN ULONG DriverObjectExtensionSize, OUT PVOID *DriverObjectExtension)
Definition: driver.c:1779
#define KeWaitForMutexObject
Definition: kefuncs.h:555
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor
Definition: video.h:677
VIDEO_PORT_DRIVER_EXTENSION * DriverExtension
Definition: videoprt.h:103
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define IRP_MJ_SHUTDOWN
#define REG_BINARY
Definition: nt_native.h:1496
PVOID NTAPI VideoPortAllocateContiguousMemory(IN PVOID HwDeviceExtension, IN ULONG NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: videoprt.c:1520
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
struct _DEVICE_OBJECT * PDEVICE_OBJECT
uint16_t * PWSTR
Definition: typedefs.h:55
VIDEO_HW_INITIALIZATION_DATA InitializationData
Definition: videoprt.h:72
unsigned char * PUCHAR
Definition: retypes.h:3
BOOLEAN NTAPI VideoPortScanRom(IN PVOID HwDeviceExtension, IN PUCHAR RomBase, IN ULONG RomLength, IN PUCHAR String)
Definition: videoprt.c:1035
BOOLEAN NTAPI IntVideoPortSetupTimer(IN PDEVICE_OBJECT DeviceObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension)
Definition: timer.c:43
_In_ PCWSTR _In_z_ PCWSTR _In_ ULONG ValueType
Definition: rtlfuncs.h:4062
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:140
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define ERR_(ch,...)
Definition: debug.h:156
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dpc.c:724
LONG NTSTATUS
Definition: precomp.h:26
PVOID NTAPI VideoPortGetAssociatedDeviceExtension(IN PVOID DeviceObject)
Definition: videoprt.c:1322
_In_ KPRIORITY Priority
Definition: kefuncs.h:503
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA _In_ PVOID HwContext
Definition: srb.h:664
struct _VIDEO_PORT_DEVICE_EXTENSTION * PVIDEO_PORT_DEVICE_EXTENSION
VP_STATUS NTAPI VideoPortGetVersion(IN PVOID HwDeviceExtension, IN OUT PVPOSVERSIONINFO VpOsVersionInfo)
Definition: videoprt.c:1339
VP_STATUS NTAPI VideoPortRegisterBugcheckCallback(IN PVOID HwDeviceExtension, IN ULONG BugcheckCode, IN PVIDEO_BUGCHECK_CALLBACK Callback, IN ULONG BugcheckDataSize)
Definition: videoprt.c:1438
KMUTEX VideoPortInt10Mutex
Definition: videoprt.c:39
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
struct QueryRegistryCallbackContext QUERY_REGISTRY_CALLBACK_CONTEXT
ULONG ChildDescriptorSize
Definition: video.h:262
static WCHAR String[]
Definition: stringtable.c:55
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:137
LIST_ENTRY AddressMappingListHead
Definition: videoprt.h:101
PKPROCESS CsrProcess
Definition: videoprt.c:37
BOOLEAN NTAPI VideoPortSynchronizeExecution(IN PVOID HwDeviceExtension, IN VIDEO_SYNCHRONIZE_PRIORITY Priority, IN PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine, OUT PVOID Context)
Definition: videoprt.c:1068
NTSTATUS NTAPI IntSetupDeviceSettingsKey(PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: registry.c:296
struct _PCI_DEVICE_PRESENT_INTERFACE PCI_DEVICE_PRESENT_INTERFACE
uint16_t * PWCHAR
Definition: typedefs.h:55
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1155
WCHAR DeviceName[]
Definition: adapter.cpp:21
#define InsertTailList(ListHead, Entry)
NTSTATUS NTAPI IntVideoPortDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:714
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
Definition: mutex.c:189
#define NO_ERROR
Definition: dderror.h:5
#define FASTCALL
Definition: nt_native.h:50
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
BOOLEAN(NTAPI * PMINIPORT_SYNCHRONIZE_ROUTINE)(IN PVOID Context)
Definition: video.h:523
VP_STATUS NTAPI VideoPortSetRegistryParameters(IN PVOID HwDeviceExtension, IN PWSTR ValueName, IN PVOID ValueData, IN ULONG ValueLength)
Definition: videoprt.c:918
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
LONGLONG NTAPI VideoPortQueryPerformanceCounter(IN PVOID HwDeviceExtension, OUT PLONGLONG PerformanceFrequency OPTIONAL)
Definition: videoprt.c:1453
struct TraceInfo Info
#define _In_opt_
Definition: no_sal2.h:213
#define PCI_USE_REVISION
Definition: iotypes.h:835
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:324
static USHORT USHORT * NewLength
uint32_t ULONG_PTR
Definition: typedefs.h:64
INTERFACE_TYPE AdapterInterfaceType
Definition: video.h:169
__GNU_EXTENSION typedef __int64 * PLONGLONG
Definition: ntbasedef.h:389
UCHAR KIRQL
Definition: env_spec_w32.h:591
_Must_inspect_result_ _In_ PFLT_GET_OPERATION_STATUS_CALLBACK CallbackRoutine
Definition: fltkernel.h:1035
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
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
struct QueryRegistryCallbackContext * PQUERY_REGISTRY_CALLBACK_CONTEXT
PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine
Definition: nt_native.h:109
PVOID NTAPI IntVideoPortGetProcAddress(IN PVOID HwDeviceExtension, IN PUCHAR FunctionName)
Definition: funclist.c:100
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:109
#define va_end(ap)
Definition: acmsvcex.h:90
#define UNICODE_NULL
#define CDE_USE_REVISION
Definition: video.h:147
VOID NTAPI KeStackAttachProcess(IN PKPROCESS Process, OUT PRKAPC_STATE ApcState)
Definition: procobj.c:701
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG, PCWSTR, PCWSTR, ULONG, PVOID, ULONG)
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:87
UCHAR NTAPI VideoPortGetCurrentIrql(VOID)
Definition: videoprt.c:826
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
PDRIVER_EXTENSION DriverExtension
Definition: iotypes.h:2174
VOID NTAPI IntVideoPortUnload(PDRIVER_OBJECT DriverObject)
Definition: dispatch.c:1171
VP_STATUS NTAPI VideoPortEnumerateChildren(IN PVOID HwDeviceExtension, IN PVOID Reserved)
Definition: videoprt.c:1118
#define PsGetCurrentProcess
Definition: psfuncs.h:17
#define VIDEO_PORT_GET_CHILD_EXTENSION(MiniportExtension)
Definition: videoprt.h:131
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
NTSYSAPI NTSTATUS NTAPI ZwQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
VIDEO_PORT_COMMON_EXTENSION Common
Definition: videoprt.h:115
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
_In_ PCWSTR _Inout_ _At_ QueryTable EntryContext
Definition: rtlfuncs.h:4050
smooth NULL
Definition: ftsmooth.c:416
struct _OSVERSIONINFOEXW RTL_OSVERSIONINFOEXW
PVIDEO_PORT_GET_PROC_ADDRESS VideoPortGetProcAddress
Definition: video.h:193
VOID NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
Definition: irq.c:140
struct _VIDEO_HW_INITIALIZATION_DATA VIDEO_HW_INITIALIZATION_DATA
_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:426
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
KSPIN_LOCK HwResetAdaptersLock
Definition: videoprt.c:40
char * va_list
Definition: acmsvcex.h:78
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:2083
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
#define VIDEO_ENUM_MORE_DEVICES
Definition: video.h:139
return Found
Definition: dirsup.c:1270
struct _INTERFACE * PINTERFACE
NTSTATUS NTAPI IntVideoPortDispatchClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:429
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:123
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:841
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
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
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:675
#define KEY_WRITE
Definition: nt_native.h:1031
#define TRACE_(x)
Definition: compat.h:66
int64_t LONGLONG
Definition: typedefs.h:67
#define _Out_opt_
Definition: no_sal2.h:339
ULONGLONG SystemMemorySize
Definition: video.h:195
#define CDE_USE_SUBSYSTEM_IDS
Definition: video.h:146
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_In_ LARGE_INTEGER _In_opt_ PKDPC Dpc
Definition: kefuncs.h:511
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
VP_STATUS NTAPI VideoPortGetVgaStatus(IN PVOID HwDeviceExtension, OUT PULONG VgaStatus)
Definition: videoprt.c:949
_In_ PKSYNCHRONIZE_ROUTINE SynchronizeRoutine
Definition: kefuncs.h:536
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FILE_DEVICE_VIDEO
Definition: winioctl.h:140
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
ULONG NTAPI DriverEntry(IN PVOID Context1, IN PVOID Context2)
Definition: videoprt.c:47
#define SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA
Definition: video.h:119
Definition: video.h:273
SYSTEM_BASIC_INFORMATION SystemBasicInfo
Definition: perfdata.c:45
NTSTATUS NTAPI IntCreateRegistryPath(IN PCUNICODE_STRING DriverRegistryPath, OUT PUNICODE_STRING DeviceRegistryPath)
Definition: registry.c:532
#define swprintf(buf, format,...)
Definition: sprintf.c:56
Definition: xml2sdb.h:79
VOID NTAPI VideoPortLogError(IN PVOID HwDeviceExtension, IN PVIDEO_REQUEST_PACKET Vrp OPTIONAL, IN VP_STATUS ErrorCode, IN ULONG UniqueId)
Definition: videoprt.c:807
_In_ GUID _In_ PVOID ValueData
Definition: hubbusif.h:311
NTSTATUS NTAPI IntVideoPortDispatchSystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:1149
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
BOOL Error
Definition: chkdsk.c:66
#define IRP_MN_QUERY_INTERFACE
NTSYSAPI ULONG NTAPI vDbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ PCCH Format, _In_ va_list ap)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
struct _VIDEO_PORT_CONFIG_INFO VIDEO_PORT_CONFIG_INFO
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG _In_ ULONG SlotNumber
Definition: halfuncs.h:156
BOOLEAN VpNoVesa
Definition: videoprt.c:35
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3376
VOID NTAPI KeInitializeMutex(IN PKMUTEX Mutex, IN ULONG Level)
Definition: mutex.c:67
#define IRP_MJ_POWER
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
VIDEO_SYNCHRONIZE_PRIORITY
Definition: video.h:534
static const WCHAR L[]
Definition: oid.c:1250
PWSTR DriverRegistryPath
Definition: video.h:194
NTSTATUS NTAPI IntVideoPortAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
Definition: dispatch.c:334
VOID(NTAPI * PMINIPORT_DPC_ROUTINE)(IN PVOID HwDeviceExtension, IN PVOID Context)
Definition: video.h:518
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
Definition: ketypes.h:687
PDRIVER_UNLOAD DriverUnload
Definition: iotypes.h:2180
_In_ GUID _In_ PVOID _In_ ULONG ValueLength
Definition: hubbusif.h:311
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
VOID NTAPI VideoPortAcquireDeviceLock(IN PVOID HwDeviceExtension)
Definition: videoprt.c:1469
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1857
_Out_ PNDIS_HANDLE _Out_ PUINT _In_ PNDIS_STRING _In_ NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress
Definition: ndis.h:3227
PDEVICE_OBJECT NextDeviceObject
Definition: videoprt.h:89
#define SYNCH_LEVEL
Definition: env_spec_w32.h:704
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define RTL_REGISTRY_ABSOLUTE
Definition: nt_native.h:161
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
#define IRP_MJ_SYSTEM_CONTROL
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT _In_ PTDI_PNP_CONTEXT Context2
Definition: tdikrnl.h:1094
Status
Definition: gdiplustypes.h:24
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:86
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
struct _VIDEO_PORT_DEVICE_EXTENSTION VIDEO_PORT_DEVICE_EXTENSION
#define _In_
Definition: no_sal2.h:204
VOID VideoPortDebugPrint(IN VIDEO_DEBUG_LEVEL DebugPrintLevel, IN PCHAR DebugMessage,...)
Definition: videoprt.c:790
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
ULONG_PTR SIZE_T
Definition: typedefs.h:79
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
PDRIVER_ADD_DEVICE AddDevice
Definition: iotypes.h:2112
VOID(NTAPI * PVIDEO_BUGCHECK_CALLBACK)(IN PVOID HwDeviceExtension, IN ULONG BugcheckCode, IN PUCHAR Buffer, IN ULONG BufferSize)
Definition: video.h:527
VOID NTAPI IoInvalidateDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE Type)
Definition: pnpmgr.c:2473
PRTL_UNICODE_STRING_BUFFER Path
Definition: video.h:270
VOID FASTCALL IntAttachToCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState)
Definition: videoprt.c:439
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
ULONG VideoPortDeviceNumber
Definition: videoprt.c:38
unsigned short USHORT
Definition: pedump.c:61
struct _KPROCESS * PKPROCESS
Definition: wdm.template.h:199
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
VOID NTAPI KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
Definition: procobj.c:753
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
_In_opt_ PWSTR _In_ PWSTR ParameterName
Definition: classpnp.h:1209
BOOLEAN NTAPI IntVideoPortSetupInterrupt(IN PDEVICE_OBJECT DeviceObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, IN PVIDEO_PORT_CONFIG_INFO ConfigInfo)
Definition: interrupt.c:45
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1492
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT Context1
Definition: tdikrnl.h:1094
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
ULONG NTAPI VideoPortInitialize(IN PVOID Context1, IN PVOID Context2, IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData, IN PVOID HwContext)
Definition: videoprt.c:588
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
unsigned int * PULONG
Definition: retypes.h:1
BOOLEAN NTAPI VideoPortIsNoVesa(VOID)
Definition: videoprt.c:1534
#define min(a, b)
Definition: monoChain.cc:55
#define va_start(ap, A)
Definition: acmsvcex.h:91
unsigned int UINT
Definition: ndis.h:50
PVOID NTAPI MmAllocateContiguousMemory(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: contmem.c:626
VIDEO_PORT_COMMON_EXTENSION Common
Definition: videoprt.h:84
#define RtlImageNtHeader
Definition: compat.h:466
NTSTATUS NTAPI IntVideoPortDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:1083
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
#define OUT
Definition: typedefs.h:40
NTSTATUS NTAPI IntVideoPortDispatchOpen(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:366
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2181
VIDEO_DEBUG_LEVEL
Definition: video.h:579
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:124
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:998
VOID FASTCALL IntDetachFromCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState)
Definition: videoprt.c:452
struct tagContext Context
Definition: acpixf.h:1034
unsigned int ULONG
Definition: retypes.h:1
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
base for all directory entries
Definition: entries.h:138
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define UNIMPLEMENTED
Definition: debug.h:115
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ULONG_PTR
Definition: config.h:101
RTL_STATIC_LIST_HEAD(HwResetAdaptersList)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:28
BOOLEAN NTAPI KeSynchronizeExecution(IN OUT PKINTERRUPT Interrupt, IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, IN PVOID SynchronizeContext OPTIONAL)
Definition: interrupt.c:142
LIST_ENTRY HwResetAdaptersList
LONG VP_STATUS
Definition: video.h:153
UNICODE_STRING RegistryPath
Definition: videoprt.h:90
PVOID ChildHwDeviceExtension
Definition: video.h:265
PCI_INTERFACE PciDevicePresentInterface
Definition: devhere.c:18
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
PVOID NTAPI VideoPortGetRomImage(IN PVOID HwDeviceExtension, IN PVOID Unused1, IN ULONG Unused2, IN ULONG Length)
Definition: videoprt.c:977
#define SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA
Definition: video.h:120
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
_In_ PCHAR _In_ ULONG DeviceNumber
Definition: classpnp.h:1036
GLfloat GLfloat p
Definition: glext.h:8902
#define RTL_REGISTRY_DEVICEMAP
Definition: nt_native.h:165
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:711
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:867
_In_ BOOLEAN _In_ USHORT Directory
Definition: rtlfuncs.h:3780
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:98
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define RTL_QUERY_REGISTRY_REQUIRED
Definition: nt_native.h:132
#define REG_DWORD
Definition: sdbapi.c:596
LPFNPSPCALLBACK Callback
Definition: desk.c:112
#define VIDEO_ENUM_NO_MORE_DEVICES
Definition: video.h:140
NTSTATUS NTAPI IopInitiatePnpIrp(IN PDEVICE_OBJECT DeviceObject, IN PIO_STATUS_BLOCK IoStatusBlock, IN UCHAR MinorFunction, IN PIO_STACK_LOCATION Stack)
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
#define WARN_(ch,...)
Definition: debug.h:157
BOOLEAN NTAPI VideoPortQueueDpc(IN PVOID HwDeviceExtension, IN PMINIPORT_DPC_ROUTINE CallbackRoutine, IN PVOID Context)
Definition: videoprt.c:1306
PMINIPORT_GET_REGISTRY_ROUTINE HwGetRegistryRoutine
Definition: videoprt.c:835
VP_STATUS NTAPI VideoPortCreateSecondaryDisplay(IN PVOID HwDeviceExtension, IN OUT PVOID *SecondaryDeviceExtension, IN ULONG Flag)
Definition: videoprt.c:1292
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
* PKAPC_STATE
Definition: ketypes.h:1273
ULONG BusInterruptVector
Definition: video.h:171
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA * HwInitializationData
Definition: srb.h:664
#define PCI_USE_SUBSYSTEM_IDS
Definition: iotypes.h:834
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:1377
KINTERRUPT_MODE InterruptMode
Definition: video.h:172
VOID NTAPI VideoPortReleaseDeviceLock(IN PVOID HwDeviceExtension)
Definition: videoprt.c:1489
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define VIDEO_ENUM_INVALID_DEVICE
Definition: video.h:141
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define REG_SZ
Definition: layer.c:22
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:675