ReactOS  0.4.15-dev-2704-gd5265b0
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 
44 
45 /* PRIVATE FUNCTIONS **********************************************************/
46 
47 ULONG
48 NTAPI
52 {
53  return STATUS_SUCCESS;
54 }
55 
56 PVOID
57 NTAPI
61 {
62  PIMAGE_NT_HEADERS NtHeader;
63  ULONG Va;
64 
65  NtHeader = RtlImageNtHeader(BaseAddress);
66  if (NtHeader == NULL)
67  return NULL;
68 
70  return NULL;
71 
73  if (Va == 0)
74  return NULL;
75 
76  return (PVOID)((ULONG_PTR)BaseAddress + Va);
77 }
78 
79 VOID
80 NTAPI
82  IN PKDPC Dpc,
86 {
87  PVOID HwDeviceExtension =
88  &((PVIDEO_PORT_DEVICE_EXTENSION)DeferredContext)->MiniPortDeviceExtension;
90 }
91 
93 NTAPI
99 {
100  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
102  ULONG PciSlotNumber;
104  ULONG Size;
106  WCHAR DeviceBuffer[20];
108  PDEVICE_OBJECT DeviceObject_;
109 
110  if (DeviceObject == NULL)
111  DeviceObject = &DeviceObject_;
112 
113  /*
114  * Find the first free device number that can be used for video device
115  * object names and symlinks.
116  */
118  if (DeviceNumber == 0xFFFFFFFF)
119  {
120  WARN_(VIDEOPRT, "Can't find free device number\n");
121  return STATUS_UNSUCCESSFUL;
122  }
123 
124  /*
125  * Create the device object.
126  */
127 
128  /* Create a unicode device name. */
129  swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
130  RtlInitUnicodeString(&DeviceName, DeviceBuffer);
131 
132  INFO_(VIDEOPRT, "HwDeviceExtension size is: 0x%x\n",
133  DriverExtension->InitializationData.HwDeviceExtensionSize);
134 
135  /* Create the device object. */
137  DriverExtension->InitializationData.HwDeviceExtensionSize;
139  Size,
140  &DeviceName,
142  0,
143  TRUE,
144  DeviceObject);
145 
146  if (!NT_SUCCESS(Status))
147  {
148  WARN_(VIDEOPRT, "IoCreateDevice call failed with status 0x%08x\n", Status);
149  return Status;
150  }
151 
152  /*
153  * Set the buffering strategy here. If you change this, remember
154  * to change VidDispatchDeviceControl too.
155  */
156 
157  (*DeviceObject)->Flags |= DO_BUFFERED_IO;
158 
159  /* Initialize device extension. */
160  DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)((*DeviceObject)->DeviceExtension);
161  DeviceExtension->Common.Fdo = TRUE;
162  DeviceExtension->DeviceNumber = DeviceNumber;
163  DeviceExtension->DriverObject = DriverObject;
164  DeviceExtension->PhysicalDeviceObject = PhysicalDeviceObject;
165  DeviceExtension->FunctionalDeviceObject = *DeviceObject;
166  DeviceExtension->DriverExtension = DriverExtension;
167  DeviceExtension->SessionId = -1;
168 
169  InitializeListHead(&DeviceExtension->ChildDeviceList);
170 
171  /* Get the registry path associated with this device. */
173  DriverExtension->InitializationData.StartingDeviceNumber,
174  &DeviceExtension->RegistryPath);
175  if (!NT_SUCCESS(Status))
176  {
177  WARN_(VIDEOPRT, "IntCreateRegistryPath() call failed with status 0x%08x\n", Status);
179  *DeviceObject = NULL;
180  return Status;
181  }
182 
183  if (PhysicalDeviceObject != NULL)
184  {
185  /* Get bus number from the upper level bus driver. */
186  Size = sizeof(ULONG);
189  Size,
190  &DeviceExtension->SystemIoBusNumber,
191  &Size);
192  if (!NT_SUCCESS(Status))
193  {
194  WARN_(VIDEOPRT, "Couldn't get an information from bus driver. We will try to\n"
195  "use legacy detection method, but even that doesn't mean that\n"
196  "it will work.\n");
197  DeviceExtension->PhysicalDeviceObject = NULL;
198  }
199  }
200 
201  DeviceExtension->AdapterInterfaceType =
202  DriverExtension->InitializationData.AdapterInterfaceType;
203 
204  if (PhysicalDeviceObject != NULL)
205  {
206  /* Get bus type from the upper level bus driver. */
207  Size = sizeof(ULONG);
210  Size,
211  &DeviceExtension->AdapterInterfaceType,
212  &Size);
213 
214  /* Get bus device address from the upper level bus driver. */
215  Size = sizeof(ULONG);
218  Size,
219  &PciSlotNumber,
220  &Size);
221 
222  /* Convert slotnumber to PCI_SLOT_NUMBER */
223  SlotNumber.u.AsULONG = 0;
224  SlotNumber.u.bits.DeviceNumber = (PciSlotNumber >> 16) & 0xFFFF;
225  SlotNumber.u.bits.FunctionNumber = PciSlotNumber & 0xFFFF;
226  DeviceExtension->SystemIoSlotNumber = SlotNumber.u.AsULONG;
227  }
228 
229  InitializeListHead(&DeviceExtension->AddressMappingListHead);
230  InitializeListHead(&DeviceExtension->DmaAdapterList);
231 
232  KeInitializeDpc(&DeviceExtension->DpcObject,
234  DeviceExtension);
235 
236  KeInitializeMutex(&DeviceExtension->DeviceLock, 0);
237 
238  /* Attach the device. */
239  if (PhysicalDeviceObject != NULL)
241  *DeviceObject,
243 
244  IntCreateNewRegistryPath(DeviceExtension);
245  IntSetupDeviceSettingsKey(DeviceExtension);
246  DriverExtension->InitializationData.StartingDeviceNumber++;
247 
248  /* Remove the initailizing flag */
249  (*DeviceObject)->Flags &= ~DO_DEVICE_INITIALIZING;
250  return STATUS_SUCCESS;
251 }
252 
253 
254 NTSTATUS
255 NTAPI
260 {
261  WCHAR DeviceVideoBuffer[20];
262  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
264  VIDEO_PORT_CONFIG_INFO ConfigInfo;
266  UCHAR Again = FALSE;
267  WCHAR DeviceBuffer[20];
269  WCHAR SymlinkBuffer[20];
270  UNICODE_STRING SymlinkName;
271  BOOL LegacyDetection = FALSE;
273 
274  DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
275  DeviceNumber = DeviceExtension->DeviceNumber;
276 
277  /* Setup a ConfigInfo structure that we will pass to HwFindAdapter. */
278  RtlZeroMemory(&ConfigInfo, sizeof(VIDEO_PORT_CONFIG_INFO));
279  ConfigInfo.Length = sizeof(VIDEO_PORT_CONFIG_INFO);
280  ConfigInfo.AdapterInterfaceType = DeviceExtension->AdapterInterfaceType;
281  if (ConfigInfo.AdapterInterfaceType == PCIBus)
282  ConfigInfo.InterruptMode = LevelSensitive;
283  else
284  ConfigInfo.InterruptMode = Latched;
285  ConfigInfo.DriverRegistryPath = DriverExtension->RegistryPath.Buffer;
287  ConfigInfo.SystemIoBusNumber = DeviceExtension->SystemIoBusNumber;
288  ConfigInfo.BusInterruptLevel = DeviceExtension->InterruptLevel;
289  ConfigInfo.BusInterruptVector = DeviceExtension->InterruptVector;
290 
293  sizeof(SystemBasicInfo),
294  NULL);
295  if (NT_SUCCESS(Status))
296  {
299  }
300 
301  // FIXME: Check the adapter key and update VideoDebugLevel variable.
302 
303  /*
304  * Call miniport HwVidFindAdapter entry point to detect if
305  * particular device is present. There are two possible code
306  * paths. The first one is for Legacy drivers (NT4) and cases
307  * when we don't have information about what bus we're on. The
308  * second case is the standard one for Plug & Play drivers.
309  */
310  if (DeviceExtension->PhysicalDeviceObject == NULL)
311  {
312  LegacyDetection = TRUE;
313  }
314 
315  if (LegacyDetection)
316  {
317  ULONG BusNumber, MaxBuses;
318 
319  MaxBuses = DeviceExtension->AdapterInterfaceType == PCIBus ? PCI_MAX_BRIDGE_NUMBER : 1;
320 
321  for (BusNumber = 0; BusNumber < MaxBuses; BusNumber++)
322  {
323  DeviceExtension->SystemIoBusNumber =
324  ConfigInfo.SystemIoBusNumber = BusNumber;
325 
326  RtlZeroMemory(&DeviceExtension->MiniPortDeviceExtension,
327  DriverExtension->InitializationData.HwDeviceExtensionSize);
328 
329  /* FIXME: Need to figure out what string to pass as param 3. */
330  Status = DriverExtension->InitializationData.HwFindAdapter(
331  &DeviceExtension->MiniPortDeviceExtension,
332  DriverExtension->HwContext,
333  NULL,
334  &ConfigInfo,
335  &Again);
336 
338  {
339  continue;
340  }
341  else if (Status == NO_ERROR)
342  {
343  break;
344  }
345  else
346  {
347  ERR_(VIDEOPRT, "HwFindAdapter call failed with error 0x%X\n", Status);
348  goto Failure;
349  }
350  }
351  }
352  else
353  {
354  /* FIXME: Need to figure out what string to pass as param 3. */
355  Status = DriverExtension->InitializationData.HwFindAdapter(
356  &DeviceExtension->MiniPortDeviceExtension,
357  DriverExtension->HwContext,
358  NULL,
359  &ConfigInfo,
360  &Again);
361  }
362 
363  if (Status != NO_ERROR)
364  {
365  ERR_(VIDEOPRT, "HwFindAdapter call failed with error 0x%X\n", Status);
366  goto Failure;
367  }
368 
369  /*
370  * Now we know the device is present, so let's do all additional tasks
371  * such as creating symlinks or setting up interrupts and timer.
372  */
373 
374  /* Create a unicode device name. */
375  swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
376  RtlInitUnicodeString(&DeviceName, DeviceBuffer);
377 
378  /* Create symbolic link "\??\DISPLAYx" */
379  swprintf(SymlinkBuffer, L"\\??\\DISPLAY%lu", DeviceNumber + 1);
380  RtlInitUnicodeString(&SymlinkName, SymlinkBuffer);
381  IoCreateSymbolicLink(&SymlinkName, &DeviceName);
382 
383  /* Add entry to DEVICEMAP\VIDEO key in registry. */
384  swprintf(DeviceVideoBuffer, L"\\Device\\Video%d", DeviceNumber);
387  L"VIDEO",
388  DeviceVideoBuffer,
389  REG_SZ,
390  DeviceExtension->RegistryPath.Buffer,
391  DeviceExtension->RegistryPath.Length + sizeof(UNICODE_NULL));
392 
395  L"VIDEO",
396  L"MaxObjectNumber",
397  REG_DWORD,
398  &DeviceNumber,
399  sizeof(DeviceNumber));
400 
401  /* FIXME: Allocate hardware resources for device. */
402 
403  /* Allocate interrupt for device. */
405  {
407  goto Failure;
408  }
409 
410  /* Allocate timer for device. */
412  {
413  if (DeviceExtension->InterruptObject != NULL)
414  IoDisconnectInterrupt(DeviceExtension->InterruptObject);
415  ERR_(VIDEOPRT, "IntVideoPortSetupTimer failed\n");
417  goto Failure;
418  }
419 
420  /* If the device can be reset, insert it in the list of resettable adapters */
421  InitializeListHead(&DeviceExtension->HwResetListEntry);
422  if (DriverExtension->InitializationData.HwResetHw != NULL)
423  {
425  &DeviceExtension->HwResetListEntry,
427  }
428 
429  /* Query children of the device. */
431 
432  INFO_(VIDEOPRT, "STATUS_SUCCESS\n");
433  return STATUS_SUCCESS;
434 
435 Failure:
436  RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
437  if (DeviceExtension->NextDeviceObject)
438  IoDetachDevice(DeviceExtension->NextDeviceObject);
440  return Status;
441 }
442 
443 VOID
444 FASTCALL
446  PKPROCESS *CallingProcess,
448 {
449  *CallingProcess = (PKPROCESS)PsGetCurrentProcess();
450  if (*CallingProcess != CsrProcess)
451  {
453  }
454 }
455 
456 VOID
457 FASTCALL
459  PKPROCESS *CallingProcess,
461 {
462  if (*CallingProcess != CsrProcess)
463  {
465  }
466 }
467 
468 VOID
469 FASTCALL
471 {
474  UNICODE_STRING Path = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control");
475  UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"SystemStartOptions");
479 
480  /* Initialize object attributes with the path we want */
482  &Path,
484  NULL,
485  NULL);
486 
487  /* Open the key */
488  Status = ZwOpenKey(&KeyHandle,
491  if (!NT_SUCCESS(Status))
492  {
493  VideoPortDebugPrint(Error, "ZwOpenKey failed (0x%x)\n", Status);
494  return;
495  }
496 
497  /* Find out how large our buffer should be */
498  Status = ZwQueryValueKey(KeyHandle,
499  &ValueName,
501  NULL,
502  0,
503  &Length);
505  {
506  VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status);
508  return;
509  }
510 
511  /* Allocate it */
513  if (!KeyInfo)
514  {
515  VideoPortDebugPrint(Error, "Out of memory\n");
517  return;
518  }
519 
520  /* Now for real this time */
521  Status = ZwQueryValueKey(KeyHandle,
522  &ValueName,
524  KeyInfo,
525  Length,
526  &NewLength);
528 
529  if (!NT_SUCCESS(Status))
530  {
531  VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status);
533  return;
534  }
535 
536  /* Sanity check */
537  if (KeyInfo->Type != REG_SZ)
538  {
539  VideoPortDebugPrint(Error, "Invalid type for SystemStartOptions\n");
541  return;
542  }
543 
544  /* Check if BASEVIDEO or NOVESA is present in the start options */
545  if (wcsstr((PWCHAR)KeyInfo->Data, L"BASEVIDEO"))
546  VpBaseVideo = TRUE;
547  if (wcsstr((PWCHAR)KeyInfo->Data, L"NOVESA"))
548  VpNoVesa = TRUE;
549 
551 
552  /* FIXME: Old ReactOS-compatibility... */
553  if (VpBaseVideo) VpNoVesa = TRUE;
554 
555  if (VpNoVesa)
556  VideoPortDebugPrint(Info, "VESA mode disabled\n");
557  else
558  VideoPortDebugPrint(Info, "VESA mode enabled\n");
559 
560  /* If we are in BASEVIDEO, create the volatile registry key for Win32k */
561  if (VpBaseVideo)
562  {
563  RtlInitUnicodeString(&Path, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\GraphicsDrivers\\BaseVideo");
564 
566  &Path,
568  NULL,
569  NULL);
570 
571  Status = ZwCreateKey(&KeyHandle,
572  KEY_WRITE,
574  0,
575  NULL,
577  NULL);
578  if (NT_SUCCESS(Status))
580  else
581  ERR_(VIDEOPRT, "Failed to create the BaseVideo key (0x%x)\n", Status);
582  }
583 
584  return;
585 }
586 
587 /* PUBLIC FUNCTIONS ***********************************************************/
588 
589 /*
590  * @implemented
591  */
592 ULONG
593 NTAPI
595  IN PVOID Context1,
596  IN PVOID Context2,
599 {
604  BOOLEAN PnpDriver = FALSE, LegacyDetection = FALSE;
605  static BOOLEAN FirstInitialization;
606 
607  TRACE_(VIDEOPRT, "VideoPortInitialize\n");
608 
609  if (!FirstInitialization)
610  {
611  FirstInitialization = TRUE;
615  }
616 
617  /* As a first thing do parameter checks. */
618  if (HwInitializationData->HwInitDataSize > sizeof(VIDEO_HW_INITIALIZATION_DATA))
619  {
620  ERR_(VIDEOPRT, "Invalid HwInitializationData\n");
622  }
623 
624  if ((HwInitializationData->HwFindAdapter == NULL) ||
625  (HwInitializationData->HwInitialize == NULL) ||
626  (HwInitializationData->HwStartIO == NULL))
627  {
628  ERR_(VIDEOPRT, "Invalid HwInitializationData\n");
630  }
631 
632  switch (HwInitializationData->HwInitDataSize)
633  {
634  /*
635  * NT4 drivers are special case, because we must use legacy method
636  * of detection instead of the Plug & Play one.
637  */
639  INFO_(VIDEOPRT, "We were loaded by a Windows NT miniport driver.\n");
640  break;
641 
643  INFO_(VIDEOPRT, "We were loaded by a Windows 2000 miniport driver.\n");
644  break;
645 
646  case sizeof(VIDEO_HW_INITIALIZATION_DATA):
647  INFO_(VIDEOPRT, "We were loaded by a Windows XP or later miniport driver.\n");
648  break;
649 
650  default:
651  ERR_(VIDEOPRT, "Invalid HwInitializationData size.\n");
652  return STATUS_UNSUCCESSFUL;
653  }
654 
655  /* Set dispatching routines */
658  DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
660  DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] =
662  DriverObject->DriverUnload = IntVideoPortUnload;
663 
664  /* Determine type of the miniport driver */
665  if ((HwInitializationData->HwInitDataSize >=
666  FIELD_OFFSET(VIDEO_HW_INITIALIZATION_DATA, HwQueryInterface)) &&
667  (HwInitializationData->HwSetPowerState != NULL) &&
668  (HwInitializationData->HwGetPowerState != NULL) &&
669  (HwInitializationData->HwGetVideoChildDescriptor != NULL))
670  {
671  INFO_(VIDEOPRT, "The miniport is a PnP miniport driver\n");
672  PnpDriver = TRUE;
673  }
674 
675  /* Check if legacy detection should be applied */
676  if (!PnpDriver || HwContext)
677  {
678  INFO_(VIDEOPRT, "Legacy detection for adapter interface %d\n",
679  HwInitializationData->AdapterInterfaceType);
680 
681  /* FIXME: Move the code for legacy detection
682  to another function and call it here */
683  LegacyDetection = TRUE;
684  }
685 
686  /*
687  * NOTE:
688  * The driver extension can be already allocated in case that we were
689  * called by legacy driver and failed detecting device. Some miniport
690  * drivers in that case adjust parameters and call VideoPortInitialize
691  * again.
692  */
694  if (DriverExtension == NULL)
695  {
697  DriverObject,
699  (PVOID *)&DriverExtension);
700  if (!NT_SUCCESS(Status))
701  {
702  ERR_(VIDEOPRT, "IoAllocateDriverObjectExtension failed 0x%x\n", Status);
703  return Status;
704  }
705 
706  /*
707  * Save the registry path. This should be done only once even if
708  * VideoPortInitialize is called multiple times.
709  */
710  if (RegistryPath->Length != 0)
711  {
712  DriverExtension->RegistryPath.Length = 0;
713  DriverExtension->RegistryPath.MaximumLength =
714  RegistryPath->Length + sizeof(UNICODE_NULL);
715  DriverExtension->RegistryPath.Buffer =
717  PagedPool,
718  DriverExtension->RegistryPath.MaximumLength,
719  'RTSU');
720  if (DriverExtension->RegistryPath.Buffer == NULL)
721  {
722  RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL);
724  }
725 
727  INFO_(VIDEOPRT, "RegistryPath: %wZ\n", &DriverExtension->RegistryPath);
728  }
729  else
730  {
731  RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL);
732  }
733  }
734 
735  /* Copy the correct miniport initialization data to the device extension. */
736  RtlCopyMemory(&DriverExtension->InitializationData,
738  HwInitializationData->HwInitDataSize);
739  if (HwInitializationData->HwInitDataSize <
741  {
742  RtlZeroMemory((PVOID)((ULONG_PTR)&DriverExtension->InitializationData +
743  HwInitializationData->HwInitDataSize),
745  HwInitializationData->HwInitDataSize);
746  }
747  DriverExtension->HwContext = HwContext;
748 
749  /*
750  * Plug & Play drivers registers the device in AddDevice routine.
751  * For legacy drivers we must do it now.
752  */
753  if (LegacyDetection)
754  {
756 
758  {
759  /* Power management */
761  }
762 
765  NULL,
766  &DeviceObject);
767  if (!NT_SUCCESS(Status))
768  {
769  ERR_(VIDEOPRT, "IntVideoPortCreateAdapterDeviceObject returned 0x%x\n", Status);
770  return Status;
771  }
772 
774  if (NT_SUCCESS(Status))
776  else
777  ERR_(VIDEOPRT, "IntVideoPortFindAdapter returned 0x%x\n", Status);
778 
779  return Status;
780  }
781  else
782  {
783  DriverObject->DriverExtension->AddDevice = IntVideoPortAddDevice;
787 
788  return STATUS_SUCCESS;
789  }
790 }
791 
792 /*
793  * @implemented
794  */
795 VOID
797  IN VIDEO_DEBUG_LEVEL DebugPrintLevel,
798  IN PCHAR DebugMessage,
799  ...)
800 {
801  va_list ap;
802 
803  if (VideoDebugLevel >= DebugPrintLevel)
804  DebugPrintLevel = Error;
805 
806  va_start(ap, DebugMessage);
807  vDbgPrintEx(DPFLTR_IHVVIDEO_ID, DebugPrintLevel, DebugMessage, ap);
808  va_end(ap);
809 }
810 
811 /*
812  * @unimplemented
813  */
814 VOID
815 NTAPI
817  IN PVOID HwDeviceExtension,
820  IN ULONG UniqueId)
821 {
823 
824  INFO_(VIDEOPRT, "VideoPortLogError ErrorCode %d (0x%x) UniqueId %lu (0x%lx)\n",
825  ErrorCode, ErrorCode, UniqueId, UniqueId);
826  if (Vrp)
827  INFO_(VIDEOPRT, "Vrp->IoControlCode %lu (0x%lx)\n", Vrp->IoControlCode, Vrp->IoControlCode);
828 }
829 
830 /*
831  * @implemented
832  */
833 UCHAR
834 NTAPI
836 {
837  return KeGetCurrentIrql();
838 }
839 
841 {
846 
847 static
848 NTSTATUS
849 NTAPI
855  IN PVOID Context,
857 {
859 
860  INFO_(VIDEOPRT, "Found registry value for name %S: type %d, length %d\n",
862  return (*(CallbackContext->HwGetRegistryRoutine))(
863  CallbackContext->HwDeviceExtension,
864  CallbackContext->HwContext,
865  ValueName,
866  ValueData,
867  ValueLength);
868 }
869 
870 /*
871  * @unimplemented
872  */
873 
874 VP_STATUS
875 NTAPI
877  IN PVOID HwDeviceExtension,
879  IN UCHAR IsParameterFileName,
880  IN PMINIPORT_GET_REGISTRY_ROUTINE GetRegistryRoutine,
882 {
885  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
887 
888  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
889 
890  TRACE_(VIDEOPRT, "VideoPortGetRegistryParameters ParameterName %S, RegPath: %wZ\n",
891  ParameterName, &DeviceExtension->RegistryPath);
892 
893  Context.HwDeviceExtension = HwDeviceExtension;
894  Context.HwContext = HwContext;
895  Context.HwGetRegistryRoutine = GetRegistryRoutine;
896 
900 
902  DeviceExtension->RegistryPath.Buffer,
903  QueryTable,
904  &Context,
905  NULL);
906  if (!NT_SUCCESS(Status))
907  {
908  WARN_(VIDEOPRT, "VideoPortGetRegistryParameters could not find the "
909  "requested parameter\n");
911  }
912 
913  if (IsParameterFileName)
914  {
915  /* FIXME: need to read the contents of the file */
917  }
918 
919  return NO_ERROR;
920 }
921 
922 /*
923  * @implemented
924  */
925 VP_STATUS
926 NTAPI
928  IN PVOID HwDeviceExtension,
932 {
933  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
935 
936  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
937  TRACE_(VIDEOPRT, "VideoPortSetRegistryParameters ParameterName %S, RegPath: %wZ\n",
938  ValueName,
939  &DeviceExtension->RegistryPath);
942  DeviceExtension->RegistryPath.Buffer,
943  ValueName,
944  REG_BINARY,
945  ValueData,
946  ValueLength);
947  if (Status != NO_ERROR)
948  WARN_(VIDEOPRT, "VideoPortSetRegistryParameters error 0x%x\n", Status);
949 
950  return Status;
951 }
952 
953 /*
954  * @implemented
955  */
956 VP_STATUS
957 NTAPI
959  IN PVOID HwDeviceExtension,
960  OUT PULONG VgaStatus)
961 {
962  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
963 
964  TRACE_(VIDEOPRT, "VideoPortGetVgaStatus\n");
965 
966  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
968  {
969  if (DeviceExtension->AdapterInterfaceType == PCIBus)
970  {
971  /* VgaStatus: 0 == VGA not enabled, 1 == VGA enabled. */
972  /* Assumed for now */
973  *VgaStatus = 1;
974  return NO_ERROR;
975  }
976  }
977 
978  return ERROR_INVALID_FUNCTION;
979 }
980 
981 /*
982  * @implemented
983  */
984 PVOID
985 NTAPI
987  IN PVOID HwDeviceExtension,
988  IN PVOID Unused1,
989  IN ULONG Unused2,
990  IN ULONG Length)
991 {
992  static PVOID RomImageBuffer = NULL;
993  PKPROCESS CallingProcess;
995 
996  TRACE_(VIDEOPRT, "VideoPortGetRomImage(HwDeviceExtension 0x%X Length 0x%X)\n",
997  HwDeviceExtension, Length);
998 
999  /* If the length is zero then free the existing buffer. */
1000  if (Length == 0)
1001  {
1002  if (RomImageBuffer != NULL)
1003  {
1004  ExFreePool(RomImageBuffer);
1005  RomImageBuffer = NULL;
1006  }
1007  return NULL;
1008  }
1009  else
1010  {
1011  /*
1012  * The DDK says we shouldn't use the legacy C0000 method but get the
1013  * rom base address from the corresponding pci or acpi register but
1014  * lets ignore that and use C0000 anyway. We have already mapped the
1015  * bios area into memory so we'll copy from there.
1016  */
1017 
1018  /* Copy the bios. */
1019  Length = min(Length, 0x10000);
1020  if (RomImageBuffer != NULL)
1021  {
1022  ExFreePool(RomImageBuffer);
1023  }
1024 
1025  RomImageBuffer = ExAllocatePool(PagedPool, Length);
1026  if (RomImageBuffer == NULL)
1027  {
1028  return NULL;
1029  }
1030 
1031  IntAttachToCSRSS(&CallingProcess, &ApcState);
1032  RtlCopyMemory(RomImageBuffer, (PUCHAR)0xC0000, Length);
1033  IntDetachFromCSRSS(&CallingProcess, &ApcState);
1034 
1035  return RomImageBuffer;
1036  }
1037 }
1038 
1039 /*
1040  * @implemented
1041  */
1042 BOOLEAN
1043 NTAPI
1045  IN PVOID HwDeviceExtension,
1046  IN PUCHAR RomBase,
1047  IN ULONG RomLength,
1048  IN PUCHAR String)
1049 {
1050  SIZE_T StringLength;
1051  BOOLEAN Found;
1052  PUCHAR SearchLocation;
1053 
1054  TRACE_(VIDEOPRT, "VideoPortScanRom RomBase %p RomLength 0x%x String %s\n", RomBase, RomLength, String);
1055 
1056  StringLength = strlen((PCHAR)String);
1057  Found = FALSE;
1058  for (SearchLocation = RomBase;
1059  !Found && SearchLocation < RomBase + RomLength - StringLength;
1060  SearchLocation++)
1061  {
1062  Found = (RtlCompareMemory(SearchLocation, String, StringLength) == StringLength);
1063  if (Found)
1064  {
1065  INFO_(VIDEOPRT, "Match found at %p\n", SearchLocation);
1066  }
1067  }
1068 
1069  return Found;
1070 }
1071 
1072 /*
1073  * @implemented
1074  */
1075 BOOLEAN
1076 NTAPI
1078  IN PVOID HwDeviceExtension,
1081  OUT PVOID Context)
1082 {
1083  BOOLEAN Ret;
1084  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1085  KIRQL OldIrql;
1086 
1087  switch (Priority)
1088  {
1089  case VpLowPriority:
1090  Ret = (*SynchronizeRoutine)(Context);
1091  break;
1092 
1093  case VpMediumPriority:
1094  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1095  if (DeviceExtension->InterruptObject == NULL)
1096  Ret = (*SynchronizeRoutine)(Context);
1097  else
1098  Ret = KeSynchronizeExecution(
1099  DeviceExtension->InterruptObject,
1101  Context);
1102  break;
1103 
1104  case VpHighPriority:
1106  if (OldIrql < SYNCH_LEVEL)
1108 
1109  Ret = (*SynchronizeRoutine)(Context);
1110 
1111  if (OldIrql < SYNCH_LEVEL)
1113  break;
1114 
1115  default:
1116  Ret = FALSE;
1117  }
1118 
1119  return Ret;
1120 }
1121 
1122 /*
1123  * @implemented
1124  */
1125 VP_STATUS
1126 NTAPI
1128  IN PVOID HwDeviceExtension,
1129  IN PVOID Reserved)
1130 {
1131  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1132  ULONG Status;
1133  VIDEO_CHILD_ENUM_INFO ChildEnumInfo;
1134  BOOLEAN bHaveLastMonitorID = FALSE;
1135  UCHAR LastMonitorID[10];
1136  ULONG Unused;
1137  UINT i;
1138  PDEVICE_OBJECT ChildDeviceObject;
1139  PVIDEO_PORT_CHILD_EXTENSION ChildExtension;
1140 
1141  INFO_(VIDEOPRT, "Starting child device probe\n");
1142  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1144  {
1145  WARN_(VIDEOPRT, "Miniport's HwGetVideoChildDescriptor is NULL!\n");
1146  return NO_ERROR;
1147  }
1148 
1149  if (!IsListEmpty(&DeviceExtension->ChildDeviceList))
1150  {
1151  ERR_(VIDEOPRT, "FIXME: Support calling VideoPortEnumerateChildren again!\n");
1152  return NO_ERROR;
1153  }
1154 
1155  /* Enumerate the children */
1156  for (i = 1; ; i++)
1157  {
1158  Status = IoCreateDevice(DeviceExtension->DriverObject,
1159  sizeof(VIDEO_PORT_CHILD_EXTENSION) +
1161  NULL,
1164  FALSE,
1165  &ChildDeviceObject);
1166  if (!NT_SUCCESS(Status))
1167  return Status;
1168 
1169  ChildExtension = ChildDeviceObject->DeviceExtension;
1170 
1171  RtlZeroMemory(ChildExtension,
1172  sizeof(VIDEO_PORT_CHILD_EXTENSION) +
1174 
1175  ChildExtension->Common.Fdo = FALSE;
1176  ChildExtension->ChildId = i;
1177  ChildExtension->PhysicalDeviceObject = ChildDeviceObject;
1178  ChildExtension->DriverObject = DeviceExtension->DriverObject;
1179 
1180  /* Setup the ChildEnumInfo */
1181  ChildEnumInfo.Size = sizeof(ChildEnumInfo);
1182  ChildEnumInfo.ChildDescriptorSize = sizeof(ChildExtension->ChildDescriptor);
1183  ChildEnumInfo.ACPIHwId = 0;
1184 
1186  ChildEnumInfo.ChildHwDeviceExtension = VIDEO_PORT_GET_CHILD_EXTENSION(ChildExtension);
1187  else
1188  ChildEnumInfo.ChildHwDeviceExtension = NULL;
1189 
1190  ChildEnumInfo.ChildIndex = ChildExtension->ChildId;
1191 
1192  INFO_(VIDEOPRT, "Probing child: %d\n", ChildEnumInfo.ChildIndex);
1194  HwDeviceExtension,
1195  &ChildEnumInfo,
1196  &ChildExtension->ChildType,
1197  ChildExtension->ChildDescriptor,
1198  &ChildExtension->ChildId,
1199  &Unused);
1201  {
1202  if (ChildExtension->ChildType == Monitor)
1203  {
1204  // Check if the EDID is valid
1205  if (ChildExtension->ChildDescriptor[0] == 0x00 &&
1206  ChildExtension->ChildDescriptor[1] == 0xFF &&
1207  ChildExtension->ChildDescriptor[2] == 0xFF &&
1208  ChildExtension->ChildDescriptor[3] == 0xFF &&
1209  ChildExtension->ChildDescriptor[4] == 0xFF &&
1210  ChildExtension->ChildDescriptor[5] == 0xFF &&
1211  ChildExtension->ChildDescriptor[6] == 0xFF &&
1212  ChildExtension->ChildDescriptor[7] == 0x00)
1213  {
1214  if (bHaveLastMonitorID)
1215  {
1216  // Compare the previous monitor ID with the current one, break the loop if they are identical
1217  if (RtlCompareMemory(LastMonitorID, &ChildExtension->ChildDescriptor[8], sizeof(LastMonitorID)) == sizeof(LastMonitorID))
1218  {
1219  INFO_(VIDEOPRT, "Found identical Monitor ID two times, stopping enumeration\n");
1220  IoDeleteDevice(ChildDeviceObject);
1221  break;
1222  }
1223  }
1224 
1225  // Copy 10 bytes from the EDID, which can be used to uniquely identify the monitor
1226  RtlCopyMemory(LastMonitorID, &ChildExtension->ChildDescriptor[8], sizeof(LastMonitorID));
1227  bHaveLastMonitorID = TRUE;
1228 
1229  /* Mark it valid */
1230  ChildExtension->EdidValid = TRUE;
1231  }
1232  else
1233  {
1234  /* Mark it invalid */
1235  ChildExtension->EdidValid = FALSE;
1236  }
1237  }
1238  }
1239  else if (Status == VIDEO_ENUM_INVALID_DEVICE)
1240  {
1241  WARN_(VIDEOPRT, "Child device %d is invalid!\n", ChildEnumInfo.ChildIndex);
1242  IoDeleteDevice(ChildDeviceObject);
1243  continue;
1244  }
1245  else if (Status == VIDEO_ENUM_NO_MORE_DEVICES)
1246  {
1247  INFO_(VIDEOPRT, "End of child enumeration! (%d children enumerated)\n", i - 1);
1248  IoDeleteDevice(ChildDeviceObject);
1249  break;
1250  }
1251  else
1252  {
1253  WARN_(VIDEOPRT, "HwGetVideoChildDescriptor returned unknown status code 0x%x!\n", Status);
1254  IoDeleteDevice(ChildDeviceObject);
1255  break;
1256  }
1257 
1258  if (ChildExtension->ChildType == Monitor)
1259  {
1260  UINT j;
1261  PUCHAR p = ChildExtension->ChildDescriptor;
1262  INFO_(VIDEOPRT, "Monitor device enumerated! (ChildId = 0x%x)\n", ChildExtension->ChildId);
1263  for (j = 0; j < sizeof (ChildExtension->ChildDescriptor); j += 8)
1264  {
1265  INFO_(VIDEOPRT, "%02x %02x %02x %02x %02x %02x %02x %02x\n",
1266  p[j + 0], p[j + 1], p[j + 2], p[j + 3],
1267  p[j + 4], p[j + 5], p[j + 6], p[j + 7]);
1268  }
1269  }
1270  else if (ChildExtension->ChildType == Other)
1271  {
1272  INFO_(VIDEOPRT, "\"Other\" device enumerated: DeviceId = %S\n", (PWSTR)ChildExtension->ChildDescriptor);
1273  }
1274  else
1275  {
1276  ERR_(VIDEOPRT, "HwGetVideoChildDescriptor returned unsupported type: %d\n", ChildExtension->ChildType);
1277  }
1278 
1279  /* Clear the init flag */
1280  ChildDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
1281 
1282  InsertTailList(&DeviceExtension->ChildDeviceList,
1283  &ChildExtension->ListEntry);
1284  }
1285 
1286  /* Trigger reenumeration by the PnP manager */
1288 
1289  return NO_ERROR;
1290 }
1291 
1292 /*
1293  * @unimplemented
1294  */
1295 VP_STATUS
1296 NTAPI
1298  IN PVOID HwDeviceExtension,
1299  IN OUT PVOID *SecondaryDeviceExtension,
1300  IN ULONG Flag)
1301 {
1302  UNIMPLEMENTED;
1303  return ERROR_DEV_NOT_EXIST;
1304 }
1305 
1306 /*
1307  * @implemented
1308  */
1309 BOOLEAN
1310 NTAPI
1312  IN PVOID HwDeviceExtension,
1314  IN PVOID Context)
1315 {
1316  return KeInsertQueueDpc(
1317  &VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension)->DpcObject,
1319  (PVOID)Context);
1320 }
1321 
1322 /*
1323  * @implemented
1324  */
1325 PVOID
1326 NTAPI
1329 {
1330  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1331 
1332  TRACE_(VIDEOPRT, "VideoPortGetAssociatedDeviceExtension\n");
1333  DeviceExtension = ((PDEVICE_OBJECT)DeviceObject)->DeviceExtension;
1334  if (!DeviceExtension)
1335  return NULL;
1336  return DeviceExtension->MiniPortDeviceExtension;
1337 }
1338 
1339 /*
1340  * @implemented
1341  */
1342 VP_STATUS
1343 NTAPI
1345  IN PVOID HwDeviceExtension,
1346  IN OUT PVPOSVERSIONINFO VpOsVersionInfo)
1347 {
1349 
1350  Version.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
1351  if (VpOsVersionInfo->Size >= sizeof(VPOSVERSIONINFO))
1352  {
1353 #if 1
1355  {
1356  VpOsVersionInfo->MajorVersion = Version.dwMajorVersion;
1357  VpOsVersionInfo->MinorVersion = Version.dwMinorVersion;
1358  VpOsVersionInfo->BuildNumber = Version.dwBuildNumber;
1359  VpOsVersionInfo->ServicePackMajor = Version.wServicePackMajor;
1360  VpOsVersionInfo->ServicePackMinor = Version.wServicePackMinor;
1361  return NO_ERROR;
1362  }
1363  return ERROR_INVALID_PARAMETER;
1364 #else
1365  VpOsVersionInfo->MajorVersion = 5;
1366  VpOsVersionInfo->MinorVersion = 0;
1367  VpOsVersionInfo->BuildNumber = 2195;
1368  VpOsVersionInfo->ServicePackMajor = 4;
1369  VpOsVersionInfo->ServicePackMinor = 0;
1370  return NO_ERROR;
1371 #endif
1372  }
1373 
1374  return ERROR_INVALID_PARAMETER;
1375 }
1376 
1377 /*
1378  * @implemented
1379  */
1380 BOOLEAN
1381 NTAPI
1383  IN PVOID HwDeviceExtension,
1384  IN USHORT VendorId,
1385  IN USHORT DeviceId,
1386  IN UCHAR RevisionId,
1387  IN USHORT SubVendorId,
1388  IN USHORT SubSystemId,
1389  IN ULONG Flags)
1390 {
1391  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1394  IO_STACK_LOCATION IoStack;
1395  ULONG PciFlags = 0;
1396  NTSTATUS Status;
1397  BOOL DevicePresent;
1398 
1399  TRACE_(VIDEOPRT, "VideoPortCheckForDeviceExistence\n");
1400 
1402  {
1403  WARN_(VIDEOPRT, "VideoPortCheckForDeviceExistence: Unknown flags 0x%lx\n", Flags & ~(CDE_USE_REVISION | CDE_USE_SUBSYSTEM_IDS));
1404  return FALSE;
1405  }
1406 
1407  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1408 
1410  PciDevicePresentInterface.Version = 1;
1412  IoStack.Parameters.QueryInterface.Version = PciDevicePresentInterface.Version;
1414  IoStack.Parameters.QueryInterface.InterfaceType =
1415  &GUID_PCI_DEVICE_PRESENT_INTERFACE;
1416  Status = IopInitiatePnpIrp(DeviceExtension->NextDeviceObject,
1418  if (!NT_SUCCESS(Status))
1419  {
1420  WARN_(VIDEOPRT, "IopInitiatePnpIrp() failed! (Status 0x%lx)\n", Status);
1421  return FALSE;
1422  }
1423 
1424  if (Flags & CDE_USE_REVISION)
1425  PciFlags |= PCI_USE_REVISION;
1427  PciFlags |= PCI_USE_SUBSYSTEM_IDS;
1428 
1429  DevicePresent = PciDevicePresentInterface.IsDevicePresent(
1430  VendorId, DeviceId, RevisionId,
1431  SubVendorId, SubSystemId, PciFlags);
1432 
1433  PciDevicePresentInterface.InterfaceDereference(PciDevicePresentInterface.Context);
1434 
1435  return DevicePresent;
1436 }
1437 
1438 /*
1439  * @unimplemented
1440  */
1441 VP_STATUS
1442 NTAPI
1444  IN PVOID HwDeviceExtension,
1445  IN ULONG BugcheckCode,
1447  IN ULONG BugcheckDataSize)
1448 {
1449  UNIMPLEMENTED;
1450  return NO_ERROR;
1451 }
1452 
1453 /*
1454  * @implemented
1455  */
1456 LONGLONG
1457 NTAPI
1459  IN PVOID HwDeviceExtension,
1460  OUT PLONGLONG PerformanceFrequency OPTIONAL)
1461 {
1463 
1464  TRACE_(VIDEOPRT, "VideoPortQueryPerformanceCounter\n");
1465  Result = KeQueryPerformanceCounter((PLARGE_INTEGER)PerformanceFrequency);
1466  return Result.QuadPart;
1467 }
1468 
1469 /*
1470  * @implemented
1471  */
1472 VOID
1473 NTAPI
1475  IN PVOID HwDeviceExtension)
1476 {
1477  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1478 
1479  TRACE_(VIDEOPRT, "VideoPortAcquireDeviceLock\n");
1480  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1482  // ASSERT(Status == STATUS_SUCCESS);
1483 }
1484 
1485 /*
1486  * @implemented
1487  */
1488 VOID
1489 NTAPI
1491  IN PVOID HwDeviceExtension)
1492 {
1493  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1494 
1495  TRACE_(VIDEOPRT, "VideoPortReleaseDeviceLock\n");
1496  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1497  KeReleaseMutex(&DeviceExtension->DeviceLock, FALSE);
1498  //ASSERT(Status == STATUS_SUCCESS);
1499 }
1500 
1501 /*
1502  * @unimplemented
1503  */
1504 VOID
1505 NTAPI
1508  IN PVOID Data)
1509 {
1510  UNIMPLEMENTED;
1511 }
1512 
1513 /*
1514  * @implemented
1515  */
1516 PVOID
1517 NTAPI
1519  IN PVOID HwDeviceExtension,
1522 )
1523 {
1525 }
1526 
1527 /*
1528  * @implemented
1529  */
1530 BOOLEAN
1531 NTAPI
1533 {
1534  return VpNoVesa;
1535 }
VOID FASTCALL IntLoadRegistryParameters(VOID)
Definition: videoprt.c:470
#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:256
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:65
#define STATUS_REVISION_MISMATCH
Definition: ntstatus.h:325
signed char * PCHAR
Definition: retypes.h:7
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
PVOID NTAPI IntVideoPortImageDirectoryEntryToData(PVOID BaseAddress, ULONG Directory)
Definition: videoprt.c:58
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ typedef _In_ PVOID Unused
Definition: iotypes.h:1166
#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:4155
#define IN
Definition: typedefs.h:39
VOID NTAPI VpNotifyEaData(IN PDEVICE_OBJECT DeviceObject, IN PVOID Data)
Definition: videoprt.c:1506
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:94
KAPC_STATE
Definition: ketypes.h:1280
#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:3600
_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
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
Definition: wdfdpc.h:107
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:81
BOOLEAN VpBaseVideo
Definition: videoprt.c:36
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:1762
#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
NTSTATUS NTAPI IntCreateRegistryPath(IN PCUNICODE_STRING DriverRegistryPath, IN ULONG DeviceNumber, OUT PUNICODE_STRING DeviceRegistryPath)
Definition: registry.c:532
#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:1518
#define TRUE
Definition: types.h:120
#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:56
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:1044
BOOLEAN NTAPI IntVideoPortSetupTimer(IN PDEVICE_OBJECT DeviceObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension)
Definition: timer.c:43
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
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
PVOID NTAPI VideoPortGetAssociatedDeviceExtension(IN PVOID DeviceObject)
Definition: videoprt.c:1327
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA _In_ PVOID HwContext
Definition: srb.h:897
struct _VIDEO_PORT_DEVICE_EXTENSTION * PVIDEO_PORT_DEVICE_EXTENSION
VP_STATUS NTAPI VideoPortGetVersion(IN PVOID HwDeviceExtension, IN OUT PVPOSVERSIONINFO VpOsVersionInfo)
Definition: videoprt.c:1344
VP_STATUS NTAPI VideoPortRegisterBugcheckCallback(IN PVOID HwDeviceExtension, IN ULONG BugcheckCode, IN PVIDEO_BUGCHECK_CALLBACK Callback, IN ULONG BugcheckDataSize)
Definition: videoprt.c:1443
KMUTEX VideoPortInt10Mutex
Definition: videoprt.c:41
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
struct QueryRegistryCallbackContext QUERY_REGISTRY_CALLBACK_CONTEXT
ULONG ChildDescriptorSize
Definition: video.h:262
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:137
LIST_ENTRY AddressMappingListHead
Definition: videoprt.h:101
PKPROCESS CsrProcess
Definition: videoprt.c:39
BOOLEAN NTAPI VideoPortSynchronizeExecution(IN PVOID HwDeviceExtension, IN VIDEO_SYNCHRONIZE_PRIORITY Priority, IN PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine, OUT PVOID Context)
Definition: videoprt.c:1077
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:56
#define swprintf
Definition: precomp.h:40
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1155
#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
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG _Out_opt_ PULONG _Out_opt_ PULONG ValueType
Definition: wdfregistry.h:279
#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:927
_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:1458
#define _In_opt_
Definition: no_sal2.h:212
#define PCI_USE_REVISION
Definition: iotypes.h:867
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
static USHORT USHORT * NewLength
uint32_t ULONG_PTR
Definition: typedefs.h:65
INTERFACE_TYPE AdapterInterfaceType
Definition: video.h:169
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
__GNU_EXTENSION typedef __int64 * PLONGLONG
Definition: ntbasedef.h:382
UCHAR KIRQL
Definition: env_spec_w32.h:591
_Must_inspect_result_ _In_ PFLT_GET_OPERATION_STATUS_CALLBACK CallbackRoutine
Definition: fltkernel.h:1035
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
struct QueryRegistryCallbackContext * PQUERY_REGISTRY_CALLBACK_CONTEXT
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2430
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:110
#define va_end(ap)
Definition: acmsvcex.h:90
#define FALSE
Definition: types.h:117
#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
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:87
UCHAR NTAPI VideoPortGetCurrentIrql(VOID)
Definition: videoprt.c:835
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
VOID NTAPI IntVideoPortUnload(PDRIVER_OBJECT DriverObject)
Definition: dispatch.c:1171
VP_STATUS NTAPI VideoPortEnumerateChildren(IN PVOID HwDeviceExtension, IN PVOID Reserved)
Definition: videoprt.c:1127
#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:4155
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
KSPIN_LOCK HwResetAdaptersLock
Definition: videoprt.c:42
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:1953
_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:850
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
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
Status
Definition: gdiplustypes.h:24
_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:76
int64_t LONGLONG
Definition: typedefs.h:68
#define _Out_opt_
Definition: no_sal2.h:214
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
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
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VP_STATUS NTAPI VideoPortGetVgaStatus(IN PVOID HwDeviceExtension, OUT PULONG VgaStatus)
Definition: videoprt.c:958
_In_ PKSYNCHRONIZE_ROUTINE SynchronizeRoutine
Definition: kefuncs.h:536
ULONG VideoDebugLevel
Definition: videoprt.c:34
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FILE_DEVICE_VIDEO
Definition: winioctl.h:141
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
ULONG NTAPI DriverEntry(IN PVOID Context1, IN PVOID Context2)
Definition: videoprt.c:49
#define SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA
Definition: video.h:119
Definition: video.h:273
SYSTEM_BASIC_INFORMATION SystemBasicInfo
Definition: perfdata.c:45
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:816
_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)
va_start(ap, x)
BOOL Error
Definition: chkdsk.c:66
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:361
#define IRP_MN_QUERY_INTERFACE
NTSYSAPI ULONG NTAPI vDbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ PCCH Format, _In_ va_list ap)
#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
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:240
BOOLEAN VpNoVesa
Definition: videoprt.c:37
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:651
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3375
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
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
_In_opt_ PWSTR _In_ PWSTR ParameterName
Definition: cdrom.h:960
VOID NTAPI VideoPortAcquireDeviceLock(IN PVOID HwDeviceExtension)
Definition: videoprt.c:1474
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1840
_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
#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:31
#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
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:86
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:456
struct _VIDEO_PORT_DEVICE_EXTENSTION VIDEO_PORT_DEVICE_EXTENSION
#define _In_
Definition: no_sal2.h:158
VOID VideoPortDebugPrint(IN VIDEO_DEBUG_LEVEL DebugPrintLevel, IN PCHAR DebugMessage,...)
Definition: videoprt.c:796
ULONG_PTR SIZE_T
Definition: typedefs.h:80
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
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:2343
PRTL_UNICODE_STRING_BUFFER Path
Definition: video.h:270
VOID FASTCALL IntAttachToCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState)
Definition: videoprt.c:445
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
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
ULONG VideoPortDeviceNumber
Definition: videoprt.c:40
unsigned short USHORT
Definition: pedump.c:61
struct _KPROCESS * PKPROCESS
Definition: wdm.template.h:206
#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
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:1629
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT Context1
Definition: tdikrnl.h:1094
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
ULONG NTAPI VideoPortInitialize(IN PVOID Context1, IN PVOID Context2, IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData, IN PVOID HwContext)
Definition: videoprt.c:594
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1035
unsigned int * PULONG
Definition: retypes.h:1
BOOLEAN NTAPI VideoPortIsNoVesa(VOID)
Definition: videoprt.c:1532
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
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:665
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)
struct tagContext Context
Definition: acpixf.h:1034
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
VIDEO_DEBUG_LEVEL
Definition: video.h:579
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:124
VOID FASTCALL IntDetachFromCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState)
Definition: videoprt.c:458
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:262
#define ULONG_PTR
Definition: config.h:101
RTL_STATIC_LIST_HEAD(HwResetAdaptersList)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
BOOLEAN NTAPI KeSynchronizeExecution(IN OUT PKINTERRUPT Interrupt, IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, IN PVOID SynchronizeContext OPTIONAL)
Definition: interrupt.c:165
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
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:986
#define STATUS_SUCCESS
Definition: shellext.h:65
#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:1229
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:3128
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:876
_In_ BOOLEAN _In_ USHORT Directory
Definition: rtlfuncs.h:3885
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:98
#define RTL_QUERY_REGISTRY_REQUIRED
Definition: nt_native.h:132
#define REG_DWORD
Definition: sdbapi.c:596
#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:1311
PMINIPORT_GET_REGISTRY_ROUTINE HwGetRegistryRoutine
Definition: videoprt.c:844
VP_STATUS NTAPI VideoPortCreateSecondaryDisplay(IN PVOID HwDeviceExtension, IN OUT PVOID *SecondaryDeviceExtension, IN ULONG Flag)
Definition: videoprt.c:1297
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
* PKAPC_STATE
Definition: ketypes.h:1280
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:897
#define PCI_USE_SUBSYSTEM_IDS
Definition: iotypes.h:866
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:1382
KINTERRUPT_MODE InterruptMode
Definition: video.h:172
VOID NTAPI VideoPortReleaseDeviceLock(IN PVOID HwDeviceExtension)
Definition: videoprt.c:1490
#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
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG ValueLength
Definition: wdfregistry.h:271
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:675