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