ReactOS  0.4.13-dev-39-g8b6696f
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;
106 
107  TRACE_(VIDEOPRT, "IntVideoPortDispatchOpen\n");
108 
109  if (CsrssInitialized == FALSE)
110  {
111  /*
112  * We know the first open call will be from the CSRSS process
113  * to let us know its handle.
114  */
115 
116  INFO_(VIDEOPRT, "Referencing CSRSS\n");
118  INFO_(VIDEOPRT, "Csrss %p\n", Csrss);
119 
121 
123  }
124 
126  DriverExtension = DeviceExtension->DriverExtension;
127 
128  if (DriverExtension->InitializationData.HwInitialize(&DeviceExtension->MiniPortDeviceExtension))
129  {
130  Irp->IoStatus.Status = STATUS_SUCCESS;
131  InterlockedIncrement((PLONG)&DeviceExtension->DeviceOpened);
132  }
133  else
134  {
135  Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
136  }
137 
138  Irp->IoStatus.Information = FILE_OPENED;
140 
141  return STATUS_SUCCESS;
142 }
143 
144 /*
145  * IntVideoPortDispatchClose
146  *
147  * Answer requests for Close calls.
148  *
149  * Run Level
150  * PASSIVE_LEVEL
151  */
152 NTSTATUS
153 NTAPI
156  IN PIRP Irp)
157 {
158  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
159 
160  TRACE_(VIDEOPRT, "IntVideoPortDispatchClose\n");
161 
163  if ((DeviceExtension->DeviceOpened >= 1) &&
164  (InterlockedDecrement((PLONG)&DeviceExtension->DeviceOpened) == 0))
165  {
168  ResetDisplayParametersDeviceExtension = DeviceExtension;
170  }
171 
172  Irp->IoStatus.Status = STATUS_SUCCESS;
174 
175  return STATUS_SUCCESS;
176 }
177 
178 PSTR
180 {
181  switch(Ioctl)
182  {
184  return "IOCTL_VIDEO_ENABLE_VDM"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x00, METHOD_BUFFERED, FILE_ANY_ACCESS)
186  return "IOCTL_VIDEO_DISABLE_VDM"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x01, METHOD_BUFFERED, FILE_ANY_ACCESS)
188  return "IOCTL_VIDEO_REGISTER_VDM"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x02, METHOD_BUFFERED, FILE_ANY_ACCESS)
190  return "IOCTL_VIDEO_SET_OUTPUT_DEVICE_POWER_STATE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x03, METHOD_BUFFERED, FILE_ANY_ACCESS)
192  return "IOCTL_VIDEO_GET_OUTPUT_DEVICE_POWER_STATE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x04, METHOD_BUFFERED, FILE_ANY_ACCESS)
194  return "IOCTL_VIDEO_MONITOR_DEVICE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x05, METHOD_BUFFERED, FILE_ANY_ACCESS)
196  return "IOCTL_VIDEO_ENUM_MONITOR_PDO"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x06, METHOD_BUFFERED, FILE_ANY_ACCESS)
198  return "IOCTL_VIDEO_INIT_WIN32K_CALLBACKS"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x07, METHOD_BUFFERED, FILE_ANY_ACCESS)
200  return "IOCTL_VIDEO_HANDLE_VIDEOPARAMETERS"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x08, METHOD_BUFFERED, FILE_ANY_ACCESS)
202  return "IOCTL_VIDEO_IS_VGA_DEVICE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x09, METHOD_BUFFERED, FILE_ANY_ACCESS)
204  return "IOCTL_VIDEO_USE_DEVICE_IN_SESSION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x0a, METHOD_BUFFERED, FILE_ANY_ACCESS)
206  return "IOCTL_VIDEO_PREPARE_FOR_EARECOVERY"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x0b, METHOD_BUFFERED, FILE_ANY_ACCESS)
208  return "IOCTL_VIDEO_SAVE_HARDWARE_STATE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x80, METHOD_BUFFERED, FILE_ANY_ACCESS)
210  return "IOCTL_VIDEO_RESTORE_HARDWARE_STATE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x81, METHOD_BUFFERED, FILE_ANY_ACCESS)
212  return "IOCTL_VIDEO_QUERY_AVAIL_MODES"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x100, METHOD_BUFFERED, FILE_ANY_ACCESS)
214  return "IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x101, METHOD_BUFFERED, FILE_ANY_ACCESS)
216  return "IOCTL_VIDEO_QUERY_CURRENT_MODE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x102, METHOD_BUFFERED, FILE_ANY_ACCESS)
218  return "IOCTL_VIDEO_SET_CURRENT_MODE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x103, METHOD_BUFFERED, FILE_ANY_ACCESS)
220  return "IOCTL_VIDEO_RESET_DEVICE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x104, METHOD_BUFFERED, FILE_ANY_ACCESS)
222  return "IOCTL_VIDEO_LOAD_AND_SET_FONT"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x105, METHOD_BUFFERED, FILE_ANY_ACCESS)
224  return "IOCTL_VIDEO_SET_PALETTE_REGISTERS"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x106, METHOD_BUFFERED, FILE_ANY_ACCESS)
226  return "IOCTL_VIDEO_SET_COLOR_REGISTERS"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x107, METHOD_BUFFERED, FILE_ANY_ACCESS)
228  return "IOCTL_VIDEO_ENABLE_CURSOR"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x108, METHOD_BUFFERED, FILE_ANY_ACCESS)
230  return "IOCTL_VIDEO_DISABLE_CURSOR"; // CTL_CODE (FILE_DEVICE_VIDEO, 0x109, METHOD_BUFFERED, FILE_ANY_ACCESS)
232  return "IOCTL_VIDEO_SET_CURSOR_ATTR"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x10a, METHOD_BUFFERED, FILE_ANY_ACCESS)
234  return "IOCTL_VIDEO_QUERY_CURSOR_ATTR"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x10b, METHOD_BUFFERED, FILE_ANY_ACCESS)
236  return "IOCTL_VIDEO_SET_CURSOR_POSITION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x10c, METHOD_BUFFERED, FILE_ANY_ACCESS)
238  return "IOCTL_VIDEO_QUERY_CURSOR_POSITION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x10d, METHOD_BUFFERED, FILE_ANY_ACCESS)
240  return "IOCTL_VIDEO_ENABLE_POINTER"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x10e, METHOD_BUFFERED, FILE_ANY_ACCESS)
242  return "IOCTL_VIDEO_DISABLE_POINTER"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x10f, METHOD_BUFFERED, FILE_ANY_ACCESS)
244  return "IOCTL_VIDEO_SET_POINTER_ATTR"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x110, METHOD_BUFFERED, FILE_ANY_ACCESS)
246  return "IOCTL_VIDEO_QUERY_POINTER_ATTR"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x111, METHOD_BUFFERED, FILE_ANY_ACCESS)
248  return "IOCTL_VIDEO_SET_POINTER_POSITION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x112, METHOD_BUFFERED, FILE_ANY_ACCESS)
250  return "IOCTL_VIDEO_QUERY_POINTER_POSITION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x113, METHOD_BUFFERED, FILE_ANY_ACCESS)
252  return "IOCTL_VIDEO_QUERY_POINTER_CAPABILITIES"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x114, METHOD_BUFFERED, FILE_ANY_ACCESS)
254  return "IOCTL_VIDEO_GET_BANK_SELECT_CODE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x115, METHOD_BUFFERED, FILE_ANY_ACCESS)
256  return "IOCTL_VIDEO_MAP_VIDEO_MEMORY"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x116, METHOD_BUFFERED, FILE_ANY_ACCESS)
258  return "IOCTL_VIDEO_UNMAP_VIDEO_MEMORY"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x117, METHOD_BUFFERED, FILE_ANY_ACCESS)
260  return "IOCTL_VIDEO_QUERY_PUBLIC_ACCESS_RANGES"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x118, METHOD_BUFFERED, FILE_ANY_ACCESS)
262  return "IOCTL_VIDEO_FREE_PUBLIC_ACCESS_RANGES"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x119, METHOD_BUFFERED, FILE_ANY_ACCESS)
264  return "IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x11a, METHOD_BUFFERED, FILE_ANY_ACCESS)
266  return "IOCTL_VIDEO_SET_POWER_MANAGEMENT"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x11b, METHOD_BUFFERED, FILE_ANY_ACCESS)
268  return "IOCTL_VIDEO_GET_POWER_MANAGEMENT"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x11c, METHOD_BUFFERED, FILE_ANY_ACCESS)
270  return "IOCTL_VIDEO_SHARE_VIDEO_MEMORY"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x11d, METHOD_BUFFERED, FILE_ANY_ACCESS)
272  return "IOCTL_VIDEO_UNSHARE_VIDEO_MEMORY"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x11e, METHOD_BUFFERED, FILE_ANY_ACCESS)
274  return "IOCTL_VIDEO_SET_COLOR_LUT_DATA"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x11f, METHOD_BUFFERED, FILE_ANY_ACCESS)
276  return "IOCTL_VIDEO_GET_CHILD_STATE"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x120, METHOD_BUFFERED, FILE_ANY_ACCESS)
278  return "IOCTL_VIDEO_VALIDATE_CHILD_STATE_CONFIGURATION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x121, METHOD_BUFFERED, FILE_ANY_ACCESS)
280  return "IOCTL_VIDEO_SET_CHILD_STATE_CONFIGURATION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x122, METHOD_BUFFERED, FILE_ANY_ACCESS)
282  return "IOCTL_VIDEO_SWITCH_DUALVIEW"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x123, METHOD_BUFFERED, FILE_ANY_ACCESS)
284  return "IOCTL_VIDEO_SET_BANK_POSITION"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x124, METHOD_BUFFERED, FILE_ANY_ACCESS)
286  return "IOCTL_VIDEO_QUERY_SUPPORTED_BRIGHTNESS"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x125, METHOD_BUFFERED, FILE_ANY_ACCESS)
288  return "IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x126, METHOD_BUFFERED, FILE_ANY_ACCESS)
290  return "IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS"; // CTL_CODE(FILE_DEVICE_VIDEO, 0x127, METHOD_BUFFERED, FILE_ANY_ACCESS)
291  }
292 
293  return "<unknown ioctl code";
294 }
295 
296 static
297 NTSTATUS
303 {
304  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
305 
306  /* Check buffer size */
309  {
310  ERR_(VIDEOPRT, "Buffer too small for VIDEO_DEVICE_SESSION_STATUS: %lx\n",
311  BufferLength);
313  }
314 
315  /* Get the device extension */
316  DeviceExtension = DeviceObject->DeviceExtension;
317 
318  /* Shall we enable the session? */
319  if (SessionState->bEnable)
320  {
321  /* Check if we have no session yet */
322  if (DeviceExtension->SessionId == -1)
323  {
324  /* Use this session and return success */
325  DeviceExtension->SessionId = PsGetCurrentProcessSessionId();
326  SessionState->bSuccess = TRUE;
327  }
328  else
329  {
330  ERR_(VIDEOPRT, "Requested to set session, but session is already set to: 0x%lx\n",
331  DeviceExtension->SessionId);
332  SessionState->bSuccess = FALSE;
333  }
334  }
335  else
336  {
337  /* Check if we belong to the current session */
338  if (DeviceExtension->SessionId == PsGetCurrentProcessSessionId())
339  {
340  /* Reset the session and return success */
341  DeviceExtension->SessionId = -1;
342  SessionState->bSuccess = TRUE;
343  }
344  else
345  {
346  ERR_(VIDEOPRT, "Requested to reset session, but session is not set\n");
347  SessionState->bSuccess = FALSE;
348  }
349  }
350 
351  return STATUS_SUCCESS;
352 }
353 
354 static
355 NTSTATUS
358  _Inout_ PVIDEO_WIN32K_CALLBACKS Win32kCallbacks,
361 {
363  if (BufferLength < sizeof(VIDEO_WIN32K_CALLBACKS))
364  {
365  ERR_(VIDEOPRT, "Buffer too small for VIDEO_WIN32K_CALLBACKS: %lx\n",
366  BufferLength);
368  }
369 
370  /* Save the callout function globally */
371  Win32kCallout = Win32kCallbacks->Callout;
372 
373  /* Return reasonable values to win32k */
374  Win32kCallbacks->bACPI = FALSE;
375  Win32kCallbacks->pPhysDeviceObject = DeviceObject;
376  Win32kCallbacks->DualviewFlags = 0;
377 
378  return STATUS_SUCCESS;
379 }
380 
381 static
382 NTSTATUS
385  IN PIRP Irp)
386 {
387  PIO_STACK_LOCATION IrpStack;
389  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
391 
392  TRACE_(VIDEOPRT, "VideoPortForwardDeviceControl\n");
393 
394  IrpStack = IoGetCurrentIrpStackLocation(Irp);
395  DeviceExtension = DeviceObject->DeviceExtension;
396  DriverExtension = DeviceExtension->DriverExtension;
397 
398  /* Translate the IRP to a VRP */
399  vrp.StatusBlock = (PSTATUS_BLOCK)&Irp->IoStatus;
400  vrp.IoControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode;
401 
402  INFO_(VIDEOPRT, "- IoControlCode: %x\n", vrp.IoControlCode);
403 
404  /* We're assuming METHOD_BUFFERED */
405  vrp.InputBuffer = Irp->AssociatedIrp.SystemBuffer;
406  vrp.InputBufferLength = IrpStack->Parameters.DeviceIoControl.InputBufferLength;
407  vrp.OutputBuffer = Irp->AssociatedIrp.SystemBuffer;
408  vrp.OutputBufferLength = IrpStack->Parameters.DeviceIoControl.OutputBufferLength;
409 
410  /* Call the Miniport Driver with the VRP */
411  DriverExtension->InitializationData.HwStartIO(&DeviceExtension->MiniPortDeviceExtension,
412  &vrp);
413 
414  INFO_(VIDEOPRT, "- Returned status: %x\n", Irp->IoStatus.Status);
415 
416  /* Map from win32 error codes to NT status values. */
417  switch (Irp->IoStatus.Status)
418  {
419  case NO_ERROR:
420  return STATUS_SUCCESS;
423  case ERROR_MORE_DATA:
424  return STATUS_BUFFER_OVERFLOW;
426  return STATUS_NOT_IMPLEMENTED;
431  case ERROR_DEV_NOT_EXIST:
433  case ERROR_IO_PENDING:
434  return STATUS_PENDING;
435  default:
436  return STATUS_UNSUCCESSFUL;
437  }
438 }
439 
440 /*
441  * IntVideoPortDispatchDeviceControl
442  *
443  * Answer requests for device control calls.
444  *
445  * Run Level
446  * PASSIVE_LEVEL
447  */
448 NTSTATUS
449 NTAPI
452  IN PIRP Irp)
453 {
454  PIO_STACK_LOCATION IrpStack;
457 
458  TRACE_(VIDEOPRT, "IntVideoPortDispatchDeviceControl\n");
459 
460  IrpStack = IoGetCurrentIrpStackLocation(Irp);
461 
462  IoControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode;
463 
464  INFO_(VIDEOPRT, "- IoControlCode: %x: %s\n", IoControlCode, IoctlName(IoControlCode));
465 
466  switch(IoControlCode)
467  {
469  INFO_(VIDEOPRT, "- IOCTL_VIDEO_INIT_WIN32K_CALLBACKS\n");
471  Irp->AssociatedIrp.SystemBuffer,
472  IrpStack->Parameters.DeviceIoControl.InputBufferLength,
473  &Irp->IoStatus.Information);
474  break;
475 
477  INFO_(VIDEOPRT, "- IOCTL_VIDEO_USE_DEVICE_IN_SESSION\n");
479  Irp->AssociatedIrp.SystemBuffer,
480  IrpStack->Parameters.DeviceIoControl.InputBufferLength,
481  &Irp->IoStatus.Information);
482  break;
483 
484  default:
485  /* Forward to the Miniport Driver */
487  break;
488  }
489 
490  INFO_(VIDEOPRT, "- Returned status: %x\n", Irp->IoStatus.Status);
491 
492  Irp->IoStatus.Status = Status;
494 
495  return Status;
496 }
497 
498 /*
499  * IntVideoPortWrite
500  *
501  * This is a bit of a hack. We want to take ownership of the display as late
502  * as possible, just before the switch to graphics mode. Win32k knows when
503  * this happens, we don't. So we need Win32k to inform us. This could be done
504  * using an IOCTL, but there's no way of knowing which IOCTL codes are unused
505  * in the communication between GDI driver and miniport driver. So we use
506  * IRP_MJ_WRITE as the signal that win32k is ready to switch to graphics mode,
507  * since we know for certain that there is no read/write activity going on
508  * between GDI and miniport drivers.
509  * We don't actually need the data that is passed, we just trigger on the fact
510  * that an IRP_MJ_WRITE was sent.
511  *
512  * Run Level
513  * PASSIVE_LEVEL
514  */
515 NTSTATUS
516 NTAPI
519  IN PIRP Irp)
520 {
522  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
523  NTSTATUS nErrCode;
524 
526 
527  /*
528  * Storing the device extension pointer in a static variable is an
529  * ugly hack. Unfortunately, we need it in IntVideoPortResetDisplayParameters
530  * and InbvNotifyDisplayOwnershipLost doesn't allow us to pass a userdata
531  * parameter. On the bright side, the DISPLAY device is opened
532  * exclusively, so there can be only one device extension active at
533  * any point in time.
534  *
535  * FIXME: We should process all opened display devices in
536  * IntVideoPortResetDisplayParameters.
537  */
538  ResetDisplayParametersDeviceExtension = DeviceExtension;
540 
541  nErrCode = STATUS_SUCCESS;
542  Irp->IoStatus.Information = piosStack->Parameters.Write.Length;
543  Irp->IoStatus.Status = nErrCode;
545 
546  return nErrCode;
547 }
548 
549 NTSTATUS
550 NTAPI
553  IN PIRP Irp)
554 {
558  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
560 
561  /* Get the initialization data we saved in VideoPortInitialize.*/
562  DriverObject = DeviceObject->DriverObject;
565 
566  /* Store some resources in the DeviceExtension. */
567  AllocatedResources = Stack->Parameters.StartDevice.AllocatedResources;
569  {
570  CM_FULL_RESOURCE_DESCRIPTOR *FullList;
573  ULONG ResourceListSize;
574 
575  /* Save the resource list */
576  ResourceCount = AllocatedResources->List[0].PartialResourceList.Count;
577  ResourceListSize =
578  FIELD_OFFSET(CM_RESOURCE_LIST, List[0].PartialResourceList.
579  PartialDescriptors[ResourceCount]);
580  DeviceExtension->AllocatedResources = ExAllocatePool(PagedPool, ResourceListSize);
581  if (DeviceExtension->AllocatedResources == NULL)
582  {
584  }
585 
586  RtlCopyMemory(DeviceExtension->AllocatedResources,
588  ResourceListSize);
589 
590  /* Get the interrupt level/vector - needed by HwFindAdapter sometimes */
591  FullList = AllocatedResources->List;
592  ASSERT(AllocatedResources->Count == 1);
593  INFO_(VIDEOPRT, "InterfaceType %u BusNumber List %u Device BusNumber %u Version %u Revision %u\n",
594  FullList->InterfaceType, FullList->BusNumber, DeviceExtension->SystemIoBusNumber, FullList->PartialResourceList.Version, FullList->PartialResourceList.Revision);
595 
596  /* FIXME: Is this ASSERT ok for resources from the PNP manager? */
597  ASSERT(FullList->InterfaceType == PCIBus);
598  ASSERT(FullList->BusNumber == DeviceExtension->SystemIoBusNumber);
599  ASSERT(1 == FullList->PartialResourceList.Version);
600  ASSERT(1 == FullList->PartialResourceList.Revision);
602  Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count;
603  Descriptor++)
604  {
605  if (Descriptor->Type == CmResourceTypeInterrupt)
606  {
607  DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level;
608  DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector;
609  if (Descriptor->ShareDisposition == CmResourceShareShared)
610  DeviceExtension->InterruptShared = TRUE;
611  else
612  DeviceExtension->InterruptShared = FALSE;
613  }
614  }
615  }
616 
617  INFO_(VIDEOPRT, "Interrupt level: 0x%x Interrupt Vector: 0x%x\n",
618  DeviceExtension->InterruptLevel,
619  DeviceExtension->InterruptVector);
620 
621  /* Create adapter device object. */
624  DeviceObject);
625 }
626 
627 
628 NTSTATUS
629 NTAPI
631  PDEVICE_OBJECT Fdo,
632  PIRP Irp,
633  PVOID Context)
634 {
636 
637  if (Irp->PendingReturned)
639 
641 }
642 
643 NTSTATUS
644 NTAPI
646 {
647  PDEVICE_RELATIONS DeviceRelations;
649  PVIDEO_PORT_CHILD_EXTENSION ChildExtension;
650  ULONG i;
651  PLIST_ENTRY CurrentEntry;
652 
653  /* Count the children */
654  i = 0;
655  CurrentEntry = DeviceExtension->ChildDeviceList.Flink;
656  while (CurrentEntry != &DeviceExtension->ChildDeviceList)
657  {
658  i++;
659  CurrentEntry = CurrentEntry->Flink;
660  }
661 
662  if (i == 0)
663  return Irp->IoStatus.Status;
664 
665  DeviceRelations = ExAllocatePool(PagedPool,
666  sizeof(DEVICE_RELATIONS) + ((i - 1) * sizeof(PVOID)));
667  if (!DeviceRelations) return STATUS_NO_MEMORY;
668 
669  DeviceRelations->Count = i;
670 
671  /* Add the children */
672  i = 0;
673  CurrentEntry = DeviceExtension->ChildDeviceList.Flink;
674  while (CurrentEntry != &DeviceExtension->ChildDeviceList)
675  {
676  ChildExtension = CONTAINING_RECORD(CurrentEntry, VIDEO_PORT_CHILD_EXTENSION, ListEntry);
677 
678  ObReferenceObject(ChildExtension->PhysicalDeviceObject);
679  DeviceRelations->Objects[i] = ChildExtension->PhysicalDeviceObject;
680 
681  i++;
682  CurrentEntry = CurrentEntry->Flink;
683  }
684 
685  INFO_(VIDEOPRT, "Reported %d PDOs\n", i);
686  Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
687 
688  return STATUS_SUCCESS;
689 }
690 
691 NTSTATUS
692 NTAPI
694 {
695  KEVENT Event;
697  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension =
699 
704  &Event,
705  TRUE,
706  TRUE,
707  TRUE);
708 
709  Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
710  if (Status == STATUS_PENDING)
711  {
713  Status = Irp->IoStatus.Status;
714  }
715 
716  return Status;
717 }
718 
719 NTSTATUS
720 NTAPI
723  IN PIRP Irp)
724 {
728 
730 
731  switch (IrpSp->MinorFunction)
732  {
733  case IRP_MN_START_DEVICE:
735  if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
737  Irp->IoStatus.Status = Status;
738  Irp->IoStatus.Information = 0;
740  break;
741 
744  if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
746  Irp->IoStatus.Status = Status;
747  Irp->IoStatus.Information = 0;
749  break;
750 
752  if (IrpSp->Parameters.QueryDeviceRelations.Type != BusRelations)
753  {
755  Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
756  }
757  else
758  {
760  Irp->IoStatus.Status = Status;
762  }
763  break;
764 
769 
770  case IRP_MN_STOP_DEVICE:
772  if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
774  Irp->IoStatus.Status = Status;
775  Irp->IoStatus.Information = 0;
777  break;
778 
782  Irp->IoStatus.Status = STATUS_SUCCESS;
783  Irp->IoStatus.Information = 0;
785  break;
786 
787  default:
788  Status = Irp->IoStatus.Status;
790  break;
791  }
792 
793  return Status;
794 }
795 
796 NTSTATUS
797 NTAPI
800  IN PIRP Irp)
801 {
803 
804  if (CommonExtension->Fdo)
806  else
808 }
809 
810 NTSTATUS
811 NTAPI
814  IN PIRP Irp)
815 {
816  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
817 
818  DeviceExtension = DeviceObject->DeviceExtension;
819  RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
820 
821  Irp->IoStatus.Status = STATUS_SUCCESS;
822  Irp->IoStatus.Information = 0;
824 
825  return STATUS_SUCCESS;
826 }
827 
828 NTSTATUS
829 NTAPI
832  IN PIRP Irp)
833 {
835  NTSTATUS Status = Irp->IoStatus.Status;
837 
839 
840  if (DeviceExtension->Common.Fdo)
841  {
844  return PoCallDriver(DeviceExtension->NextDeviceObject, Irp);
845  }
846  else
847  {
848  switch (IrpSp->MinorFunction)
849  {
850  case IRP_MN_QUERY_POWER:
851  case IRP_MN_SET_POWER:
853  break;
854  }
856  Irp->IoStatus.Status = Status;
858  return Status;
859  }
860 }
861 
862 NTSTATUS
863 NTAPI
866  IN PIRP Irp)
867 {
870 
871  if (DeviceExtension->Common.Fdo)
872  {
874  return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
875  }
876  else
877  {
878  Status = Irp->IoStatus.Status;
880  return Status;
881  }
882 }
883 
884 VOID
885 NTAPI
887 {
888 }
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:504
#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:298
NTSTATUS NTAPI IntVideoPortDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:830
#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:721
#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:4622
_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:812
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2054
#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:630
#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
ULONG InputBufferLength
Definition: video.h:333
NTSTATUS NTAPI IntVideoPortDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:450
#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:179
#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:886
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:434
#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:145
static NTSTATUS VideoPortInitWin32kCallbacks(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PVIDEO_WIN32K_CALLBACKS Win32kCallbacks, _In_ ULONG BufferLength, _Out_ PULONG_PTR Information)
Definition: dispatch.c:356
NTSTATUS NTAPI IntVideoPortDispatchClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:154
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:864
#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:47
#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:1833
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:517
static const COLUMN_LIST Columns[]
Definition: listview.c:19
NTSTATUS NTAPI IntVideoPortForwardIrpAndWait(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: dispatch.c:693
#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:551
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:798
#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:645
ULONG CsrssInitialized
Definition: videoprt.c:33
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:120
struct tagContext Context
Definition: acpixf.h:1012
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:565
#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:383
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:2771
#define IOCTL_VIDEO_RESTORE_HARDWARE_STATE
Definition: ntddvdeo.h:140
return STATUS_SUCCESS
Definition: btrfs.c:2725
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