ReactOS  0.4.14-dev-608-gd495a4f
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/rtlfuncs.h>
27 
28 #define NDEBUG
29 #include <debug.h>
30 
31 /* GLOBAL VARIABLES ***********************************************************/
32 
38 
39 /* PRIVATE FUNCTIONS **********************************************************/
40 
41 ULONG
42 NTAPI
46 {
47  return STATUS_SUCCESS;
48 }
49 
50 PVOID
51 NTAPI
55 {
56  PIMAGE_NT_HEADERS NtHeader;
57  ULONG Va;
58 
59  NtHeader = RtlImageNtHeader(BaseAddress);
60  if (NtHeader == NULL)
61  return NULL;
62 
64  return NULL;
65 
67  if (Va == 0)
68  return NULL;
69 
70  return (PVOID)((ULONG_PTR)BaseAddress + Va);
71 }
72 
73 VOID
74 NTAPI
76  IN PKDPC Dpc,
80 {
81  PVOID HwDeviceExtension =
82  &((PVIDEO_PORT_DEVICE_EXTENSION)DeferredContext)->MiniPortDeviceExtension;
84 }
85 
87 NTAPI
93 {
94  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
96  ULONG PciSlotNumber;
98  ULONG Size;
100  WCHAR DeviceBuffer[20];
102  PDEVICE_OBJECT DeviceObject_;
103 
104  if (DeviceObject == NULL)
105  DeviceObject = &DeviceObject_;
106 
107  /*
108  * Find the first free device number that can be used for video device
109  * object names and symlinks.
110  */
112  if (DeviceNumber == 0xFFFFFFFF)
113  {
114  WARN_(VIDEOPRT, "Can't find free device number\n");
115  return STATUS_UNSUCCESSFUL;
116  }
117 
118  /*
119  * Create the device object.
120  */
121 
122  /* Create a unicode device name. */
123  swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
124  RtlInitUnicodeString(&DeviceName, DeviceBuffer);
125 
126  INFO_(VIDEOPRT, "HwDeviceExtension size is: 0x%x\n",
127  DriverExtension->InitializationData.HwDeviceExtensionSize);
128 
129  /* Create the device object. */
131  DriverExtension->InitializationData.HwDeviceExtensionSize;
133  Size,
134  &DeviceName,
136  0,
137  TRUE,
138  DeviceObject);
139 
140  if (!NT_SUCCESS(Status))
141  {
142  WARN_(VIDEOPRT, "IoCreateDevice call failed with status 0x%08x\n", Status);
143  return Status;
144  }
145 
146  /*
147  * Set the buffering strategy here. If you change this, remember
148  * to change VidDispatchDeviceControl too.
149  */
150 
151  (*DeviceObject)->Flags |= DO_BUFFERED_IO;
152 
153  /* Initialize device extension. */
154  DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)((*DeviceObject)->DeviceExtension);
155  DeviceExtension->Common.Fdo = TRUE;
156  DeviceExtension->DeviceNumber = DeviceNumber;
157  DeviceExtension->DriverObject = DriverObject;
158  DeviceExtension->PhysicalDeviceObject = PhysicalDeviceObject;
159  DeviceExtension->FunctionalDeviceObject = *DeviceObject;
160  DeviceExtension->DriverExtension = DriverExtension;
161  DeviceExtension->SessionId = -1;
162 
163  InitializeListHead(&DeviceExtension->ChildDeviceList);
164 
165  /* Get the registry path associated with this device. */
167  &DeviceExtension->RegistryPath);
168  if (!NT_SUCCESS(Status))
169  {
170  WARN_(VIDEOPRT, "IntCreateRegistryPath() call failed with status 0x%08x\n", Status);
172  *DeviceObject = NULL;
173  return Status;
174  }
175 
176  if (PhysicalDeviceObject != NULL)
177  {
178  /* Get bus number from the upper level bus driver. */
179  Size = sizeof(ULONG);
182  Size,
183  &DeviceExtension->SystemIoBusNumber,
184  &Size);
185  if (!NT_SUCCESS(Status))
186  {
187  WARN_(VIDEOPRT, "Couldn't get an information from bus driver. We will try to\n"
188  "use legacy detection method, but even that doesn't mean that\n"
189  "it will work.\n");
190  DeviceExtension->PhysicalDeviceObject = NULL;
191  }
192  }
193 
194  DeviceExtension->AdapterInterfaceType =
195  DriverExtension->InitializationData.AdapterInterfaceType;
196 
197  if (PhysicalDeviceObject != NULL)
198  {
199  /* Get bus type from the upper level bus driver. */
200  Size = sizeof(ULONG);
203  Size,
204  &DeviceExtension->AdapterInterfaceType,
205  &Size);
206 
207  /* Get bus device address from the upper level bus driver. */
208  Size = sizeof(ULONG);
211  Size,
212  &PciSlotNumber,
213  &Size);
214 
215  /* Convert slotnumber to PCI_SLOT_NUMBER */
216  SlotNumber.u.AsULONG = 0;
217  SlotNumber.u.bits.DeviceNumber = (PciSlotNumber >> 16) & 0xFFFF;
218  SlotNumber.u.bits.FunctionNumber = PciSlotNumber & 0xFFFF;
219  DeviceExtension->SystemIoSlotNumber = SlotNumber.u.AsULONG;
220  }
221 
222  InitializeListHead(&DeviceExtension->AddressMappingListHead);
223  InitializeListHead(&DeviceExtension->DmaAdapterList);
224 
225  KeInitializeDpc(&DeviceExtension->DpcObject,
227  DeviceExtension);
228 
229  KeInitializeMutex(&DeviceExtension->DeviceLock, 0);
230 
231  /* Attach the device. */
232  if (PhysicalDeviceObject != NULL)
234  *DeviceObject,
236 
237  IntCreateNewRegistryPath(DeviceExtension);
238  IntSetupDeviceSettingsKey(DeviceExtension);
239 
240  /* Remove the initailizing flag */
241  (*DeviceObject)->Flags &= ~DO_DEVICE_INITIALIZING;
242  return STATUS_SUCCESS;
243 }
244 
245 
246 NTSTATUS
247 NTAPI
252 {
253  WCHAR DeviceVideoBuffer[20];
254  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
256  VIDEO_PORT_CONFIG_INFO ConfigInfo;
258  UCHAR Again = FALSE;
259  WCHAR DeviceBuffer[20];
261  WCHAR SymlinkBuffer[20];
262  UNICODE_STRING SymlinkName;
263  BOOL LegacyDetection = FALSE;
265 
267  DeviceNumber = DeviceExtension->DeviceNumber;
268 
269  /* Setup a ConfigInfo structure that we will pass to HwFindAdapter. */
270  RtlZeroMemory(&ConfigInfo, sizeof(VIDEO_PORT_CONFIG_INFO));
271  ConfigInfo.Length = sizeof(VIDEO_PORT_CONFIG_INFO);
272  ConfigInfo.AdapterInterfaceType = DeviceExtension->AdapterInterfaceType;
273  if (ConfigInfo.AdapterInterfaceType == PCIBus)
274  ConfigInfo.InterruptMode = LevelSensitive;
275  else
276  ConfigInfo.InterruptMode = Latched;
277  ConfigInfo.DriverRegistryPath = DriverExtension->RegistryPath.Buffer;
279  ConfigInfo.SystemIoBusNumber = DeviceExtension->SystemIoBusNumber;
280  ConfigInfo.BusInterruptLevel = DeviceExtension->InterruptLevel;
281  ConfigInfo.BusInterruptVector = DeviceExtension->InterruptVector;
282 
285  sizeof(SystemBasicInfo),
286  NULL);
287  if (NT_SUCCESS(Status))
288  {
291  }
292 
293  /*
294  * Call miniport HwVidFindAdapter entry point to detect if
295  * particular device is present. There are two possible code
296  * paths. The first one is for Legacy drivers (NT4) and cases
297  * when we don't have information about what bus we're on. The
298  * second case is the standard one for Plug & Play drivers.
299  */
300  if (DeviceExtension->PhysicalDeviceObject == NULL)
301  {
302  LegacyDetection = TRUE;
303  }
304 
305  if (LegacyDetection)
306  {
307  ULONG BusNumber, MaxBuses;
308 
309  MaxBuses = DeviceExtension->AdapterInterfaceType == PCIBus ? PCI_MAX_BRIDGE_NUMBER : 1;
310 
311  for (BusNumber = 0; BusNumber < MaxBuses; BusNumber++)
312  {
313  DeviceExtension->SystemIoBusNumber =
314  ConfigInfo.SystemIoBusNumber = BusNumber;
315 
316  RtlZeroMemory(&DeviceExtension->MiniPortDeviceExtension,
317  DriverExtension->InitializationData.HwDeviceExtensionSize);
318 
319  /* FIXME: Need to figure out what string to pass as param 3. */
320  Status = DriverExtension->InitializationData.HwFindAdapter(
321  &DeviceExtension->MiniPortDeviceExtension,
322  DriverExtension->HwContext,
323  NULL,
324  &ConfigInfo,
325  &Again);
326 
328  {
329  continue;
330  }
331  else if (Status == NO_ERROR)
332  {
333  break;
334  }
335  else
336  {
337  ERR_(VIDEOPRT, "HwFindAdapter call failed with error 0x%X\n", Status);
338  goto Failure;
339  }
340  }
341  }
342  else
343  {
344  /* FIXME: Need to figure out what string to pass as param 3. */
345  Status = DriverExtension->InitializationData.HwFindAdapter(
346  &DeviceExtension->MiniPortDeviceExtension,
347  DriverExtension->HwContext,
348  NULL,
349  &ConfigInfo,
350  &Again);
351  }
352 
353  if (Status != NO_ERROR)
354  {
355  ERR_(VIDEOPRT, "HwFindAdapter call failed with error 0x%X\n", Status);
356  goto Failure;
357  }
358 
359  /*
360  * Now we know the device is present, so let's do all additional tasks
361  * such as creating symlinks or setting up interrupts and timer.
362  */
363 
364  /* Create a unicode device name. */
365  swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
366  RtlInitUnicodeString(&DeviceName, DeviceBuffer);
367 
368  /* Create symbolic link "\??\DISPLAYx" */
369  swprintf(SymlinkBuffer, L"\\??\\DISPLAY%lu", DeviceNumber + 1);
370  RtlInitUnicodeString(&SymlinkName, SymlinkBuffer);
371  IoCreateSymbolicLink(&SymlinkName, &DeviceName);
372 
373  /* Add entry to DEVICEMAP\VIDEO key in registry. */
374  swprintf(DeviceVideoBuffer, L"\\Device\\Video%d", DeviceNumber);
377  L"VIDEO",
378  DeviceVideoBuffer,
379  REG_SZ,
380  DeviceExtension->RegistryPath.Buffer,
381  DeviceExtension->RegistryPath.Length + sizeof(UNICODE_NULL));
382 
385  L"VIDEO",
386  L"MaxObjectNumber",
387  REG_DWORD,
388  &DeviceNumber,
389  sizeof(DeviceNumber));
390 
391  /* FIXME: Allocate hardware resources for device. */
392 
393  /* Allocate interrupt for device. */
395  {
397  goto Failure;
398  }
399 
400  /* Allocate timer for device. */
402  {
403  if (DeviceExtension->InterruptObject != NULL)
404  IoDisconnectInterrupt(DeviceExtension->InterruptObject);
405  ERR_(VIDEOPRT, "IntVideoPortSetupTimer failed\n");
407  goto Failure;
408  }
409 
410  /* If the device can be reset, insert it in the list of resettable adapters */
411  InitializeListHead(&DeviceExtension->HwResetListEntry);
412  if (DriverExtension->InitializationData.HwResetHw != NULL)
413  {
415  &DeviceExtension->HwResetListEntry,
417  }
418 
419  /* Query children of the device. */
421 
422  INFO_(VIDEOPRT, "STATUS_SUCCESS\n");
423  return STATUS_SUCCESS;
424 
425 Failure:
426  RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
427  if (DeviceExtension->NextDeviceObject)
428  IoDetachDevice(DeviceExtension->NextDeviceObject);
430  return Status;
431 }
432 
433 VOID
434 FASTCALL
436  PKPROCESS *CallingProcess,
438 {
439  *CallingProcess = (PKPROCESS)PsGetCurrentProcess();
440  if (*CallingProcess != CsrProcess)
441  {
443  }
444 }
445 
446 VOID
447 FASTCALL
449  PKPROCESS *CallingProcess,
451 {
452  if (*CallingProcess != CsrProcess)
453  {
455  }
456 }
457 
458 /* PUBLIC FUNCTIONS ***********************************************************/
459 
460 /*
461  * @implemented
462  */
463 ULONG
464 NTAPI
466  IN PVOID Context1,
467  IN PVOID Context2,
470 {
475  BOOLEAN PnpDriver = FALSE, LegacyDetection = FALSE;
476  static BOOLEAN FirstInitialization;
477 
478  TRACE_(VIDEOPRT, "VideoPortInitialize\n");
479 
480  if (!FirstInitialization)
481  {
484  FirstInitialization = TRUE;
485  }
486 
487  /* As a first thing do parameter checks. */
488  if (HwInitializationData->HwInitDataSize > sizeof(VIDEO_HW_INITIALIZATION_DATA))
489  {
490  ERR_(VIDEOPRT, "Invalid HwInitializationData\n");
492  }
493 
494  if ((HwInitializationData->HwFindAdapter == NULL) ||
495  (HwInitializationData->HwInitialize == NULL) ||
496  (HwInitializationData->HwStartIO == NULL))
497  {
498  ERR_(VIDEOPRT, "Invalid HwInitializationData\n");
500  }
501 
502  switch (HwInitializationData->HwInitDataSize)
503  {
504  /*
505  * NT4 drivers are special case, because we must use legacy method
506  * of detection instead of the Plug & Play one.
507  */
509  INFO_(VIDEOPRT, "We were loaded by a Windows NT miniport driver.\n");
510  break;
511 
513  INFO_(VIDEOPRT, "We were loaded by a Windows 2000 miniport driver.\n");
514  break;
515 
516  case sizeof(VIDEO_HW_INITIALIZATION_DATA):
517  INFO_(VIDEOPRT, "We were loaded by a Windows XP or later miniport driver.\n");
518  break;
519 
520  default:
521  ERR_(VIDEOPRT, "Invalid HwInitializationData size.\n");
522  return STATUS_UNSUCCESSFUL;
523  }
524 
525  /* Set dispatching routines */
533 
534  /* Determine type of the miniport driver */
535  if ((HwInitializationData->HwInitDataSize >=
536  FIELD_OFFSET(VIDEO_HW_INITIALIZATION_DATA, HwQueryInterface)) &&
537  (HwInitializationData->HwSetPowerState != NULL) &&
538  (HwInitializationData->HwGetPowerState != NULL) &&
539  (HwInitializationData->HwGetVideoChildDescriptor != NULL))
540  {
541  INFO_(VIDEOPRT, "The miniport is a PnP miniport driver\n");
542  PnpDriver = TRUE;
543  }
544 
545  /* Check if legacy detection should be applied */
546  if (!PnpDriver || HwContext)
547  {
548  INFO_(VIDEOPRT, "Legacy detection for adapter interface %d\n",
549  HwInitializationData->AdapterInterfaceType);
550 
551  /* FIXME: Move the code for legacy detection
552  to another function and call it here */
553  LegacyDetection = TRUE;
554  }
555 
556  /*
557  * NOTE:
558  * The driver extension can be already allocated in case that we were
559  * called by legacy driver and failed detecting device. Some miniport
560  * drivers in that case adjust parameters and call VideoPortInitialize
561  * again.
562  */
564  if (DriverExtension == NULL)
565  {
567  DriverObject,
569  (PVOID *)&DriverExtension);
570  if (!NT_SUCCESS(Status))
571  {
572  ERR_(VIDEOPRT, "IoAllocateDriverObjectExtension failed 0x%x\n", Status);
573  return Status;
574  }
575 
576  /*
577  * Save the registry path. This should be done only once even if
578  * VideoPortInitialize is called multiple times.
579  */
580  if (RegistryPath->Length != 0)
581  {
582  DriverExtension->RegistryPath.Length = 0;
583  DriverExtension->RegistryPath.MaximumLength =
584  RegistryPath->Length + sizeof(UNICODE_NULL);
585  DriverExtension->RegistryPath.Buffer =
587  PagedPool,
588  DriverExtension->RegistryPath.MaximumLength,
589  'RTSU');
590  if (DriverExtension->RegistryPath.Buffer == NULL)
591  {
592  RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL);
594  }
595 
597  INFO_(VIDEOPRT, "RegistryPath: %wZ\n", &DriverExtension->RegistryPath);
598  }
599  else
600  {
601  RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL);
602  }
603  }
604 
605  /* Copy the correct miniport initialization data to the device extension. */
606  RtlCopyMemory(&DriverExtension->InitializationData,
608  HwInitializationData->HwInitDataSize);
609  if (HwInitializationData->HwInitDataSize <
611  {
612  RtlZeroMemory((PVOID)((ULONG_PTR)&DriverExtension->InitializationData +
613  HwInitializationData->HwInitDataSize),
615  HwInitializationData->HwInitDataSize);
616  }
617  DriverExtension->HwContext = HwContext;
618 
619  /*
620  * Plug & Play drivers registers the device in AddDevice routine.
621  * For legacy drivers we must do it now.
622  */
623  if (LegacyDetection)
624  {
626 
628  {
629  /* Power management */
631  }
632 
635  NULL,
636  &DeviceObject);
637  if (!NT_SUCCESS(Status))
638  {
639  ERR_(VIDEOPRT, "IntVideoPortCreateAdapterDeviceObject returned 0x%x\n", Status);
640  return Status;
641  }
642 
644  if (NT_SUCCESS(Status))
646  else
647  ERR_(VIDEOPRT, "IntVideoPortFindAdapter returned 0x%x\n", Status);
648 
649  return Status;
650  }
651  else
652  {
657 
658  return STATUS_SUCCESS;
659  }
660 }
661 
662 /*
663  * @implemented
664  */
665 VOID
667  IN VIDEO_DEBUG_LEVEL DebugPrintLevel,
668  IN PCHAR DebugMessage,
669  ...)
670 {
671  va_list ap;
672 
673  va_start(ap, DebugMessage);
674  vDbgPrintEx(DPFLTR_IHVVIDEO_ID, DebugPrintLevel, DebugMessage, ap);
675  va_end(ap);
676 }
677 
678 /*
679  * @unimplemented
680  */
681 VOID
682 NTAPI
684  IN PVOID HwDeviceExtension,
687  IN ULONG UniqueId)
688 {
690 
691  INFO_(VIDEOPRT, "VideoPortLogError ErrorCode %d (0x%x) UniqueId %lu (0x%lx)\n",
692  ErrorCode, ErrorCode, UniqueId, UniqueId);
693  if (Vrp)
694  INFO_(VIDEOPRT, "Vrp->IoControlCode %lu (0x%lx)\n", Vrp->IoControlCode, Vrp->IoControlCode);
695 }
696 
697 /*
698  * @implemented
699  */
700 UCHAR
701 NTAPI
703 {
704  return KeGetCurrentIrql();
705 }
706 
708 {
713 
714 static
715 NTSTATUS
716 NTAPI
722  IN PVOID Context,
724 {
726 
727  INFO_(VIDEOPRT, "Found registry value for name %S: type %d, length %d\n",
729  return (*(CallbackContext->HwGetRegistryRoutine))(
730  CallbackContext->HwDeviceExtension,
731  CallbackContext->HwContext,
732  ValueName,
733  ValueData,
734  ValueLength);
735 }
736 
737 /*
738  * @unimplemented
739  */
740 
741 VP_STATUS
742 NTAPI
744  IN PVOID HwDeviceExtension,
746  IN UCHAR IsParameterFileName,
747  IN PMINIPORT_GET_REGISTRY_ROUTINE GetRegistryRoutine,
749 {
752  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
754 
755  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
756 
757  TRACE_(VIDEOPRT, "VideoPortGetRegistryParameters ParameterName %S, RegPath: %wZ\n",
758  ParameterName, &DeviceExtension->RegistryPath);
759 
760  Context.HwDeviceExtension = HwDeviceExtension;
761  Context.HwContext = HwContext;
762  Context.HwGetRegistryRoutine = GetRegistryRoutine;
763 
767 
769  DeviceExtension->RegistryPath.Buffer,
770  QueryTable,
771  &Context,
772  NULL);
773  if (!NT_SUCCESS(Status))
774  {
775  WARN_(VIDEOPRT, "VideoPortGetRegistryParameters could not find the "
776  "requested parameter\n");
778  }
779 
780  if (IsParameterFileName)
781  {
782  /* FIXME: need to read the contents of the file */
784  }
785 
786  return NO_ERROR;
787 }
788 
789 /*
790  * @implemented
791  */
792 VP_STATUS
793 NTAPI
795  IN PVOID HwDeviceExtension,
799 {
800  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
802 
803  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
804  TRACE_(VIDEOPRT, "VideoPortSetRegistryParameters ParameterName %S, RegPath: %wZ\n",
805  ValueName,
806  &DeviceExtension->RegistryPath);
809  DeviceExtension->RegistryPath.Buffer,
810  ValueName,
811  REG_BINARY,
812  ValueData,
813  ValueLength);
814  if (Status != NO_ERROR)
815  WARN_(VIDEOPRT, "VideoPortSetRegistryParameters error 0x%x\n", Status);
816 
817  return Status;
818 }
819 
820 /*
821  * @implemented
822  */
823 VP_STATUS
824 NTAPI
826  IN PVOID HwDeviceExtension,
827  OUT PULONG VgaStatus)
828 {
829  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
830 
831  TRACE_(VIDEOPRT, "VideoPortGetVgaStatus\n");
832 
833  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
835  {
836  if (DeviceExtension->AdapterInterfaceType == PCIBus)
837  {
838  /* VgaStatus: 0 == VGA not enabled, 1 == VGA enabled. */
839  /* Assumed for now */
840  *VgaStatus = 1;
841  return NO_ERROR;
842  }
843  }
844 
845  return ERROR_INVALID_FUNCTION;
846 }
847 
848 /*
849  * @implemented
850  */
851 PVOID
852 NTAPI
854  IN PVOID HwDeviceExtension,
855  IN PVOID Unused1,
856  IN ULONG Unused2,
857  IN ULONG Length)
858 {
859  static PVOID RomImageBuffer = NULL;
860  PKPROCESS CallingProcess;
862 
863  TRACE_(VIDEOPRT, "VideoPortGetRomImage(HwDeviceExtension 0x%X Length 0x%X)\n",
864  HwDeviceExtension, Length);
865 
866  /* If the length is zero then free the existing buffer. */
867  if (Length == 0)
868  {
869  if (RomImageBuffer != NULL)
870  {
871  ExFreePool(RomImageBuffer);
872  RomImageBuffer = NULL;
873  }
874  return NULL;
875  }
876  else
877  {
878  /*
879  * The DDK says we shouldn't use the legacy C0000 method but get the
880  * rom base address from the corresponding pci or acpi register but
881  * lets ignore that and use C0000 anyway. We have already mapped the
882  * bios area into memory so we'll copy from there.
883  */
884 
885  /* Copy the bios. */
886  Length = min(Length, 0x10000);
887  if (RomImageBuffer != NULL)
888  {
889  ExFreePool(RomImageBuffer);
890  }
891 
892  RomImageBuffer = ExAllocatePool(PagedPool, Length);
893  if (RomImageBuffer == NULL)
894  {
895  return NULL;
896  }
897 
898  IntAttachToCSRSS(&CallingProcess, &ApcState);
899  RtlCopyMemory(RomImageBuffer, (PUCHAR)0xC0000, Length);
900  IntDetachFromCSRSS(&CallingProcess, &ApcState);
901 
902  return RomImageBuffer;
903  }
904 }
905 
906 /*
907  * @implemented
908  */
909 BOOLEAN
910 NTAPI
912  IN PVOID HwDeviceExtension,
913  IN PUCHAR RomBase,
914  IN ULONG RomLength,
915  IN PUCHAR String)
916 {
917  SIZE_T StringLength;
918  BOOLEAN Found;
919  PUCHAR SearchLocation;
920 
921  TRACE_(VIDEOPRT, "VideoPortScanRom RomBase %p RomLength 0x%x String %s\n", RomBase, RomLength, String);
922 
923  StringLength = strlen((PCHAR)String);
924  Found = FALSE;
925  SearchLocation = RomBase;
926  for (SearchLocation = RomBase;
927  !Found && SearchLocation < RomBase + RomLength - StringLength;
928  SearchLocation++)
929  {
930  Found = (RtlCompareMemory(SearchLocation, String, StringLength) == StringLength);
931  if (Found)
932  {
933  INFO_(VIDEOPRT, "Match found at %p\n", SearchLocation);
934  }
935  }
936 
937  return Found;
938 }
939 
940 /*
941  * @implemented
942  */
943 BOOLEAN
944 NTAPI
946  IN PVOID HwDeviceExtension,
949  OUT PVOID Context)
950 {
951  BOOLEAN Ret;
952  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
953  KIRQL OldIrql;
954 
955  switch (Priority)
956  {
957  case VpLowPriority:
958  Ret = (*SynchronizeRoutine)(Context);
959  break;
960 
961  case VpMediumPriority:
962  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
963  if (DeviceExtension->InterruptObject == NULL)
964  Ret = (*SynchronizeRoutine)(Context);
965  else
967  DeviceExtension->InterruptObject,
969  Context);
970  break;
971 
972  case VpHighPriority:
974  if (OldIrql < SYNCH_LEVEL)
976 
977  Ret = (*SynchronizeRoutine)(Context);
978 
979  if (OldIrql < SYNCH_LEVEL)
981  break;
982 
983  default:
984  Ret = FALSE;
985  }
986 
987  return Ret;
988 }
989 
990 /*
991  * @implemented
992  */
993 VP_STATUS
994 NTAPI
996  IN PVOID HwDeviceExtension,
997  IN PVOID Reserved)
998 {
999  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1000  ULONG Status;
1001  VIDEO_CHILD_ENUM_INFO ChildEnumInfo;
1002  BOOLEAN bHaveLastMonitorID = FALSE;
1003  UCHAR LastMonitorID[10];
1004  ULONG Unused;
1005  UINT i;
1006  PDEVICE_OBJECT ChildDeviceObject;
1007  PVIDEO_PORT_CHILD_EXTENSION ChildExtension;
1008 
1009  INFO_(VIDEOPRT, "Starting child device probe\n");
1010  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1012  {
1013  WARN_(VIDEOPRT, "Miniport's HwGetVideoChildDescriptor is NULL!\n");
1014  return NO_ERROR;
1015  }
1016 
1017  if (!IsListEmpty(&DeviceExtension->ChildDeviceList))
1018  {
1019  ERR_(VIDEOPRT, "FIXME: Support calling VideoPortEnumerateChildren again!\n");
1020  return NO_ERROR;
1021  }
1022 
1023  /* Enumerate the children */
1024  for (i = 1; ; i++)
1025  {
1026  Status = IoCreateDevice(DeviceExtension->DriverObject,
1027  sizeof(VIDEO_PORT_CHILD_EXTENSION) +
1029  NULL,
1032  FALSE,
1033  &ChildDeviceObject);
1034  if (!NT_SUCCESS(Status))
1035  return Status;
1036 
1037  ChildExtension = ChildDeviceObject->DeviceExtension;
1038 
1039  RtlZeroMemory(ChildExtension,
1040  sizeof(VIDEO_PORT_CHILD_EXTENSION) +
1042 
1043  ChildExtension->Common.Fdo = FALSE;
1044  ChildExtension->ChildId = i;
1045  ChildExtension->PhysicalDeviceObject = ChildDeviceObject;
1046  ChildExtension->DriverObject = DeviceExtension->DriverObject;
1047 
1048  /* Setup the ChildEnumInfo */
1049  ChildEnumInfo.Size = sizeof(ChildEnumInfo);
1050  ChildEnumInfo.ChildDescriptorSize = sizeof(ChildExtension->ChildDescriptor);
1051  ChildEnumInfo.ACPIHwId = 0;
1052 
1054  ChildEnumInfo.ChildHwDeviceExtension = VIDEO_PORT_GET_CHILD_EXTENSION(ChildExtension);
1055  else
1056  ChildEnumInfo.ChildHwDeviceExtension = NULL;
1057 
1058  ChildEnumInfo.ChildIndex = ChildExtension->ChildId;
1059 
1060  INFO_(VIDEOPRT, "Probing child: %d\n", ChildEnumInfo.ChildIndex);
1062  HwDeviceExtension,
1063  &ChildEnumInfo,
1064  &ChildExtension->ChildType,
1065  ChildExtension->ChildDescriptor,
1066  &ChildExtension->ChildId,
1067  &Unused);
1069  {
1070  if (ChildExtension->ChildType == Monitor)
1071  {
1072  // Check if the EDID is valid
1073  if (ChildExtension->ChildDescriptor[0] == 0x00 &&
1074  ChildExtension->ChildDescriptor[1] == 0xFF &&
1075  ChildExtension->ChildDescriptor[2] == 0xFF &&
1076  ChildExtension->ChildDescriptor[3] == 0xFF &&
1077  ChildExtension->ChildDescriptor[4] == 0xFF &&
1078  ChildExtension->ChildDescriptor[5] == 0xFF &&
1079  ChildExtension->ChildDescriptor[6] == 0xFF &&
1080  ChildExtension->ChildDescriptor[7] == 0x00)
1081  {
1082  if (bHaveLastMonitorID)
1083  {
1084  // Compare the previous monitor ID with the current one, break the loop if they are identical
1085  if (RtlCompareMemory(LastMonitorID, &ChildExtension->ChildDescriptor[8], sizeof(LastMonitorID)) == sizeof(LastMonitorID))
1086  {
1087  INFO_(VIDEOPRT, "Found identical Monitor ID two times, stopping enumeration\n");
1088  IoDeleteDevice(ChildDeviceObject);
1089  break;
1090  }
1091  }
1092 
1093  // Copy 10 bytes from the EDID, which can be used to uniquely identify the monitor
1094  RtlCopyMemory(LastMonitorID, &ChildExtension->ChildDescriptor[8], sizeof(LastMonitorID));
1095  bHaveLastMonitorID = TRUE;
1096 
1097  /* Mark it valid */
1098  ChildExtension->EdidValid = TRUE;
1099  }
1100  else
1101  {
1102  /* Mark it invalid */
1103  ChildExtension->EdidValid = FALSE;
1104  }
1105  }
1106  }
1107  else if (Status == VIDEO_ENUM_INVALID_DEVICE)
1108  {
1109  WARN_(VIDEOPRT, "Child device %d is invalid!\n", ChildEnumInfo.ChildIndex);
1110  IoDeleteDevice(ChildDeviceObject);
1111  continue;
1112  }
1113  else if (Status == VIDEO_ENUM_NO_MORE_DEVICES)
1114  {
1115  INFO_(VIDEOPRT, "End of child enumeration! (%d children enumerated)\n", i - 1);
1116  IoDeleteDevice(ChildDeviceObject);
1117  break;
1118  }
1119  else
1120  {
1121  WARN_(VIDEOPRT, "HwGetVideoChildDescriptor returned unknown status code 0x%x!\n", Status);
1122  IoDeleteDevice(ChildDeviceObject);
1123  break;
1124  }
1125 
1126  if (ChildExtension->ChildType == Monitor)
1127  {
1128  UINT j;
1129  PUCHAR p = ChildExtension->ChildDescriptor;
1130  INFO_(VIDEOPRT, "Monitor device enumerated! (ChildId = 0x%x)\n", ChildExtension->ChildId);
1131  for (j = 0; j < sizeof (ChildExtension->ChildDescriptor); j += 8)
1132  {
1133  INFO_(VIDEOPRT, "%02x %02x %02x %02x %02x %02x %02x %02x\n",
1134  p[j + 0], p[j + 1], p[j + 2], p[j + 3],
1135  p[j + 4], p[j + 5], p[j + 6], p[j + 7]);
1136  }
1137  }
1138  else if (ChildExtension->ChildType == Other)
1139  {
1140  INFO_(VIDEOPRT, "\"Other\" device enumerated: DeviceId = %S\n", (PWSTR)ChildExtension->ChildDescriptor);
1141  }
1142  else
1143  {
1144  ERR_(VIDEOPRT, "HwGetVideoChildDescriptor returned unsupported type: %d\n", ChildExtension->ChildType);
1145  }
1146 
1147  /* Clear the init flag */
1148  ChildDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
1149 
1150  InsertTailList(&DeviceExtension->ChildDeviceList,
1151  &ChildExtension->ListEntry);
1152  }
1153 
1154  /* Trigger reenumeration by the PnP manager */
1156 
1157  return NO_ERROR;
1158 }
1159 
1160 /*
1161  * @unimplemented
1162  */
1163 VP_STATUS
1164 NTAPI
1166  IN PVOID HwDeviceExtension,
1167  IN OUT PVOID *SecondaryDeviceExtension,
1168  IN ULONG Flag)
1169 {
1170  UNIMPLEMENTED;
1171  return ERROR_DEV_NOT_EXIST;
1172 }
1173 
1174 /*
1175  * @implemented
1176  */
1177 BOOLEAN
1178 NTAPI
1180  IN PVOID HwDeviceExtension,
1182  IN PVOID Context)
1183 {
1184  return KeInsertQueueDpc(
1185  &VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension)->DpcObject,
1187  (PVOID)Context);
1188 }
1189 
1190 /*
1191  * @implemented
1192  */
1193 PVOID
1194 NTAPI
1197 {
1198  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1199 
1200  TRACE_(VIDEOPRT, "VideoPortGetAssociatedDeviceExtension\n");
1201  DeviceExtension = ((PDEVICE_OBJECT)DeviceObject)->DeviceExtension;
1202  if (!DeviceExtension)
1203  return NULL;
1204  return DeviceExtension->MiniPortDeviceExtension;
1205 }
1206 
1207 /*
1208  * @implemented
1209  */
1210 VP_STATUS
1211 NTAPI
1213  IN PVOID HwDeviceExtension,
1214  IN OUT PVPOSVERSIONINFO VpOsVersionInfo)
1215 {
1217 
1218  Version.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
1219  if (VpOsVersionInfo->Size >= sizeof(VPOSVERSIONINFO))
1220  {
1221 #if 1
1223  {
1224  VpOsVersionInfo->MajorVersion = Version.dwMajorVersion;
1225  VpOsVersionInfo->MinorVersion = Version.dwMinorVersion;
1226  VpOsVersionInfo->BuildNumber = Version.dwBuildNumber;
1227  VpOsVersionInfo->ServicePackMajor = Version.wServicePackMajor;
1228  VpOsVersionInfo->ServicePackMinor = Version.wServicePackMinor;
1229  return NO_ERROR;
1230  }
1231  return ERROR_INVALID_PARAMETER;
1232 #else
1233  VpOsVersionInfo->MajorVersion = 5;
1234  VpOsVersionInfo->MinorVersion = 0;
1235  VpOsVersionInfo->BuildNumber = 2195;
1236  VpOsVersionInfo->ServicePackMajor = 4;
1237  VpOsVersionInfo->ServicePackMinor = 0;
1238  return NO_ERROR;
1239 #endif
1240  }
1241 
1242  return ERROR_INVALID_PARAMETER;
1243 }
1244 
1245 /*
1246  * @implemented
1247  */
1248 BOOLEAN
1249 NTAPI
1251  IN PVOID HwDeviceExtension,
1252  IN USHORT VendorId,
1253  IN USHORT DeviceId,
1254  IN UCHAR RevisionId,
1255  IN USHORT SubVendorId,
1256  IN USHORT SubSystemId,
1257  IN ULONG Flags)
1258 {
1259  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1262  IO_STACK_LOCATION IoStack;
1263  ULONG PciFlags = 0;
1264  NTSTATUS Status;
1265  BOOL DevicePresent;
1266 
1267  TRACE_(VIDEOPRT, "VideoPortCheckForDeviceExistence\n");
1268 
1270  {
1271  WARN_(VIDEOPRT, "VideoPortCheckForDeviceExistence: Unknown flags 0x%lx\n", Flags & ~(CDE_USE_REVISION | CDE_USE_SUBSYSTEM_IDS));
1272  return FALSE;
1273  }
1274 
1275  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1276 
1278  PciDevicePresentInterface.Version = 1;
1280  IoStack.Parameters.QueryInterface.Version = PciDevicePresentInterface.Version;
1282  IoStack.Parameters.QueryInterface.InterfaceType =
1283  &GUID_PCI_DEVICE_PRESENT_INTERFACE;
1284  Status = IopInitiatePnpIrp(DeviceExtension->NextDeviceObject,
1286  if (!NT_SUCCESS(Status))
1287  {
1288  WARN_(VIDEOPRT, "IopInitiatePnpIrp() failed! (Status 0x%lx)\n", Status);
1289  return FALSE;
1290  }
1291 
1292  if (Flags & CDE_USE_REVISION)
1293  PciFlags |= PCI_USE_REVISION;
1295  PciFlags |= PCI_USE_SUBSYSTEM_IDS;
1296 
1297  DevicePresent = PciDevicePresentInterface.IsDevicePresent(
1298  VendorId, DeviceId, RevisionId,
1299  SubVendorId, SubSystemId, PciFlags);
1300 
1301  PciDevicePresentInterface.InterfaceDereference(PciDevicePresentInterface.Context);
1302 
1303  return DevicePresent;
1304 }
1305 
1306 /*
1307  * @unimplemented
1308  */
1309 VP_STATUS
1310 NTAPI
1312  IN PVOID HwDeviceExtension,
1313  IN ULONG BugcheckCode,
1315  IN ULONG BugcheckDataSize)
1316 {
1317  UNIMPLEMENTED;
1318  return NO_ERROR;
1319 }
1320 
1321 /*
1322  * @implemented
1323  */
1324 LONGLONG
1325 NTAPI
1327  IN PVOID HwDeviceExtension,
1328  OUT PLONGLONG PerformanceFrequency OPTIONAL)
1329 {
1331 
1332  TRACE_(VIDEOPRT, "VideoPortQueryPerformanceCounter\n");
1333  Result = KeQueryPerformanceCounter((PLARGE_INTEGER)PerformanceFrequency);
1334  return Result.QuadPart;
1335 }
1336 
1337 /*
1338  * @implemented
1339  */
1340 VOID
1341 NTAPI
1343  IN PVOID HwDeviceExtension)
1344 {
1345  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1346  NTSTATUS Status;
1347  (void)Status;
1348 
1349  TRACE_(VIDEOPRT, "VideoPortAcquireDeviceLock\n");
1350  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1351  Status = KeWaitForMutexObject(&DeviceExtension->DeviceLock, Executive,
1352  KernelMode, FALSE, NULL);
1353  // ASSERT(Status == STATUS_SUCCESS);
1354 }
1355 
1356 /*
1357  * @implemented
1358  */
1359 VOID
1360 NTAPI
1362  IN PVOID HwDeviceExtension)
1363 {
1364  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1365  LONG Status;
1366  (void)Status;
1367 
1368  TRACE_(VIDEOPRT, "VideoPortReleaseDeviceLock\n");
1369  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1370  Status = KeReleaseMutex(&DeviceExtension->DeviceLock, FALSE);
1371  //ASSERT(Status == STATUS_SUCCESS);
1372 }
1373 
1374 /*
1375  * @unimplemented
1376  */
1377 VOID
1378 NTAPI
1381  IN PVOID Data)
1382 {
1383  UNIMPLEMENTED;
1384 }
1385 
1386 /*
1387  * @implemented
1388  */
1389 PVOID
1390 NTAPI
1392  IN PVOID HwDeviceExtension,
1395 )
1396 {
1397 
1399 }
1400 
1401 /*
1402  * @implemented
1403  */
1404 BOOLEAN
1405 NTAPI
1407 {
1408  NTSTATUS Status;
1409  HANDLE KeyHandle;
1410  UNICODE_STRING Path = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control");
1411  UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"SystemStartOptions");
1415 
1416  /* Initialize object attributes with the path we want */
1418  &Path,
1420  NULL,
1421  NULL);
1422 
1423  /* Open the key */
1424  Status = ZwOpenKey(&KeyHandle,
1426  &ObjectAttributes);
1427 
1428  if (!NT_SUCCESS(Status))
1429  {
1430  VideoPortDebugPrint(Error, "ZwOpenKey failed (0x%x)\n", Status);
1431  return FALSE;
1432  }
1433 
1434  /* Find out how large our buffer should be */
1435  Status = ZwQueryValueKey(KeyHandle,
1436  &ValueName,
1438  NULL,
1439  0,
1440  &Length);
1442  {
1443  VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status);
1444  ZwClose(KeyHandle);
1445  return FALSE;
1446  }
1447 
1448  /* Allocate it */
1449  KeyInfo = ExAllocatePool(PagedPool, Length);
1450  if (!KeyInfo)
1451  {
1452  VideoPortDebugPrint(Error, "Out of memory\n");
1453  ZwClose(KeyHandle);
1454  return FALSE;
1455  }
1456 
1457  /* Now for real this time */
1458  Status = ZwQueryValueKey(KeyHandle,
1459  &ValueName,
1461  KeyInfo,
1462  Length,
1463  &NewLength);
1464 
1465  ZwClose(KeyHandle);
1466 
1467  if (!NT_SUCCESS(Status))
1468  {
1469  VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status);
1470  ExFreePool(KeyInfo);
1471  return FALSE;
1472  }
1473 
1474  /* Sanity check */
1475  if (KeyInfo->Type != REG_SZ)
1476  {
1477  VideoPortDebugPrint(Error, "Invalid type for SystemStartOptions\n");
1478  ExFreePool(KeyInfo);
1479  return FALSE;
1480  }
1481 
1482  /* Check if NOVESA or BASEVIDEO is present in the start options */
1483  if (wcsstr((PWCHAR)KeyInfo->Data, L"NOVESA") ||
1484  wcsstr((PWCHAR)KeyInfo->Data, L"BASEVIDEO"))
1485  {
1486  VideoPortDebugPrint(Info, "VESA mode disabled\n");
1487  ExFreePool(KeyInfo);
1488  return TRUE;
1489  }
1490 
1491  ExFreePool(KeyInfo);
1492 
1493  VideoPortDebugPrint(Info, "VESA mode enabled\n");
1494 
1495  return FALSE;
1496 }
#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:248
#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:52
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:4004
#define IN
Definition: typedefs.h:38
VOID NTAPI VpNotifyEaData(IN PDEVICE_OBJECT DeviceObject, IN PVOID Data)
Definition: videoprt.c:1379
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 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:359
#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
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
NTSTATUS NTAPI IntCreateNewRegistryPath(PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: registry.c:358
VOID NTAPI IntVideoPortDeferredRoutine(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: videoprt.c:75
NTSTATUS NTAPI RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
Definition: version.c:158
#define INFO_(ch,...)
Definition: debug.h:159
NTSTATUS NTAPI IoAllocateDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress, IN ULONG DriverObjectExtensionSize, OUT PVOID *DriverObjectExtension)
Definition: driver.c:1764
#define KeWaitForMutexObject
Definition: kefuncs.h:568
_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:1391
#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
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
uint16_t * PWSTR
Definition: typedefs.h:54
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:911
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:4016
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:1195
_In_ KPRIORITY Priority
Definition: kefuncs.h:516
_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:1212
VP_STATUS NTAPI VideoPortRegisterBugcheckCallback(IN PVOID HwDeviceExtension, IN ULONG BugcheckCode, IN PVIDEO_BUGCHECK_CALLBACK Callback, IN ULONG BugcheckDataSize)
Definition: videoprt.c:1311
KMUTEX VideoPortInt10Mutex
Definition: videoprt.c:35
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:33
BOOLEAN NTAPI VideoPortSynchronizeExecution(IN PVOID HwDeviceExtension, IN VIDEO_SYNCHRONIZE_PRIORITY Priority, IN PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine, OUT PVOID Context)
Definition: videoprt.c:945
NTSTATUS NTAPI IntSetupDeviceSettingsKey(PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: registry.c:297
struct _PCI_DEVICE_PRESENT_INTERFACE PCI_DEVICE_PRESENT_INTERFACE
uint16_t * PWCHAR
Definition: typedefs.h:54
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1122
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
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:794
_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:1326
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
struct TraceInfo Info
#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
static USHORT USHORT * NewLength
uint32_t ULONG_PTR
Definition: typedefs.h:63
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
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:702
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:995
#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:251
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:4004
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:36
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:4228
_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:717
_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 TRACE_(x)
Definition: compat.h:66
int64_t LONGLONG
Definition: typedefs.h:66
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:524
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:825
_In_ PKSYNCHRONIZE_ROUTINE SynchronizeRoutine
Definition: kefuncs.h:549
__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:43
#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:533
#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:683
_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 NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
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 OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#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
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID NTAPI KeInitializeMutex(IN PKMUTEX Mutex, IN ULONG Level)
Definition: mutex.c:67
#define IRP_MJ_POWER
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG, PCWSTR, PCWSTR, ULONG, PVOID, ULONG)
#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:803
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:1342
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1842
_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:359
#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
_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
VOID VideoPortDebugPrint(IN VIDEO_DEBUG_LEVEL DebugPrintLevel, IN PCHAR DebugMessage,...)
Definition: videoprt.c:666
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
ULONG_PTR SIZE_T
Definition: typedefs.h:78
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:5111
PRTL_UNICODE_STRING_BUFFER Path
Definition: video.h:270
VOID FASTCALL IntAttachToCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState)
Definition: videoprt.c:435
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
ULONG VideoPortDeviceNumber
Definition: videoprt.c:34
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:465
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
unsigned int * PULONG
Definition: retypes.h:1
BOOLEAN NTAPI VideoPortIsNoVesa(VOID)
Definition: videoprt.c:1406
#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:465
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:39
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:448
struct tagContext Context
Definition: acpixf.h:1030
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:114
#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:27
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:853
NTSTATUS NTAPI IntVideoPortCreateAdapterDeviceObject(IN PDRIVER_OBJECT DriverObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, IN PDEVICE_OBJECT PhysicalDeviceObject, OUT PDEVICE_OBJECT *DeviceObject OPTIONAL)
Definition: videoprt.c:88
#define SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA
Definition: video.h:120
_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:743
_In_ BOOLEAN _In_ USHORT Directory
Definition: rtlfuncs.h:3734
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:98
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define RTL_QUERY_REGISTRY_REQUIRED
Definition: nt_native.h:132
#define REG_DWORD
Definition: sdbapi.c:596
LPFNPSPCALLBACK Callback
Definition: desk.c:111
#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 OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#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:1179
PMINIPORT_GET_REGISTRY_ROUTINE HwGetRegistryRoutine
Definition: videoprt.c:711
VP_STATUS NTAPI VideoPortCreateSecondaryDisplay(IN PVOID HwDeviceExtension, IN OUT PVOID *SecondaryDeviceExtension, IN ULONG Flag)
Definition: videoprt.c:1165
#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:1250
KINTERRUPT_MODE InterruptMode
Definition: video.h:172
VOID NTAPI VideoPortReleaseDeviceLock(IN PVOID HwDeviceExtension)
Definition: videoprt.c:1361
#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