ReactOS  0.4.14-dev-52-g6116262
dispatch.c
Go to the documentation of this file.
1 /*
2  * VideoPort driver
3  *
4  * Copyright (C) 2002, 2003, 2004 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 <ndk/inbvfuncs.h>
25 #include <ndk/psfuncs.h>
26 
27 #define NDEBUG
28 #include <debug.h>
29 
30 /* GLOBAL VARIABLES ***********************************************************/
31 
34 
35 /* PRIVATE FUNCTIONS **********************************************************/
36 
37 /*
38  * Reset display to blue screen
39  */
40 BOOLEAN
41 NTAPI
43 {
45 
47  return FALSE;
48 
50 
51  if (DriverExtension->InitializationData.HwResetHw != NULL)
52  {
53  if (DriverExtension->InitializationData.HwResetHw(
55  Columns, Rows))
56  {
58  return TRUE;
59  }
60  }
61 
63  return FALSE;
64 }
65 
67 NTAPI
71 {
75 
76  /* Get the initialization data we saved in VideoPortInitialize. */
78 
79  /* Create adapter device object. */
83  &DeviceObject);
84  if (NT_SUCCESS(Status))
86 
87  return Status;
88 }
89 
90 /*
91  * IntVideoPortDispatchOpen
92  *
93  * Answer requests for Open calls.
94  *
95  * Run Level
96  * PASSIVE_LEVEL
97  */
99 NTAPI
102  IN PIRP Irp)
103 {
104  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
107 
108  TRACE_(VIDEOPRT, "IntVideoPortDispatchOpen\n");
109 
110  if (CsrssInitialized == FALSE)
111  {
112  /*
113  * We know the first open call will be from the CSRSS process
114  * to let us know its handle.
115  */
116 
117  INFO_(VIDEOPRT, "Referencing CSRSS\n");
119  INFO_(VIDEOPRT, "Csrss %p\n", Csrss);
120 
122  if (!NT_SUCCESS(Status))
123  {
124  ERR_(VIDEOPRT, "IntInitializeVideoAddressSpace() failed: 0x%lx\n", Status);
125  return Status;
126  }
127 
129  }
130 
132  DriverExtension = DeviceExtension->DriverExtension;
133 
134  if (DriverExtension->InitializationData.HwInitialize(&DeviceExtension->MiniPortDeviceExtension))
135  {
136  Irp->IoStatus.Status = STATUS_SUCCESS;
137  InterlockedIncrement((PLONG)&DeviceExtension->DeviceOpened);
138  }
139  else
140  {
141  Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
142  }
143 
144  Irp->IoStatus.Information = FILE_OPENED;
146 
147  return STATUS_SUCCESS;
148 }
149 
150 /*
151  * IntVideoPortDispatchClose
152  *
153  * Answer requests for Close calls.
154  *
155  * Run Level
156  * PASSIVE_LEVEL
157  */
158 NTSTATUS
159 NTAPI
162  IN PIRP Irp)
163 {
164  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
165 
166  TRACE_(VIDEOPRT, "IntVideoPortDispatchClose\n");
167 
169  if ((DeviceExtension->DeviceOpened >= 1) &&
170  (InterlockedDecrement((PLONG)&DeviceExtension->DeviceOpened) == 0))
171  {
174  ResetDisplayParametersDeviceExtension = DeviceExtension;
176  }
177 
178  Irp->IoStatus.Status = STATUS_SUCCESS;
180 
181  return STATUS_SUCCESS;
182 }
183 
184 PSTR
186 {
187  switch(Ioctl)
188  {
190  return "IOCTL_VIDEO_ENABLE_VDM"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x00, METHOD_BUFFERED, FILE_ANY_ACCESS)
192  return "IOCTL_VIDEO_DISABLE_VDM"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x01, METHOD_BUFFERED, FILE_ANY_ACCESS)
194  return "IOCTL_VIDEO_REGISTER_VDM"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x02, METHOD_BUFFERED, FILE_ANY_ACCESS)
196  return "IOCTL_VIDEO_SET_OUTPUT_DEVICE_POWER_STATE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x03, METHOD_BUFFERED, FILE_ANY_ACCESS)
198  return "IOCTL_VIDEO_GET_OUTPUT_DEVICE_POWER_STATE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x04, METHOD_BUFFERED, FILE_ANY_ACCESS)
200  return "IOCTL_VIDEO_MONITOR_DEVICE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x05, METHOD_BUFFERED, FILE_ANY_ACCESS)
202  return "IOCTL_VIDEO_ENUM_MONITOR_PDO"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x06, METHOD_BUFFERED, FILE_ANY_ACCESS)
204  return "IOCTL_VIDEO_INIT_WIN32K_CALLBACKS"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x07, METHOD_BUFFERED, FILE_ANY_ACCESS)
206  return "IOCTL_VIDEO_HANDLE_VIDEOPARAMETERS"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x08, METHOD_BUFFERED, FILE_ANY_ACCESS)
208  return "IOCTL_VIDEO_IS_VGA_DEVICE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x09, METHOD_BUFFERED, FILE_ANY_ACCESS)
210  return "IOCTL_VIDEO_USE_DEVICE_IN_SESSION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x0a, METHOD_BUFFERED, FILE_ANY_ACCESS)
212  return "IOCTL_VIDEO_PREPARE_FOR_EARECOVERY"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x0b, METHOD_BUFFERED, FILE_ANY_ACCESS)
214  return "IOCTL_VIDEO_SAVE_HARDWARE_STATE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x80, METHOD_BUFFERED, FILE_ANY_ACCESS)
216  return "IOCTL_VIDEO_RESTORE_HARDWARE_STATE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x81, METHOD_BUFFERED, FILE_ANY_ACCESS)
218  return "IOCTL_VIDEO_QUERY_AVAIL_MODES"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x100, METHOD_BUFFERED, FILE_ANY_ACCESS)
220  return "IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x101, METHOD_BUFFERED, FILE_ANY_ACCESS)
222  return "IOCTL_VIDEO_QUERY_CURRENT_MODE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x102, METHOD_BUFFERED, FILE_ANY_ACCESS)
224  return "IOCTL_VIDEO_SET_CURRENT_MODE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x103, METHOD_BUFFERED, FILE_ANY_ACCESS)
226  return "IOCTL_VIDEO_RESET_DEVICE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x104, METHOD_BUFFERED, FILE_ANY_ACCESS)
228  return "IOCTL_VIDEO_LOAD_AND_SET_FONT"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x105, METHOD_BUFFERED, FILE_ANY_ACCESS)
230  return "IOCTL_VIDEO_SET_PALETTE_REGISTERS"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x106, METHOD_BUFFERED, FILE_ANY_ACCESS)
232  return "IOCTL_VIDEO_SET_COLOR_REGISTERS"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x107, METHOD_BUFFERED, FILE_ANY_ACCESS)
234  return "IOCTL_VIDEO_ENABLE_CURSOR"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x108, METHOD_BUFFERED, FILE_ANY_ACCESS)
236  return "IOCTL_VIDEO_DISABLE_CURSOR"; // CTL_CODE (FILE_DEVICE_VIDEO, 0x109, METHOD_BUFFERED, FILE_ANY_ACCESS)
238  return "IOCTL_VIDEO_SET_CURSOR_ATTR"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x10a, METHOD_BUFFERED, FILE_ANY_ACCESS)
240  return "IOCTL_VIDEO_QUERY_CURSOR_ATTR"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x10b, METHOD_BUFFERED, FILE_ANY_ACCESS)
242  return "IOCTL_VIDEO_SET_CURSOR_POSITION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x10c, METHOD_BUFFERED, FILE_ANY_ACCESS)
244  return "IOCTL_VIDEO_QUERY_CURSOR_POSITION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x10d, METHOD_BUFFERED, FILE_ANY_ACCESS)
246  return "IOCTL_VIDEO_ENABLE_POINTER"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x10e, METHOD_BUFFERED, FILE_ANY_ACCESS)
248  return "IOCTL_VIDEO_DISABLE_POINTER"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x10f, METHOD_BUFFERED, FILE_ANY_ACCESS)
250  return "IOCTL_VIDEO_SET_POINTER_ATTR"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x110, METHOD_BUFFERED, FILE_ANY_ACCESS)
252  return "IOCTL_VIDEO_QUERY_POINTER_ATTR"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x111, METHOD_BUFFERED, FILE_ANY_ACCESS)
254  return "IOCTL_VIDEO_SET_POINTER_POSITION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x112, METHOD_BUFFERED, FILE_ANY_ACCESS)
256  return "IOCTL_VIDEO_QUERY_POINTER_POSITION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x113, METHOD_BUFFERED, FILE_ANY_ACCESS)
258  return "IOCTL_VIDEO_QUERY_POINTER_CAPABILITIES"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x114, METHOD_BUFFERED, FILE_ANY_ACCESS)
260  return "IOCTL_VIDEO_GET_BANK_SELECT_CODE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x115, METHOD_BUFFERED, FILE_ANY_ACCESS)
262  return "IOCTL_VIDEO_MAP_VIDEO_MEMORY"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x116, METHOD_BUFFERED, FILE_ANY_ACCESS)
264  return "IOCTL_VIDEO_UNMAP_VIDEO_MEMORY"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x117, METHOD_BUFFERED, FILE_ANY_ACCESS)
266  return "IOCTL_VIDEO_QUERY_PUBLIC_ACCESS_RANGES"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x118, METHOD_BUFFERED, FILE_ANY_ACCESS)
268  return "IOCTL_VIDEO_FREE_PUBLIC_ACCESS_RANGES"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x119, METHOD_BUFFERED, FILE_ANY_ACCESS)
270  return "IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x11a, METHOD_BUFFERED, FILE_ANY_ACCESS)
272  return "IOCTL_VIDEO_SET_POWER_MANAGEMENT"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x11b, METHOD_BUFFERED, FILE_ANY_ACCESS)
274  return "IOCTL_VIDEO_GET_POWER_MANAGEMENT"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x11c, METHOD_BUFFERED, FILE_ANY_ACCESS)
276  return "IOCTL_VIDEO_SHARE_VIDEO_MEMORY"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x11d, METHOD_BUFFERED, FILE_ANY_ACCESS)
278  return "IOCTL_VIDEO_UNSHARE_VIDEO_MEMORY"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x11e, METHOD_BUFFERED, FILE_ANY_ACCESS)
280  return "IOCTL_VIDEO_SET_COLOR_LUT_DATA"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x11f, METHOD_BUFFERED, FILE_ANY_ACCESS)
282  return "IOCTL_VIDEO_GET_CHILD_STATE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x120, METHOD_BUFFERED, FILE_ANY_ACCESS)
284  return "IOCTL_VIDEO_VALIDATE_CHILD_STATE_CONFIGURATION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x121, METHOD_BUFFERED, FILE_ANY_ACCESS)
286  return "IOCTL_VIDEO_SET_CHILD_STATE_CONFIGURATION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x122, METHOD_BUFFERED, FILE_ANY_ACCESS)
288  return "IOCTL_VIDEO_SWITCH_DUALVIEW"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x123, METHOD_BUFFERED, FILE_ANY_ACCESS)
290  return "IOCTL_VIDEO_SET_BANK_POSITION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x124, METHOD_BUFFERED, FILE_ANY_ACCESS)
292  return "IOCTL_VIDEO_QUERY_SUPPORTED_BRIGHTNESS"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x125, METHOD_BUFFERED, FILE_ANY_ACCESS)
294  return "IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x126, METHOD_BUFFERED, FILE_ANY_ACCESS)
296  return "IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x127, METHOD_BUFFERED, FILE_ANY_ACCESS)
297  }
298 
299  return "<unknown ioctl code";
300 }
301 
302 static
303 NTSTATUS
309 {
310  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
311 
312  /* Check buffer size */
315  {
316  ERR_(VIDEOPRT, "Buffer too small for VIDEO_DEVICE_SESSION_STATUS: %lx\n",
317  BufferLength);
319  }
320 
321  /* Get the device extension */
322  DeviceExtension = DeviceObject->DeviceExtension;
323 
324  /* Shall we enable the session? */
325  if (SessionState->bEnable)
326  {
327  /* Check if we have no session yet */
328  if (DeviceExtension->SessionId == -1)
329  {
330  /* Use this session and return success */
331  DeviceExtension->SessionId = PsGetCurrentProcessSessionId();
332  SessionState->bSuccess = TRUE;
333  }
334  else
335  {
336  ERR_(VIDEOPRT, "Requested to set session, but session is already set to: 0x%lx\n",
337  DeviceExtension->SessionId);
338  SessionState->bSuccess = FALSE;
339  }
340  }
341  else
342  {
343  /* Check if we belong to the current session */
344  if (DeviceExtension->SessionId == PsGetCurrentProcessSessionId())
345  {
346  /* Reset the session and return success */
347  DeviceExtension->SessionId = -1;
348  SessionState->bSuccess = TRUE;
349  }
350  else
351  {
352  ERR_(VIDEOPRT, "Requested to reset session, but session is not set\n");
353  SessionState->bSuccess = FALSE;
354  }
355  }
356 
357  return STATUS_SUCCESS;
358 }
359 
360 static
361 NTSTATUS
364  _Inout_ PVIDEO_WIN32K_CALLBACKS Win32kCallbacks,
367 {
369  if (BufferLength < sizeof(VIDEO_WIN32K_CALLBACKS))
370  {
371  ERR_(VIDEOPRT, "Buffer too small for VIDEO_WIN32K_CALLBACKS: %lx\n",
372  BufferLength);
374  }
375 
376  /* Save the callout function globally */
377  Win32kCallout = Win32kCallbacks->Callout;
378 
379  /* Return reasonable values to win32k */
380  Win32kCallbacks->bACPI = FALSE;
381  Win32kCallbacks->pPhysDeviceObject = DeviceObject;
382  Win32kCallbacks->DualviewFlags = 0;
383 
384  return STATUS_SUCCESS;
385 }
386 
387 static
388 NTSTATUS
391  IN PIRP Irp)
392 {
393  PIO_STACK_LOCATION IrpStack;
395  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
397 
398  TRACE_(VIDEOPRT, "VideoPortForwardDeviceControl\n");
399 
400  IrpStack = IoGetCurrentIrpStackLocation(Irp);
401  DeviceExtension = DeviceObject->DeviceExtension;
402  DriverExtension = DeviceExtension->DriverExtension;
403 
404  /* Translate the IRP to a VRP */
405  vrp.StatusBlock = (PSTATUS_BLOCK)&Irp->IoStatus;
406  vrp.IoControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode;
407 
408  INFO_(VIDEOPRT, "- IoControlCode: %x\n", vrp.IoControlCode);
409 
410  /* We're assuming METHOD_BUFFERED */
411  vrp.InputBuffer = Irp->AssociatedIrp.SystemBuffer;
412  vrp.InputBufferLength = IrpStack->Parameters.DeviceIoControl.InputBufferLength;
413  vrp.OutputBuffer = Irp->AssociatedIrp.SystemBuffer;
414  vrp.OutputBufferLength = IrpStack->Parameters.DeviceIoControl.OutputBufferLength;
415 
416  /* Call the Miniport Driver with the VRP */
417  DriverExtension->InitializationData.HwStartIO(&DeviceExtension->MiniPortDeviceExtension,
418  &vrp);
419 
420  INFO_(VIDEOPRT, "- Returned status: %x\n", Irp->IoStatus.Status);
421 
422  /* Map from win32 error codes to NT status values. */
423  switch (Irp->IoStatus.Status)
424  {
425  case NO_ERROR:
426  return STATUS_SUCCESS;
429  case ERROR_MORE_DATA:
430  return STATUS_BUFFER_OVERFLOW;
432  return STATUS_NOT_IMPLEMENTED;
437  case ERROR_DEV_NOT_EXIST:
439  case ERROR_IO_PENDING:
440  return STATUS_PENDING;
441  default:
442  return STATUS_UNSUCCESSFUL;
443  }
444 }
445 
446 /*
447  * IntVideoPortDispatchDeviceControl
448  *
449  * Answer requests for device control calls.
450  *
451  * Run Level
452  * PASSIVE_LEVEL
453  */
454 NTSTATUS
455 NTAPI
458  IN PIRP Irp)
459 {
460  PIO_STACK_LOCATION IrpStack;
463 
464  TRACE_(VIDEOPRT, "IntVideoPortDispatchDeviceControl\n");
465 
466  IrpStack = IoGetCurrentIrpStackLocation(Irp);
467 
468  IoControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode;
469 
470  INFO_(VIDEOPRT, "- IoControlCode: %x: %s\n", IoControlCode, IoctlName(IoControlCode));
471 
472  switch(IoControlCode)
473  {
475  INFO_(VIDEOPRT, "- IOCTL_VIDEO_INIT_WIN32K_CALLBACKS\n");
477  Irp->AssociatedIrp.SystemBuffer,
478  IrpStack->Parameters.DeviceIoControl.InputBufferLength,
479  &Irp->IoStatus.Information);
480  break;
481 
483  INFO_(VIDEOPRT, "- IOCTL_VIDEO_USE_DEVICE_IN_SESSION\n");
485  Irp->AssociatedIrp.SystemBuffer,
486  IrpStack->Parameters.DeviceIoControl.InputBufferLength,
487  &Irp->IoStatus.Information);
488  break;
489 
490  default:
491  /* Forward to the Miniport Driver */
493  break;
494  }
495 
496  INFO_(VIDEOPRT, "- Returned status: %x\n", Irp->IoStatus.Status);
497 
498  Irp->IoStatus.Status = Status;
500 
501  return Status;
502 }
503 
504 /*
505  * IntVideoPortWrite
506  *
507  * This is a bit of a hack. We want to take ownership of the display as late
508  * as possible, just before the switch to graphics mode. Win32k knows when
509  * this happens, we don't. So we need Win32k to inform us. This could be done
510  * using an IOCTL, but there's no way of knowing which IOCTL codes are unused
511  * in the communication between GDI driver and miniport driver. So we use
512  * IRP_MJ_WRITE as the signal that win32k is ready to switch to graphics mode,
513  * since we know for certain that there is no read/write activity going on
514  * between GDI and miniport drivers.
515  * We don't actually need the data that is passed, we just trigger on the fact
516  * that an IRP_MJ_WRITE was sent.
517  *
518  * Run Level
519  * PASSIVE_LEVEL
520  */
521 NTSTATUS
522 NTAPI
525  IN PIRP Irp)
526 {
528  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
529  NTSTATUS nErrCode;
530 
532 
533  /*
534  * Storing the device extension pointer in a static variable is an
535  * ugly hack. Unfortunately, we need it in IntVideoPortResetDisplayParameters
536  * and InbvNotifyDisplayOwnershipLost doesn't allow us to pass a userdata
537  * parameter. On the bright side, the DISPLAY device is opened
538  * exclusively, so there can be only one device extension active at
539  * any point in time.
540  *
541  * FIXME: We should process all opened display devices in
542  * IntVideoPortResetDisplayParameters.
543  */
544  ResetDisplayParametersDeviceExtension = DeviceExtension;
546 
547  nErrCode = STATUS_SUCCESS;
548  Irp->IoStatus.Information = piosStack->Parameters.Write.Length;
549  Irp->IoStatus.Status = nErrCode;
551 
552  return nErrCode;
553 }
554 
555 NTSTATUS
556 NTAPI
559  IN PIRP Irp)
560 {
564  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
566 
567  /* Get the initialization data we saved in VideoPortInitialize.*/
568  DriverObject = DeviceObject->DriverObject;
571 
572  /* Store some resources in the DeviceExtension. */
573  AllocatedResources = Stack->Parameters.StartDevice.AllocatedResources;
575  {
576  CM_FULL_RESOURCE_DESCRIPTOR *FullList;
579  ULONG ResourceListSize;
580 
581  /* Save the resource list */
582  ResourceCount = AllocatedResources->List[0].PartialResourceList.Count;
583  ResourceListSize =
584  FIELD_OFFSET(CM_RESOURCE_LIST, List[0].PartialResourceList.
585  PartialDescriptors[ResourceCount]);
586  DeviceExtension->AllocatedResources = ExAllocatePool(PagedPool, ResourceListSize);
587  if (DeviceExtension->AllocatedResources == NULL)
588  {
590  }
591 
592  RtlCopyMemory(DeviceExtension->AllocatedResources,
594  ResourceListSize);
595 
596  /* Get the interrupt level/vector - needed by HwFindAdapter sometimes */
597  FullList = AllocatedResources->List;
598  ASSERT(AllocatedResources->Count == 1);
599  INFO_(VIDEOPRT, "InterfaceType %u BusNumber List %u Device BusNumber %u Version %u Revision %u\n",
600  FullList->InterfaceType, FullList->BusNumber, DeviceExtension->SystemIoBusNumber, FullList->PartialResourceList.Version, FullList->PartialResourceList.Revision);
601 
602  /* FIXME: Is this ASSERT ok for resources from the PNP manager? */
603  ASSERT(FullList->InterfaceType == PCIBus);
604  ASSERT(FullList->BusNumber == DeviceExtension->SystemIoBusNumber);
605  ASSERT(1 == FullList->PartialResourceList.Version);
606  ASSERT(1 == FullList->PartialResourceList.Revision);
608  Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count;
609  Descriptor++)
610  {
611  if (Descriptor->Type == CmResourceTypeInterrupt)
612  {
613  DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level;
614  DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector;
615  if (Descriptor->ShareDisposition == CmResourceShareShared)
616  DeviceExtension->InterruptShared = TRUE;
617  else
618  DeviceExtension->InterruptShared = FALSE;
619  }
620  }
621  }
622 
623  INFO_(VIDEOPRT, "Interrupt level: 0x%x Interrupt Vector: 0x%x\n",
624  DeviceExtension->InterruptLevel,
625  DeviceExtension->InterruptVector);
626 
627  /* Create adapter device object. */
630  DeviceObject);
631 }
632 
633 
634 NTSTATUS
635 NTAPI
637  PDEVICE_OBJECT Fdo,
638  PIRP Irp,
639  PVOID Context)
640 {
642 
643  if (Irp->PendingReturned)
645 
647 }
648 
649 NTSTATUS
650 NTAPI
652 {
653  PDEVICE_RELATIONS DeviceRelations;
655  PVIDEO_PORT_CHILD_EXTENSION ChildExtension;
656  ULONG i;
657  PLIST_ENTRY CurrentEntry;
658 
659  /* Count the children */
660  i = 0;
661  CurrentEntry = DeviceExtension->ChildDeviceList.Flink;
662  while (CurrentEntry != &DeviceExtension->ChildDeviceList)
663  {
664  i++;
665  CurrentEntry = CurrentEntry->Flink;
666  }
667 
668  if (i == 0)
669  return Irp->IoStatus.Status;
670 
671  DeviceRelations = ExAllocatePool(PagedPool,
672  sizeof(DEVICE_RELATIONS) + ((i - 1) * sizeof(PVOID)));
673  if (!DeviceRelations) return STATUS_NO_MEMORY;
674 
675  DeviceRelations->Count = i;
676 
677  /* Add the children */
678  i = 0;
679  CurrentEntry = DeviceExtension->ChildDeviceList.Flink;
680  while (CurrentEntry != &DeviceExtension->ChildDeviceList)
681  {
682  ChildExtension = CONTAINING_RECORD(CurrentEntry, VIDEO_PORT_CHILD_EXTENSION, ListEntry);
683 
684  ObReferenceObject(ChildExtension->PhysicalDeviceObject);
685  DeviceRelations->Objects[i] = ChildExtension->PhysicalDeviceObject;
686 
687  i++;
688  CurrentEntry = CurrentEntry->Flink;
689  }
690 
691  INFO_(VIDEOPRT, "Reported %d PDOs\n", i);
692  Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
693 
694  return STATUS_SUCCESS;
695 }
696 
697 NTSTATUS
698 NTAPI
700 {
701  KEVENT Event;
703  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension =
705 
710  &Event,
711  TRUE,
712  TRUE,
713  TRUE);
714 
715  Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
716  if (Status == STATUS_PENDING)
717  {
719  Status = Irp->IoStatus.Status;
720  }
721 
722  return Status;
723 }
724 
725 NTSTATUS
726 NTAPI
729  IN PIRP Irp)
730 {
734 
736 
737  switch (IrpSp->MinorFunction)
738  {
739  case IRP_MN_START_DEVICE:
741  if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
743  Irp->IoStatus.Status = Status;
744  Irp->IoStatus.Information = 0;
746  break;
747 
750  if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
752  Irp->IoStatus.Status = Status;
753  Irp->IoStatus.Information = 0;
755  break;
756 
758  if (IrpSp->Parameters.QueryDeviceRelations.Type != BusRelations)
759  {
761  Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
762  }
763  else
764  {
766  Irp->IoStatus.Status = Status;
768  }
769  break;
770 
775 
776  case IRP_MN_STOP_DEVICE:
778  if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
780  Irp->IoStatus.Status = Status;
781  Irp->IoStatus.Information = 0;
783  break;
784 
788  Irp->IoStatus.Status = STATUS_SUCCESS;
789  Irp->IoStatus.Information = 0;
791  break;
792 
793  default:
794  Status = Irp->IoStatus.Status;
796  break;
797  }
798 
799  return Status;
800 }
801 
802 NTSTATUS
803 NTAPI
806  IN PIRP Irp)
807 {
809 
810  if (CommonExtension->Fdo)
812  else
814 }
815 
816 NTSTATUS
817 NTAPI
820  IN PIRP Irp)
821 {
822  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
823 
824  DeviceExtension = DeviceObject->DeviceExtension;
825  RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
826 
827  Irp->IoStatus.Status = STATUS_SUCCESS;
828  Irp->IoStatus.Information = 0;
830 
831  return STATUS_SUCCESS;
832 }
833 
834 NTSTATUS
835 NTAPI
838  IN PIRP Irp)
839 {
841  NTSTATUS Status = Irp->IoStatus.Status;
843 
845 
846  if (DeviceExtension->Common.Fdo)
847  {
850  return PoCallDriver(DeviceExtension->NextDeviceObject, Irp);
851  }
852  else
853  {
854  switch (IrpSp->MinorFunction)
855  {
856  case IRP_MN_QUERY_POWER:
857  case IRP_MN_SET_POWER:
859  break;
860  }
862  Irp->IoStatus.Status = Status;
864  return Status;
865  }
866 }
867 
868 NTSTATUS
869 NTAPI
872  IN PIRP Irp)
873 {
876 
877  if (DeviceExtension->Common.Fdo)
878  {
880  return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
881  }
882  else
883  {
884  Status = Irp->IoStatus.Status;
886  return Status;
887  }
888 }
889 
890 VOID
891 NTAPI
893 {
894 }
NTSTATUS NTAPI IntVideoPortFindAdapter(IN PDRIVER_OBJECT DriverObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, IN PDEVICE_OBJECT DeviceObject)
Definition: videoprt.c:247
#define IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES
Definition: ntddvdeo.h:110
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define STATUS_DEVICE_DOES_NOT_EXIST
Definition: ntstatus.h:414
#define IOCTL_VIDEO_IS_VGA_DEVICE
Definition: ntddvdeo.h:68
NTSTATUS NTAPI IntVideoPortDispatchPdoPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: child.c:319
VOID NTAPI InbvNotifyDisplayOwnershipLost(IN INBV_RESET_DISPLAY_PARAMETERS Callback)
Definition: inbv.c:642
#define IN
Definition: typedefs.h:38
static NTSTATUS VideoPortUseDeviceInSession(_Inout_ PDEVICE_OBJECT DeviceObject, _Inout_ PVIDEO_DEVICE_SESSION_STATUS SessionState, _In_ ULONG BufferLength, _Out_ PULONG_PTR Information)
Definition: dispatch.c:304
NTSTATUS NTAPI IntVideoPortDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:836
#define IOCTL_VIDEO_QUERY_POINTER_POSITION
Definition: ntddvdeo.h:131
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define IRP_MN_REMOVE_DEVICE
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define IOCTL_VIDEO_QUERY_POINTER_ATTR
Definition: ntddvdeo.h:125
#define IOCTL_VIDEO_SET_POINTER_ATTR
Definition: ntddvdeo.h:164
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG IoControlCode
Definition: fltkernel.h:1383
#define IOCTL_VIDEO_UNSHARE_VIDEO_MEMORY
Definition: ntddvdeo.h:182
#define INFO_(ch,...)
Definition: debug.h:159
#define IOCTL_VIDEO_REGISTER_VDM
Definition: ntddvdeo.h:47
#define IRP_MN_QUERY_POWER
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
NTSTATUS NTAPI IntVideoPortDispatchFdoPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:727
#define IOCTL_VIDEO_QUERY_POINTER_CAPABILITIES
Definition: ntddvdeo.h:128
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:63
VIDEO_PORT_DRIVER_EXTENSION * DriverExtension
Definition: videoprt.h:100
NTSTATUS NTAPI PoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
Definition: power.c:485
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PCM_RESOURCE_LIST * AllocatedResources
Definition: ndis.h:4640
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
struct _STATUS_BLOCK * PSTATUS_BLOCK
NTSTATUS NTAPI IntVideoPortDispatchCleanup(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:818
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2055
#define IOCTL_VIDEO_DISABLE_CURSOR
Definition: ntddvdeo.h:77
struct _VIDEO_DEVICE_SESSION_STATUS VIDEO_DEVICE_SESSION_STATUS
#define ERR_(ch,...)
Definition: debug.h:156
LONG NTSTATUS
Definition: precomp.h:26
#define IOCTL_VIDEO_SET_COLOR_LUT_DATA
Definition: ntddvdeo.h:185
struct _VIDEO_PORT_DEVICE_EXTENSTION * PVIDEO_PORT_DEVICE_EXTENSION
#define IOCTL_VIDEO_ENABLE_VDM
Definition: ntddvdeo.h:41
#define FILE_OPENED
Definition: nt_native.h:769
#define IOCTL_VIDEO_SET_CHILD_STATE_CONFIGURATION
Definition: ntddvdeo.h:146
#define IOCTL_VIDEO_GET_POWER_MANAGEMENT
Definition: ntddvdeo.h:98
NTSTATUS NTAPI IntVideoPortForwardIrpAndWaitCompletionRoutine(PDEVICE_OBJECT Fdo, PIRP Irp, PVOID Context)
Definition: dispatch.c:636
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
PCM_RESOURCE_LIST AllocatedResources
Definition: videoprt.h:91
#define IOCTL_VIDEO_HANDLE_VIDEOPARAMETERS
Definition: ntddvdeo.h:65
#define IOCTL_VIDEO_RESET_DEVICE
Definition: ntddvdeo.h:137
#define IOCTL_VIDEO_MAP_VIDEO_MEMORY
Definition: ntddvdeo.h:104
#define IOCTL_VIDEO_GET_OUTPUT_DEVICE_POWER_STATE
Definition: ntddvdeo.h:53
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1114
ULONG InputBufferLength
Definition: video.h:333
NTSTATUS NTAPI IntVideoPortDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:456
#define ERROR_IO_PENDING
Definition: dderror.h:15
#define NO_ERROR
Definition: dderror.h:5
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
PSTR IoctlName(ULONG Ioctl)
Definition: dispatch.c:185
#define IOCTL_VIDEO_GET_BANK_SELECT_CODE
Definition: ntddvdeo.h:92
#define IOCTL_VIDEO_DISABLE_POINTER
Definition: ntddvdeo.h:80
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define IOCTL_VIDEO_FREE_PUBLIC_ACCESS_RANGES
Definition: ntddvdeo.h:89
#define IOCTL_VIDEO_ENUM_MONITOR_PDO
Definition: ntddvdeo.h:59
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
#define IOCTL_VIDEO_QUERY_CURRENT_MODE
Definition: ntddvdeo.h:113
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:515
#define IOCTL_VIDEO_SET_CURRENT_MODE
Definition: ntddvdeo.h:152
FORCEINLINE VOID IoCopyCurrentIrpStackLocationToNext(_Inout_ PIRP Irp)
Definition: iofuncs.h:2820
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: hwresource.cpp:160
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
BOOLEAN NTAPI IntVideoPortResetDisplayParameters(ULONG Columns, ULONG Rows)
Definition: dispatch.c:42
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define IOCTL_VIDEO_MONITOR_DEVICE
Definition: ntddvdeo.h:56
#define IOCTL_VIDEO_INIT_WIN32K_CALLBACKS
Definition: ntddvdeo.h:62
#define IRP_MN_QUERY_REMOVE_DEVICE
NTSTATUS NTAPI IntVideoPortFilterResourceRequirements(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: resource.c:77
_In_ ULONG BufferLength
Definition: usbdlib.h:225
#define IOCTL_VIDEO_SET_PALETTE_REGISTERS
Definition: ntddvdeo.h:161
VOID NTAPI IntVideoPortUnload(PDRIVER_OBJECT DriverObject)
Definition: dispatch.c:892
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
#define PsGetCurrentProcess
Definition: psfuncs.h:17
#define IOCTL_VIDEO_SET_CURSOR_POSITION
Definition: ntddvdeo.h:158
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_In_ ULONG Rows
Definition: haltypes.h:7
#define _Out_
Definition: no_sal2.h:323
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define IoCompleteRequest
Definition: irp.c:1240
PKPROCESS Csrss
Definition: videoprt.c:34
#define IOCTL_VIDEO_QUERY_CURSOR_ATTR
Definition: ntddvdeo.h:116
NTSTATUS NTAPI IntInitializeVideoAddressSpace(VOID)
Definition: int10.c:146
static NTSTATUS VideoPortInitWin32kCallbacks(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PVIDEO_WIN32K_CALLBACKS Win32kCallbacks, _In_ ULONG BufferLength, _Out_ PULONG_PTR Information)
Definition: dispatch.c:362
NTSTATUS NTAPI IntVideoPortDispatchClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:160
PVIDEO_PORT_DEVICE_EXTENSION ResetDisplayParametersDeviceExtension
Definition: dispatch.c:32
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
ULONG OutputBufferLength
Definition: video.h:335
#define IOCTL_VIDEO_SET_POWER_MANAGEMENT
Definition: ntddvdeo.h:170
#define IOCTL_VIDEO_SET_CURSOR_ATTR
Definition: ntddvdeo.h:155
#define IOCTL_VIDEO_UNMAP_VIDEO_MEMORY
Definition: ntddvdeo.h:179
#define IOCTL_VIDEO_ENABLE_CURSOR
Definition: ntddvdeo.h:83
#define IRP_MN_QUERY_STOP_DEVICE
#define IOCTL_VIDEO_QUERY_CURSOR_POSITION
Definition: ntddvdeo.h:119
#define IOCTL_VIDEO_SWITCH_DUALVIEW
Definition: ntddvdeo.h:176
#define TRACE_(x)
Definition: compat.h:66
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
ULONG NTAPI PsGetCurrentProcessSessionId(VOID)
Definition: process.c:1133
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IRP_MN_STOP_DEVICE
LIST_ENTRY List
Definition: psmgr.c:57
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
VOID(* PVIDEO_WIN32K_CALLOUT)(_In_ PVOID Params)
Definition: ntddvdeo.h:257
#define IRP_MN_START_DEVICE
NTSTATUS NTAPI IntVideoPortDispatchSystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:870
#define IOCTL_VIDEO_PREPARE_FOR_EARECOVERY
Definition: ntddvdeo.h:74
struct _VIDEO_WIN32K_CALLBACKS VIDEO_WIN32K_CALLBACKS
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define _Inout_
Definition: no_sal2.h:244
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
static ULONG ResourceCount
Definition: inbv.c:95
#define IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS
Definition: ntddvdeo.h:200
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
#define IOCTL_VIDEO_QUERY_SUPPORTED_BRIGHTNESS
Definition: ntddvdeo.h:194
#define InterlockedDecrement
Definition: armddk.h:52
#define IOCTL_VIDEO_LOAD_AND_SET_FONT
Definition: ntddvdeo.h:101
NTSTATUS NTAPI IntVideoPortAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
Definition: dispatch.c:68
#define IOCTL_VIDEO_DISABLE_VDM
Definition: ntddvdeo.h:44
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1842
PDEVICE_OBJECT NextDeviceObject
Definition: videoprt.h:86
#define IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES
Definition: ntddvdeo.h:122
#define IRP_MN_SET_POWER
#define IOCTL_VIDEO_QUERY_AVAIL_MODES
Definition: ntddvdeo.h:107
Definition: typedefs.h:117
#define IOCTL_VIDEO_SHARE_VIDEO_MEMORY
Definition: ntddvdeo.h:173
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
#define ERROR_MORE_DATA
Definition: dderror.h:13
Status
Definition: gdiplustypes.h:24
#define _In_
Definition: no_sal2.h:204
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
NTSTATUS NTAPI IntVideoPortDispatchWrite(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:523
static const COLUMN_LIST Columns[]
Definition: listview.c:19
NTSTATUS NTAPI IntVideoPortForwardIrpAndWait(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: dispatch.c:699
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define IOCTL_VIDEO_VALIDATE_CHILD_STATE_CONFIGURATION
Definition: ntddvdeo.h:188
#define InterlockedIncrement
Definition: armddk.h:53
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:626
ULONG VideoPortDeviceNumber
Definition: videoprt.c:35
struct _KPROCESS * PKPROCESS
Definition: wdm.template.h:199
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
signed char * PSTR
Definition: retypes.h:7
NTSTATUS NTAPI IntVideoPortPnPStartDevice(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:557
PSTATUS_BLOCK StatusBlock
Definition: video.h:331
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
VIDEO_PORT_COMMON_EXTENSION Common
Definition: videoprt.h:81
#define IOCTL_VIDEO_GET_CHILD_STATE
Definition: ntddvdeo.h:95
NTSTATUS NTAPI IntVideoPortDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:804
#define IOCTL_VIDEO_ENABLE_POINTER
Definition: ntddvdeo.h:86
#define IOCTL_VIDEO_QUERY_PUBLIC_ACCESS_RANGES
Definition: ntddvdeo.h:134
#define ObReferenceObject
Definition: obfuncs.h:204
NTSTATUS NTAPI IntVideoPortDispatchOpen(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:100
#define IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS
Definition: ntddvdeo.h:197
NTSTATUS NTAPI IntVideoPortQueryBusRelations(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: dispatch.c:651
ULONG CsrssInitialized
Definition: videoprt.c:33
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:120
struct tagContext Context
Definition: acpixf.h:1024
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:566
#define ULONG_PTR
Definition: config.h:101
uint32_t * PULONG_PTR
Definition: typedefs.h:63
UNICODE_STRING RegistryPath
Definition: videoprt.h:87
static NTSTATUS VideoPortForwardDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:389
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 IRP_MN_CANCEL_STOP_DEVICE
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
#define IOCTL_VIDEO_RESTORE_HARDWARE_STATE
Definition: ntddvdeo.h:140
return STATUS_SUCCESS
Definition: btrfs.c:2966
signed int * PLONG
Definition: retypes.h:5
#define IOCTL_VIDEO_USE_DEVICE_IN_SESSION
Definition: ntddvdeo.h:71
PVIDEO_WIN32K_CALLOUT Win32kCallout
Definition: dispatch.c:33
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
#define IOCTL_VIDEO_SAVE_HARDWARE_STATE
Definition: ntddvdeo.h:143
Iosb Information
Definition: create.c:4377
#define IOCTL_VIDEO_SET_OUTPUT_DEVICE_POWER_STATE
Definition: ntddvdeo.h:50
#define IOCTL_VIDEO_SET_POINTER_POSITION
Definition: ntddvdeo.h:167
#define IOCTL_VIDEO_SET_COLOR_REGISTERS
Definition: ntddvdeo.h:149
#define IOCTL_VIDEO_SET_BANK_POSITION
Definition: ntddvdeo.h:191
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966