ReactOS 0.4.17-dev-1423-g539b424
videoprt.c
Go to the documentation of this file.
1/*
2 * VideoPort driver
3 *
4 * Copyright (C) 2002-2004, 2007 ReactOS Team
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22#include "videoprt.h"
23
24#include <stdio.h>
25#include <ndk/exfuncs.h>
26#include <ndk/obfuncs.h>
27#include <ndk/rtlfuncs.h>
28
29#define NDEBUG
30#include <debug.h>
31
32/* GLOBAL VARIABLES ***********************************************************/
33
35
38
42
49
50/* PRIVATE FUNCTIONS **********************************************************/
51
52static BOOLEAN
55{
56 static const UNICODE_STRING VgaSave = RTL_CONSTANT_STRING(L"\\Driver\\VgaSave");
57 return RtlEqualUnicodeString(&VgaSave, &DriverObject->DriverName, TRUE);
58}
59
65{
66 return STATUS_SUCCESS;
67}
68
69static
72 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
73{
75 WCHAR DeviceBuffer[20];
77 WCHAR SymlinkBuffer[20];
78 UNICODE_STRING SymlinkName;
81
82 /* Create a unicode device name */
83 DeviceNumber = DeviceExtension->DeviceNumber;
84 _swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
85
87 RegistryPath = &DeviceExtension->NewRegistryPath;
88 else
89 RegistryPath = &DeviceExtension->RegistryPath;
90
91 /* Add entry to DEVICEMAP\VIDEO key in registry */
93 L"VIDEO",
94 DeviceBuffer,
95 REG_SZ,
96 RegistryPath->Buffer,
97 RegistryPath->Length + sizeof(UNICODE_NULL));
98 if (!NT_SUCCESS(Status))
99 {
100 ERR_(VIDEOPRT, "Failed to create DEVICEMAP registry entry: 0x%X\n", Status);
101 return Status;
102 }
103
105 L"VIDEO",
106 L"MaxObjectNumber",
107 REG_DWORD,
109 sizeof(DeviceNumber));
110 if (!NT_SUCCESS(Status))
111 {
112 ERR_(VIDEOPRT, "Failed to write MaxObjectNumber: 0x%X\n", Status);
113 return Status;
114 }
115
116 /* Create symbolic link "\??\DISPLAYx" */
117 _swprintf(SymlinkBuffer, L"\\??\\DISPLAY%lu", DeviceNumber + 1);
118 RtlInitUnicodeString(&SymlinkName, SymlinkBuffer);
119 RtlInitUnicodeString(&DeviceName, DeviceBuffer);
120 Status = IoCreateSymbolicLink(&SymlinkName, &DeviceName);
121 if (!NT_SUCCESS(Status))
122 {
123 ERR_(VIDEOPRT, "Failed to create symbolic link: 0x%X\n", Status);
124 return Status;
125 }
126
127 /* Update MaxObjectNumber */
129
130 return STATUS_SUCCESS;
131}
132
133PVOID
134NTAPI
138{
139 PIMAGE_NT_HEADERS NtHeader;
140 ULONG Va;
141
142 NtHeader = RtlImageNtHeader(BaseAddress);
143 if (NtHeader == NULL)
144 return NULL;
145
147 return NULL;
148
150 if (Va == 0)
151 return NULL;
152
153 return (PVOID)((ULONG_PTR)BaseAddress + Va);
154}
155
156VOID
157NTAPI
159 IN PKDPC Dpc,
163{
164 PVOID HwDeviceExtension =
165 &((PVIDEO_PORT_DEVICE_EXTENSION)DeferredContext)->MiniPortDeviceExtension;
167}
168
170NTAPI
175 _In_ USHORT AdapterNumber,
176 _In_ USHORT DisplayNumber,
178{
179 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
181 ULONG PciSlotNumber;
183 ULONG Size;
185 WCHAR DeviceBuffer[20];
187 PDEVICE_OBJECT DeviceObject_;
188
189 if (DeviceObject == NULL)
190 DeviceObject = &DeviceObject_;
191
192 /*
193 * Find the first free device number that can be used for video device
194 * object names and symlinks.
195 */
197 if (DeviceNumber == (ULONG)-1)
198 {
199 WARN_(VIDEOPRT, "Can't find free device number\n");
200 return STATUS_UNSUCCESSFUL;
201 }
202
203 /*
204 * Create the device object.
205 */
206
207 /* Create a unicode device name */
208 _swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
209 RtlInitUnicodeString(&DeviceName, DeviceBuffer);
210
211 INFO_(VIDEOPRT, "HwDeviceExtension size is: 0x%x\n",
212 DriverExtension->InitializationData.HwDeviceExtensionSize);
213
214 /* Create the device object */
216 DriverExtension->InitializationData.HwDeviceExtensionSize;
218 Size,
219 &DeviceName,
221 0,
222 TRUE,
224
225 if (!NT_SUCCESS(Status))
226 {
227 WARN_(VIDEOPRT, "IoCreateDevice call failed with status 0x%08x\n", Status);
228 return Status;
229 }
230
231 /*
232 * Set the buffering strategy here. If you change this, remember
233 * to change VidDispatchDeviceControl too.
234 */
235
236 (*DeviceObject)->Flags |= DO_BUFFERED_IO;
237
238 /* Initialize device extension */
239 DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)((*DeviceObject)->DeviceExtension);
240 DeviceExtension->Common.Fdo = TRUE;
241 DeviceExtension->DeviceNumber = DeviceNumber;
242 DeviceExtension->DriverObject = DriverObject;
244 DeviceExtension->FunctionalDeviceObject = *DeviceObject;
245 DeviceExtension->DriverExtension = DriverExtension;
246 DeviceExtension->SessionId = -1;
247 DeviceExtension->AdapterNumber = AdapterNumber;
248 DeviceExtension->DisplayNumber = DisplayNumber;
249 DeviceExtension->IsVgaDriver = IntIsVgaSaveDriver(DriverObject);
250
251 InitializeListHead(&DeviceExtension->ChildDeviceList);
252
253 /*
254 * Miniport owns this blob; many miniports assume it's initially zeroed.
255 * Removing this crashes the NVIDIA GPU driver.
256 */
257 RtlZeroMemory(DeviceExtension->MiniPortDeviceExtension,
258 DriverExtension->InitializationData.HwDeviceExtensionSize);
259
260 /* Get the registry path associated with this device */
262 DeviceExtension->AdapterNumber,
263 &DeviceExtension->RegistryPath);
264 if (!NT_SUCCESS(Status))
265 {
266 WARN_(VIDEOPRT, "IntCreateRegistryPath() call failed with status 0x%08x\n", Status);
267 goto Failure;
268 }
269
271 {
272 /* Get bus number from the upper level bus driver */
273 Size = sizeof(ULONG);
276 Size,
277 &DeviceExtension->SystemIoBusNumber,
278 &Size);
279 if (!NT_SUCCESS(Status))
280 {
281 WARN_(VIDEOPRT, "Couldn't get an information from bus driver. We will try to\n"
282 "use legacy detection method, but even that doesn't mean that\n"
283 "it will work.\n");
284 DeviceExtension->PhysicalDeviceObject = NULL;
285 }
286 }
287
288 DeviceExtension->AdapterInterfaceType =
289 DriverExtension->InitializationData.AdapterInterfaceType;
290
292 {
293 /* Get bus type from the upper level bus driver */
294 Size = sizeof(ULONG);
297 Size,
298 &DeviceExtension->AdapterInterfaceType,
299 &Size);
300
301 /* Get bus device address from the upper level bus driver */
302 Size = sizeof(ULONG);
305 Size,
306 &PciSlotNumber,
307 &Size);
308
309 /* Convert slotnumber to PCI_SLOT_NUMBER */
310 SlotNumber.u.AsULONG = 0;
311 SlotNumber.u.bits.DeviceNumber = (PciSlotNumber >> 16) & 0xFFFF;
312 SlotNumber.u.bits.FunctionNumber = PciSlotNumber & 0xFFFF;
313 DeviceExtension->SystemIoSlotNumber = SlotNumber.u.AsULONG;
314 }
315
317 InitializeListHead(&DeviceExtension->DmaAdapterList);
318
319 KeInitializeDpc(&DeviceExtension->DpcObject,
321 DeviceExtension);
322
323 KeInitializeMutex(&DeviceExtension->DeviceLock, 0);
324
325 /* Attach the device */
326 if ((PhysicalDeviceObject != NULL) && (DisplayNumber == 0))
330
331 Status = IntCreateNewRegistryPath(DeviceExtension);
332 if (!NT_SUCCESS(Status))
333 {
334 ERR_(VIDEOPRT, "IntCreateNewRegistryPath() failed with status 0x%08x\n", Status);
335 goto Failure;
336 }
337
338 IntSetupDeviceSettingsKey(DeviceExtension);
339
340 /* Remove the initializing flag */
341 (*DeviceObject)->Flags &= ~DO_DEVICE_INITIALIZING;
342
343 /* Set up the VIDEO/DEVICEMAP registry keys */
344 Status = IntVideoPortAddDeviceMapLink(DeviceExtension);
345 if (!NT_SUCCESS(Status))
346 {
347 ERR_(VIDEOPRT, "IntVideoPortAddDeviceMapLink() failed with status 0x%08x\n", Status);
348 goto Failure;
349 }
350
351 if (DisplayNumber == 0)
352 {
353 DriverExtension->InitializationData.StartingDeviceNumber++;
354 }
355
356 return STATUS_SUCCESS;
357
358Failure:
359 if (DeviceExtension->NextDeviceObject)
360 IoDetachDevice(DeviceExtension->NextDeviceObject);
363 return Status;
364}
365
371static NTSTATUS
372NTAPI
375 _In_ PUNICODE_STRING PathName,
379 _In_ CONFIGURATION_TYPE ControllerType,
380 _In_ ULONG ControllerNumber,
381 _In_ PKEY_VALUE_FULL_INFORMATION* ControllerInformation,
382 _In_ CONFIGURATION_TYPE PeripheralType,
383 _In_ ULONG PeripheralNumber,
384 _In_ PKEY_VALUE_FULL_INFORMATION* PeripheralInformation)
385{
387 UNREFERENCED_PARAMETER(PathName);
391 UNREFERENCED_PARAMETER(ControllerType);
392 UNREFERENCED_PARAMETER(ControllerNumber);
393 UNREFERENCED_PARAMETER(ControllerInformation);
394 UNREFERENCED_PARAMETER(PeripheralType);
395 UNREFERENCED_PARAMETER(PeripheralNumber);
396 UNREFERENCED_PARAMETER(PeripheralInformation);
397
398 /* The bus has been found */
399 return STATUS_SUCCESS;
400}
401
406static NTSTATUS
408 _In_ INTERFACE_TYPE AdapterInterfaceType,
410{
411 // TODO: Forward-compatibility with Windows 7+:
412 // In case AdapterInterfaceType == PCIBus, check for the
413 // \Registry\HARDWARE\DESCRIPTION\System\VideoAdapterBusses
414 // key (created by pci.sys) that enumerates the PCI buses that
415 // are known to have video display adapters on them.
416 // This is a handy shortcut for videoprt, that would otherwise
417 // have to enumerate all the PCI buses (PCI_MAX_BRIDGE_NUMBER)
418 // to locate any video adapter.
419 // Otherwise, fall back to the usual method done below.
420
421 /* Find the next bus of the given type */
422 return IoQueryDeviceDescription(&AdapterInterfaceType,
423 BusNumber,
424 NULL,
425 NULL,
426 NULL,
427 NULL,
429 NULL);
430}
431
436 _In_ _When_(LegacyDetection, _Null_) PDEVICE_OBJECT DeviceObject,
437 _In_ BOOLEAN LegacyDetection)
438{
439 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
441 VP_STATUS vpStatus;
442 VIDEO_PORT_CONFIG_INFO ConfigInfo;
444 UCHAR Again = FALSE;
445 BOOLEAN VgaResourcesReleased = FALSE;
446
447 if (LegacyDetection)
448 {
452 NULL, // No DeviceExtension->PhysicalDeviceObject
453 DriverExtension->InitializationData.StartingDeviceNumber,
454 0,
455 &DeviceObject);
456 if (!NT_SUCCESS(Status))
457 {
458 ERR_(VIDEOPRT, "IntVideoPortCreateAdapterDeviceObject returned 0x%x\n", Status);
459 return Status;
460 }
461 }
462
463 DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
464 DeviceExtension->IsVgaDetect = DeviceExtension->IsVgaDriver;
465 DeviceExtension->IsLegacyDetect = FALSE;
466 DeviceExtension->ReportDevice = FALSE;
467
468 /* Setup a ConfigInfo structure that we will pass to HwFindAdapter */
469 RtlZeroMemory(&ConfigInfo, sizeof(VIDEO_PORT_CONFIG_INFO));
470 ConfigInfo.Length = sizeof(VIDEO_PORT_CONFIG_INFO);
471 ConfigInfo.AdapterInterfaceType = DeviceExtension->AdapterInterfaceType;
472 if (ConfigInfo.AdapterInterfaceType == PCIBus)
473 ConfigInfo.InterruptMode = LevelSensitive;
474 else
475 ConfigInfo.InterruptMode = Latched;
476 ConfigInfo.DriverRegistryPath = DriverExtension->RegistryPath.Buffer;
478 ConfigInfo.SystemIoBusNumber = DeviceExtension->SystemIoBusNumber;
479 ConfigInfo.BusInterruptLevel = DeviceExtension->InterruptLevel;
480 ConfigInfo.BusInterruptVector = DeviceExtension->InterruptVector;
481
484 sizeof(SystemBasicInfo),
485 NULL);
486 if (NT_SUCCESS(Status))
487 {
490 }
491
492 // FIXME: Check the adapter key and update VideoDebugLevel variable.
493
494 /*
495 * Call the miniport HwVidFindAdapter entry point to detect if this
496 * particular device is present. There are two possible code paths.
497 * The first one is for Legacy drivers (NT4) and cases when we don't
498 * have information about what bus we're on. The second case is the
499 * standard one for Plug & Play drivers.
500 */
501 if (DeviceExtension->PhysicalDeviceObject == NULL)
502 {
503 ASSERT(LegacyDetection == TRUE);
504 DeviceExtension->IsLegacyDevice = TRUE;
505 DeviceExtension->IsLegacyDetect = TRUE;
506 }
507 else
508 {
509 ASSERT(LegacyDetection == FALSE);
510 DeviceExtension->IsLegacyDevice = FALSE;
511 }
512
513 /* If we already have a VGA miniport and are about to probe for additional adapters,
514 * release its resources temporarily so conflicts are visible during detection.
515 * We'll reclaim them later if no new adapter successfully claims them. */
518 {
519 INFO_(VIDEOPRT, "Temporarily releasing VGA resources for adapter probing\n");
521 VgaResourcesReleased = TRUE;
522 }
524
525 if (LegacyDetection)
526 {
528
529 /* Suppose first we may not find any suitable device */
530 vpStatus = ERROR_DEV_NOT_EXIST; // ERROR_NO_MORE_DEVICES;
531
532 /* Enumerate all buses of the given type, call HwFindAdapter for each
533 * to find whether a video adapter is recognized there. Stop when an
534 * adapter has been found. */
535 for (BusNumber = 0;
536 (BusNumber < MAXULONG) &&
538 &BusNumber));
539 ++BusNumber)
540 {
541 DPRINT("Bus Type %lu, Number %lu\n",
542 DeviceExtension->AdapterInterfaceType, BusNumber);
543
544 DeviceExtension->SystemIoBusNumber =
545 ConfigInfo.SystemIoBusNumber = BusNumber;
546
547 RtlZeroMemory(&DeviceExtension->MiniPortDeviceExtension,
548 DriverExtension->InitializationData.HwDeviceExtensionSize);
549
550 // FIXME: Need to figure out what string to pass as param 3.
551 // FIXME: Handle the 'Again' parameter for legacy detection.
552 vpStatus = DriverExtension->InitializationData.HwFindAdapter(
553 &DeviceExtension->MiniPortDeviceExtension,
554 DriverExtension->HwContext,
555 NULL,
556 &ConfigInfo,
557 &Again);
558
559 if (vpStatus == ERROR_DEV_NOT_EXIST)
560 continue;
561 else
562 break;
563 }
564 }
565 else
566 {
567 // FIXME: Need to figure out what string to pass as param 3.
568 vpStatus = DriverExtension->InitializationData.HwFindAdapter(
569 &DeviceExtension->MiniPortDeviceExtension,
570 DriverExtension->HwContext,
571 NULL,
572 &ConfigInfo,
573 &Again);
574 }
575
576 if (vpStatus != NO_ERROR)
577 {
578 ERR_(VIDEOPRT, "HwFindAdapter failed (vpStatus=0x%X) bus=%u iface=%u legacy=%u vga=%u detect(VGA=%u LEGACY=%u)\n",
579 vpStatus,
580 DeviceExtension->SystemIoBusNumber,
581 DeviceExtension->AdapterInterfaceType,
582 DeviceExtension->IsLegacyDevice,
583 DeviceExtension->IsVgaDriver,
584 DeviceExtension->IsVgaDetect,
585 DeviceExtension->IsLegacyDetect);
586 /* If we released VGA resources, reclaim them so VGA fallback still works */
587 if (VgaResourcesReleased)
588 {
590 {
591 INFO_(VIDEOPRT, "Reclaiming VGA resources after failed probe\n");
595 {
596 WARN_(VIDEOPRT, "Failed to reclaim VGA resources after probe failure\n");
597 }
598 }
599 }
601 goto Failure;
602 }
603
604 /*
605 * Now we know the device is present, so let's do all additional tasks
606 * such as creating symlinks or setting up interrupts and timer.
607 */
608
609 // FIXME: Allocate hardware resources for device.
610
611 /* Allocate interrupt for device */
613 {
615 goto Failure;
616 }
617
618 /* Allocate timer for device */
620 {
621 if (DeviceExtension->InterruptObject != NULL)
622 IoDisconnectInterrupt(DeviceExtension->InterruptObject);
623 ERR_(VIDEOPRT, "IntVideoPortSetupTimer failed\n");
625 goto Failure;
626 }
627
628 /* If the device can be reset, insert it in the list of resettable adapters */
629 InitializeListHead(&DeviceExtension->HwResetListEntry);
630 if (DriverExtension->InitializationData.HwResetHw != NULL)
631 {
633 &DeviceExtension->HwResetListEntry,
635 }
636
637 if (DeviceExtension->IsVgaDriver)
638 {
641 {
642 VgaDeviceExtension = DeviceExtension;
643 }
645 }
646
647 DeviceExtension->IsVgaDetect = FALSE;
648 DeviceExtension->IsLegacyDetect = FALSE;
649
650 /* For legacy (non-PnP) adapters we should report a detected device so that
651 * a PDO exists for higher layers to enumerate consistently (mirrors ScsiPort). */
652 if (DeviceExtension->IsLegacyDevice && !DeviceExtension->ReportDevice)
653 {
654 PDEVICE_OBJECT ReportedPdo = NULL;
656 DeviceExtension->AdapterInterfaceType,
657 DeviceExtension->SystemIoBusNumber,
658 DeviceExtension->SystemIoSlotNumber,
659 NULL,
660 NULL,
661 FALSE,
662 &ReportedPdo);
663 if (!NT_SUCCESS(repStatus))
664 {
665 WARN_(VIDEOPRT, "IoReportDetectedDevice failed 0x%08lx (bus=%u slot=%u)\n",
666 repStatus,
667 DeviceExtension->SystemIoBusNumber,
668 DeviceExtension->SystemIoSlotNumber);
669 }
670 else
671 {
672 INFO_(VIDEOPRT, "Reported legacy adapter PDO %p (bus=%u slot=%u)\n",
673 ReportedPdo,
674 DeviceExtension->SystemIoBusNumber,
675 DeviceExtension->SystemIoSlotNumber);
676 DeviceExtension->ReportDevice = TRUE;
677 }
678 }
679
680 /* Attempt to reclaim VGA resources after probing if a VGA device exists */
682 {
683 VP_STATUS vr;
684 INFO_(VIDEOPRT, "Attempt VGA reclaim after probe (ranges=%lu)\n", NumOfVgaRanges);
687 VgaRanges);
688 if (vr != NO_ERROR)
689 {
690 /* Another driver has taken VGA resources; drop fallback state */
691 WARN_(VIDEOPRT, "VGA reclaim failed (vpStatus=0x%X); releasing fallback state\n", vr);
694 VgaRanges = NULL;
695 NumOfVgaRanges = 0;
698
699 }
700 else
701 {
702 INFO_(VIDEOPRT, "VGA reclaim succeeded\n");
703 }
704 }
705
706 INFO_(VIDEOPRT, "STATUS_SUCCESS\n");
707 return STATUS_SUCCESS;
708
709Failure:
710 RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
711 if (DeviceExtension->NextDeviceObject)
712 IoDetachDevice(DeviceExtension->NextDeviceObject);
713
714 /* Explicitly reclaim VGA resources on complete failure */
715 if (VgaResourcesReleased)
716 {
718 {
719 INFO_(VIDEOPRT, "Final reclaim attempt of VGA resources during failure cleanup\n");
723 {
724 WARN_(VIDEOPRT, "VGA reclaim failed during failure cleanup\n");
725 }
726 }
727 }
729 return Status;
730}
731
749 _Outptr_ PKPROCESS* CallingProcess,
751{
752 if (!CsrProcess)
753 return FALSE;
754
755 *CallingProcess = (PKPROCESS)PsGetCurrentProcess();
756 if (*CallingProcess != CsrProcess)
758 return TRUE;
759}
760
773VOID
776 _In_ PKPROCESS CallingProcess,
778{
780 if (CallingProcess != CsrProcess)
782}
783
784VOID
787{
791 UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"SystemStartOptions");
795
796 /* Check if we need to use new registry */
797 RtlInitUnicodeString(&KeyPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\GraphicsDrivers\\UseNewKey");
799 &KeyPath,
801 NULL,
802 NULL);
806 if (NT_SUCCESS(Status))
807 {
810 }
811
812#ifdef _M_IX86
813 /* Check whether we need to use the 32-bit x86 emulator instead of V86 mode */
814 RtlInitUnicodeString(&KeyPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\GraphicsDrivers\\DisableEmulator");
816 &KeyPath,
818 NULL,
819 NULL);
823 if (NT_SUCCESS(Status))
824 {
825 VideoPortDisableX86Emulator = TRUE;
827 }
828 DPRINT1("Using %s\n", VideoPortDisableX86Emulator ? "V86 mode" : "x86 emulator");
829#endif // _M_IX86
830
831 /* Initialize object attributes with the path we want */
832 RtlInitUnicodeString(&KeyPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control");
834 &KeyPath,
836 NULL,
837 NULL);
838
839 /* Open the key */
843 if (!NT_SUCCESS(Status))
844 {
845 VideoPortDebugPrint(Error, "ZwOpenKey failed (0x%x)\n", Status);
846 return;
847 }
848
849 /* Find out how large our buffer should be */
850 Status = ZwQueryValueKey(KeyHandle,
851 &ValueName,
853 NULL,
854 0,
855 &Length);
857 {
858 VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status);
860 return;
861 }
862
863 /* Allocate it */
865 if (!KeyInfo)
866 {
867 VideoPortDebugPrint(Error, "Out of memory\n");
869 return;
870 }
871
872 /* Now for real this time */
873 Status = ZwQueryValueKey(KeyHandle,
874 &ValueName,
876 KeyInfo,
877 Length,
878 &NewLength);
880
881 if (!NT_SUCCESS(Status))
882 {
883 VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status);
885 return;
886 }
887
888 /* Sanity check */
889 if (KeyInfo->Type != REG_SZ)
890 {
891 VideoPortDebugPrint(Error, "Invalid type for SystemStartOptions\n");
893 return;
894 }
895
896 /* Check if BASEVIDEO or NOVESA is present in the start options */
897 if (wcsstr((PWCHAR)KeyInfo->Data, L"BASEVIDEO"))
899 if (wcsstr((PWCHAR)KeyInfo->Data, L"NOVESA"))
900 VpNoVesa = TRUE;
901
903
904 /* FIXME: Old ReactOS-compatibility... */
906
907 if (VpNoVesa)
908 VideoPortDebugPrint(Info, "VESA mode disabled\n");
909 else
910 VideoPortDebugPrint(Info, "VESA mode enabled\n");
911
912 /* If we are in BASEVIDEO, create the volatile registry key for Win32k */
913 if (VpBaseVideo)
914 {
915 RtlInitUnicodeString(&KeyPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\GraphicsDrivers\\BaseVideo");
917 &KeyPath,
919 NULL,
920 NULL);
921
922 Status = ZwCreateKey(&KeyHandle,
923 READ_CONTROL, // Non-0 placeholder: no use for this handle.
925 0,
926 NULL,
928 NULL);
929 if (NT_SUCCESS(Status))
931 else
932 ERR_(VIDEOPRT, "Failed to create the BaseVideo key (0x%x)\n", Status);
933 }
934
935 return;
936}
937
938/* PUBLIC FUNCTIONS ***********************************************************/
939
940/*
941 * @implemented
942 */
943ULONG
944NTAPI
950{
955 BOOLEAN PnpDriver = FALSE, LegacyDetection = FALSE;
956 static BOOLEAN FirstInitialization = FALSE;
957
958 TRACE_(VIDEOPRT, "VideoPortInitialize\n");
959
960 if (!FirstInitialization)
961 {
962 FirstInitialization = TRUE;
967
969 if (!NT_SUCCESS(Status))
970 {
971 ERR_(VIDEOPRT, "IntInitializeInt10(FirstInit) failed: 0x%lx\n", Status);
972 // return Status; // Let's continue and hope for the best...
973 }
974 }
975
976 /* As a first thing do parameter checks */
978 (HwInitializationData->HwInitDataSize > sizeof(VIDEO_HW_INITIALIZATION_DATA)))
979 {
980 ERR_(VIDEOPRT, "Invalid HwInitializationData size %lu (minimum %lu, maximum %lu)\n",
981 HwInitializationData->HwInitDataSize,
985 }
986
987 if ((HwInitializationData->HwFindAdapter == NULL) ||
988 (HwInitializationData->HwInitialize == NULL) ||
989 (HwInitializationData->HwStartIO == NULL))
990 {
991 ERR_(VIDEOPRT, "Invalid HwInitializationData\n");
993 }
994
995 /* The size tells the structure revision */
997 {
998 INFO_(VIDEOPRT, "We were loaded by a Windows NT 4 miniport driver.\n");
999 }
1001 {
1002 INFO_(VIDEOPRT, "We were loaded by a Windows 2000 or early XP miniport driver.\n");
1003 }
1004 else
1005 {
1006 INFO_(VIDEOPRT, "We were loaded by a Windows XP or later miniport driver.\n");
1007 }
1008
1009 /* Set dispatching routines */
1012 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
1014 DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] =
1016 DriverObject->DriverUnload = IntVideoPortUnload;
1017
1018 /*
1019 * Determine type of the miniport driver. NT4 drivers are special case,
1020 * because we must use legacy method of detection instead of the PnP one.
1021 */
1022 if ((HwInitializationData->HwInitDataSize >=
1023 FIELD_OFFSET(VIDEO_HW_INITIALIZATION_DATA, HwQueryInterface)) &&
1024 (HwInitializationData->HwSetPowerState != NULL) &&
1025 (HwInitializationData->HwGetPowerState != NULL) &&
1026 (HwInitializationData->HwGetVideoChildDescriptor != NULL))
1027 {
1028 INFO_(VIDEOPRT, "The miniport is a PnP miniport driver\n");
1029 PnpDriver = TRUE;
1030 }
1031
1032 /* Check if legacy detection should be applied */
1033 if (!PnpDriver || HwContext)
1034 {
1035 INFO_(VIDEOPRT, "Legacy detection for adapter interface %d\n",
1036 HwInitializationData->AdapterInterfaceType);
1037
1038 /* Enable legacy detection, will be invoked below */
1039 LegacyDetection = TRUE;
1040 }
1041
1042 /*
1043 * NOTE: The driver extension can be already allocated in case we were
1044 * called by legacy driver and failed detecting device. Some miniport
1045 * drivers in that case adjust parameters and call VideoPortInitialize
1046 * again.
1047 */
1049 if (DriverExtension == NULL)
1050 {
1055 if (!NT_SUCCESS(Status))
1056 {
1057 ERR_(VIDEOPRT, "IoAllocateDriverObjectExtension failed 0x%x\n", Status);
1058 return Status;
1059 }
1060
1061 /*
1062 * Save the registry path. This should be done only once even if
1063 * VideoPortInitialize is called multiple times.
1064 */
1065 if (RegistryPath->Length != 0)
1066 {
1067 DriverExtension->RegistryPath.Length = 0;
1068 DriverExtension->RegistryPath.MaximumLength =
1069 RegistryPath->Length + sizeof(UNICODE_NULL);
1070 DriverExtension->RegistryPath.Buffer =
1072 PagedPool,
1073 DriverExtension->RegistryPath.MaximumLength,
1074 'RTSU');
1075 if (DriverExtension->RegistryPath.Buffer == NULL)
1076 {
1077 RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL);
1079 }
1080
1082
1083 /* There is a bug in Spice guest agent, which searches 'System' case-sensitively.
1084 * Replace 'SYSTEM' by 'System' to fix that.
1085 * Probably for similar reason, Windows also replaces 'MACHINE' by 'Machine'.
1086 */
1087 wcsncpy(wcsstr(DriverExtension->RegistryPath.Buffer, L"\\SYSTEM\\"), L"\\System\\", ARRAYSIZE(L"\\SYSTEM\\") - 1);
1088 wcsncpy(wcsstr(DriverExtension->RegistryPath.Buffer, L"\\MACHINE\\"), L"\\Machine\\", ARRAYSIZE(L"\\MACHINE\\") - 1);
1089
1090 INFO_(VIDEOPRT, "RegistryPath: %wZ\n", &DriverExtension->RegistryPath);
1091 }
1092 else
1093 {
1094 RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL);
1095 }
1096 }
1097
1098 /* Copy the correct miniport initialization data to the device extension */
1099 RtlCopyMemory(&DriverExtension->InitializationData,
1101 HwInitializationData->HwInitDataSize);
1102 if (HwInitializationData->HwInitDataSize < sizeof(VIDEO_HW_INITIALIZATION_DATA))
1103 {
1104 RtlZeroMemory((PVOID)((ULONG_PTR)&DriverExtension->InitializationData +
1105 HwInitializationData->HwInitDataSize),
1107 HwInitializationData->HwInitDataSize);
1108 }
1109 DriverExtension->HwContext = HwContext;
1110
1111 /*
1112 * Plug & Play drivers register the device in the AddDevice routine.
1113 * For legacy drivers we must do it now.
1114 */
1115 if (LegacyDetection)
1116 {
1117 /* Power management */
1120
1122 if (!NT_SUCCESS(Status))
1123 ERR_(VIDEOPRT, "IntVideoPortFindAdapter(Legacy) returned 0x%x\n", Status);
1124 return Status;
1125 }
1126
1127 DriverObject->DriverExtension->AddDevice = IntVideoPortAddDevice;
1131 return STATUS_SUCCESS;
1132}
1133
1134/*
1135 * @implemented
1136 */
1137VOID
1138__cdecl
1140 _In_ VIDEO_DEBUG_LEVEL DebugPrintLevel,
1141 _In_ PSTR DebugMessage,
1142 _In_ ...)
1143{
1144 va_list ap;
1145
1146 if (VideoDebugLevel >= DebugPrintLevel)
1147 DebugPrintLevel = Error;
1148
1149 va_start(ap, DebugMessage);
1150 vDbgPrintEx(DPFLTR_VIDEO_ID, DebugPrintLevel, DebugMessage, ap);
1151 va_end(ap);
1152}
1153
1154/*
1155 * @unimplemented
1156 */
1157VOID
1158NTAPI
1160 IN PVOID HwDeviceExtension,
1163 IN ULONG UniqueId)
1164{
1166
1167 INFO_(VIDEOPRT, "VideoPortLogError ErrorCode %d (0x%x) UniqueId %lu (0x%lx)\n",
1168 ErrorCode, ErrorCode, UniqueId, UniqueId);
1169 if (Vrp)
1170 INFO_(VIDEOPRT, "Vrp->IoControlCode %lu (0x%lx)\n", Vrp->IoControlCode, Vrp->IoControlCode);
1171}
1172
1173/*
1174 * @implemented
1175 */
1176UCHAR
1177NTAPI
1179{
1180 return KeGetCurrentIrql();
1181}
1182
1184{
1189
1190static
1192NTAPI
1200{
1202
1203 INFO_(VIDEOPRT, "Found registry value for name %S: type %d, length %d\n",
1205 return (*(CallbackContext->HwGetRegistryRoutine))(
1206 CallbackContext->HwDeviceExtension,
1207 CallbackContext->HwContext,
1208 ValueName,
1209 ValueData,
1210 ValueLength);
1211}
1212
1213/*
1214 * @unimplemented
1215 */
1216
1218NTAPI
1220 IN PVOID HwDeviceExtension,
1222 IN UCHAR IsParameterFileName,
1223 IN PMINIPORT_GET_REGISTRY_ROUTINE GetRegistryRoutine,
1225{
1228 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1230
1231 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1232
1233 TRACE_(VIDEOPRT, "VideoPortGetRegistryParameters ParameterName %S, RegPath: %wZ\n",
1234 ParameterName, &DeviceExtension->RegistryPath);
1235
1236 Context.HwDeviceExtension = HwDeviceExtension;
1237 Context.HwContext = HwContext;
1238 Context.HwGetRegistryRoutine = GetRegistryRoutine;
1239
1243
1245 DeviceExtension->RegistryPath.Buffer,
1246 QueryTable,
1247 &Context,
1248 NULL);
1249 if (!NT_SUCCESS(Status))
1250 {
1251 WARN_(VIDEOPRT, "VideoPortGetRegistryParameters could not find the "
1252 "requested parameter\n");
1254 }
1255
1256 if (IsParameterFileName)
1257 {
1258 /* FIXME: need to read the contents of the file */
1260 }
1261
1262 return NO_ERROR;
1263}
1264
1265/*
1266 * @implemented
1267 */
1269NTAPI
1271 IN PVOID HwDeviceExtension,
1275{
1276 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1278
1279 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1280 TRACE_(VIDEOPRT, "VideoPortSetRegistryParameters ParameterName %S, RegPath: %wZ\n",
1281 ValueName,
1282 &DeviceExtension->RegistryPath);
1285 DeviceExtension->RegistryPath.Buffer,
1286 ValueName,
1287 REG_BINARY,
1288 ValueData,
1289 ValueLength);
1290 if (Status != NO_ERROR)
1291 WARN_(VIDEOPRT, "VideoPortSetRegistryParameters error 0x%x\n", Status);
1292
1293 return Status;
1294}
1295
1296/*
1297 * @implemented
1298 */
1300NTAPI
1302 IN PVOID HwDeviceExtension,
1303 OUT PULONG VgaStatus)
1304{
1305 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1306
1307 TRACE_(VIDEOPRT, "VideoPortGetVgaStatus\n");
1308
1309 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1311 {
1312 if (DeviceExtension->AdapterInterfaceType == PCIBus)
1313 {
1314 /* VgaStatus: 0 == VGA not enabled, 1 == VGA enabled */
1315 /* Assumed for now */
1316 *VgaStatus = 1;
1317 return NO_ERROR;
1318 }
1319 }
1320
1322}
1323
1324/*
1325 * @implemented
1326 */
1327PVOID
1328NTAPI
1330 IN PVOID HwDeviceExtension,
1331 IN PVOID Unused1,
1332 IN ULONG Unused2,
1333 IN ULONG Length)
1334{
1335 static PVOID RomImageBuffer = NULL;
1336 PKPROCESS CallingProcess;
1338
1339 TRACE_(VIDEOPRT, "VideoPortGetRomImage(HwDeviceExtension 0x%X Length 0x%X)\n",
1340 HwDeviceExtension, Length);
1341
1342 /* If the length is zero then free the existing buffer */
1343 if (Length == 0)
1344 {
1345 if (RomImageBuffer != NULL)
1346 {
1347 ExFreePool(RomImageBuffer);
1348 RomImageBuffer = NULL;
1349 }
1350 return NULL;
1351 }
1352 else
1353 {
1354 /*
1355 * The DDK says we shouldn't use the legacy C0000 method but get the
1356 * ROM base address from the corresponding PCI or ACPI register but
1357 * lets ignore that and use C0000 anyway. We have already mapped the
1358 * BIOS area into memory so we'll copy from there.
1359 */
1360
1361 /* Copy the BIOS */
1362 Length = min(Length, 0x10000);
1363 if (RomImageBuffer != NULL)
1364 ExFreePool(RomImageBuffer);
1365
1366 RomImageBuffer = ExAllocatePool(PagedPool, Length);
1367 if (RomImageBuffer == NULL)
1368 return NULL;
1369
1370 /* Perform the copy in the CSRSS context */
1371 if (IntAttachToCSRSS(&CallingProcess, &ApcState))
1372 {
1373 RtlCopyMemory(RomImageBuffer, (PUCHAR)0xC0000, Length);
1374 IntDetachFromCSRSS(CallingProcess, &ApcState);
1375 }
1376 else
1377 {
1378 ExFreePool(RomImageBuffer);
1379 RomImageBuffer = NULL;
1380 }
1381 return RomImageBuffer;
1382 }
1383}
1384
1385/*
1386 * @implemented
1387 */
1388BOOLEAN
1389NTAPI
1391 IN PVOID HwDeviceExtension,
1392 IN PUCHAR RomBase,
1393 IN ULONG RomLength,
1395{
1396 SIZE_T StringLength;
1397 BOOLEAN Found;
1398 PUCHAR SearchLocation;
1399
1400 TRACE_(VIDEOPRT, "VideoPortScanRom RomBase %p RomLength 0x%x String %s\n", RomBase, RomLength, String);
1401
1402 StringLength = strlen((PCHAR)String);
1403 Found = FALSE;
1404 for (SearchLocation = RomBase;
1405 !Found && SearchLocation < RomBase + RomLength - StringLength;
1406 SearchLocation++)
1407 {
1408 Found = (RtlCompareMemory(SearchLocation, String, StringLength) == StringLength);
1409 if (Found)
1410 {
1411 INFO_(VIDEOPRT, "Match found at %p\n", SearchLocation);
1412 }
1413 }
1414
1415 return Found;
1416}
1417
1418/*
1419 * @implemented
1420 */
1421BOOLEAN
1422NTAPI
1424 IN PVOID HwDeviceExtension,
1428{
1429 BOOLEAN Ret;
1430 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1431 KIRQL OldIrql;
1432
1433 switch (Priority)
1434 {
1435 case VpLowPriority:
1436 Ret = (*SynchronizeRoutine)(Context);
1437 break;
1438
1439 case VpMediumPriority:
1440 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1441 if (DeviceExtension->InterruptObject == NULL)
1442 Ret = (*SynchronizeRoutine)(Context);
1443 else
1445 DeviceExtension->InterruptObject,
1447 Context);
1448 break;
1449
1450 case VpHighPriority:
1452 if (OldIrql < SYNCH_LEVEL)
1454
1455 Ret = (*SynchronizeRoutine)(Context);
1456
1457 if (OldIrql < SYNCH_LEVEL)
1459 break;
1460
1461 default:
1462 Ret = FALSE;
1463 }
1464
1465 return Ret;
1466}
1467
1468/*
1469 * @implemented
1470 */
1474 IN PIRP Irp)
1475{
1476 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1477 ULONG Status;
1478 VIDEO_CHILD_ENUM_INFO ChildEnumInfo;
1479 BOOLEAN bHaveLastMonitorID = FALSE;
1480 UCHAR LastMonitorID[10];
1481 ULONG Uid, Unused;
1482 UINT i;
1483 PDEVICE_OBJECT ChildDeviceObject;
1484 PVIDEO_PORT_CHILD_EXTENSION ChildExtension;
1485
1486 INFO_(VIDEOPRT, "Starting child device probe\n");
1487 DeviceExtension = DeviceObject->DeviceExtension;
1489 {
1490 WARN_(VIDEOPRT, "Miniport's HwGetVideoChildDescriptor is NULL!\n");
1491 return STATUS_SUCCESS;
1492 }
1493
1494 if (!IsListEmpty(&DeviceExtension->ChildDeviceList))
1495 {
1496 ERR_(VIDEOPRT, "FIXME: Support calling VideoPortEnumerateChildren again!\n");
1497 return STATUS_SUCCESS;
1498 }
1499
1500 /* Enumerate the children */
1501 for (i = 1; ; i++)
1502 {
1503 Status = IoCreateDevice(DeviceExtension->DriverObject,
1506 NULL,
1509 FALSE,
1510 &ChildDeviceObject);
1511 if (!NT_SUCCESS(Status))
1512 return Status;
1513
1514 ChildExtension = ChildDeviceObject->DeviceExtension;
1515
1516 RtlZeroMemory(ChildExtension,
1519
1520 ChildExtension->Common.Fdo = FALSE;
1521 ChildExtension->ChildId = i;
1522 ChildExtension->PhysicalDeviceObject = ChildDeviceObject;
1523 ChildExtension->DriverObject = DeviceExtension->DriverObject;
1524
1525 /* Setup the ChildEnumInfo */
1526 ChildEnumInfo.Size = sizeof(ChildEnumInfo);
1527 ChildEnumInfo.ChildDescriptorSize = sizeof(ChildExtension->ChildDescriptor);
1528 ChildEnumInfo.ACPIHwId = 0;
1529
1531 ChildEnumInfo.ChildHwDeviceExtension = VIDEO_PORT_GET_CHILD_EXTENSION(ChildExtension);
1532 else
1533 ChildEnumInfo.ChildHwDeviceExtension = NULL;
1534
1535 ChildEnumInfo.ChildIndex = ChildExtension->ChildId;
1536
1537 INFO_(VIDEOPRT, "Probing child: %d\n", ChildEnumInfo.ChildIndex);
1539 DeviceExtension->MiniPortDeviceExtension,
1540 &ChildEnumInfo,
1541 &ChildExtension->ChildType,
1542 ChildExtension->ChildDescriptor,
1543 &Uid,
1544 &Unused);
1546 {
1547 if (ChildExtension->ChildType == Monitor)
1548 {
1549 // Check if the EDID is valid
1550 if (ChildExtension->ChildDescriptor[0] == 0x00 &&
1551 ChildExtension->ChildDescriptor[1] == 0xFF &&
1552 ChildExtension->ChildDescriptor[2] == 0xFF &&
1553 ChildExtension->ChildDescriptor[3] == 0xFF &&
1554 ChildExtension->ChildDescriptor[4] == 0xFF &&
1555 ChildExtension->ChildDescriptor[5] == 0xFF &&
1556 ChildExtension->ChildDescriptor[6] == 0xFF &&
1557 ChildExtension->ChildDescriptor[7] == 0x00)
1558 {
1559 if (bHaveLastMonitorID)
1560 {
1561 // Compare the previous monitor ID with the current one, break the loop if they are identical
1562 if (RtlCompareMemory(LastMonitorID, &ChildExtension->ChildDescriptor[8], sizeof(LastMonitorID)) == sizeof(LastMonitorID))
1563 {
1564 INFO_(VIDEOPRT, "Found identical Monitor ID two times, stopping enumeration\n");
1565 IoDeleteDevice(ChildDeviceObject);
1566 break;
1567 }
1568 }
1569
1570 // Copy 10 bytes from the EDID, which can be used to uniquely identify the monitor
1571 RtlCopyMemory(LastMonitorID, &ChildExtension->ChildDescriptor[8], sizeof(LastMonitorID));
1572 bHaveLastMonitorID = TRUE;
1573
1574 /* Mark it valid */
1575 ChildExtension->EdidValid = TRUE;
1576 }
1577 else
1578 {
1579 /* Mark it invalid */
1580 ChildExtension->EdidValid = FALSE;
1581 }
1582 }
1583 }
1585 {
1586 WARN_(VIDEOPRT, "Child device %d is invalid!\n", ChildEnumInfo.ChildIndex);
1587 IoDeleteDevice(ChildDeviceObject);
1588 continue;
1589 }
1591 {
1592 INFO_(VIDEOPRT, "End of child enumeration! (%d children enumerated)\n", i - 1);
1593 IoDeleteDevice(ChildDeviceObject);
1594 break;
1595 }
1596 else
1597 {
1598 WARN_(VIDEOPRT, "HwGetVideoChildDescriptor returned unknown status code 0x%x!\n", Status);
1599 IoDeleteDevice(ChildDeviceObject);
1600 break;
1601 }
1602
1603 if (ChildExtension->ChildType == Monitor)
1604 {
1605 UINT j;
1606 PUCHAR p = ChildExtension->ChildDescriptor;
1607 INFO_(VIDEOPRT, "Monitor device enumerated! (ChildId = 0x%x)\n", ChildExtension->ChildId);
1608 for (j = 0; j < sizeof (ChildExtension->ChildDescriptor); j += 8)
1609 {
1610 INFO_(VIDEOPRT, "%02x %02x %02x %02x %02x %02x %02x %02x\n",
1611 p[j + 0], p[j + 1], p[j + 2], p[j + 3],
1612 p[j + 4], p[j + 5], p[j + 6], p[j + 7]);
1613 }
1614 }
1615 else if (ChildExtension->ChildType == Other)
1616 {
1617 INFO_(VIDEOPRT, "\"Other\" device enumerated: DeviceId = %S\n", (PWSTR)ChildExtension->ChildDescriptor);
1618 }
1619 else
1620 {
1621 ERR_(VIDEOPRT, "HwGetVideoChildDescriptor returned unsupported type: %d\n", ChildExtension->ChildType);
1622 }
1623
1624 /* Clear the init flag */
1625 ChildDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
1626
1627 InsertTailList(&DeviceExtension->ChildDeviceList,
1628 &ChildExtension->ListEntry);
1629 }
1630
1631 return STATUS_SUCCESS;
1632}
1633
1635NTAPI
1637 IN PVOID HwDeviceExtension,
1639{
1640 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1641
1642 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1643 ASSERT(DeviceExtension);
1644
1645 if (DeviceExtension->PhysicalDeviceObject)
1646 {
1647 /* Trigger reenumeration by the PnP manager */
1649 }
1650
1651 return NO_ERROR;
1652}
1653
1654/*
1655 * @unimplemented
1656 */
1658NTAPI
1660 IN PVOID HwDeviceExtension,
1661 IN OUT PVOID *SecondaryDeviceExtension,
1662 IN ULONG Flag)
1663{
1665 PVIDEO_PORT_DEVICE_EXTENSION FirstDeviceExtension, DeviceExtension;
1667
1668 ASSERT(SecondaryDeviceExtension);
1669
1670 if (Flag != 0)
1671 {
1673 }
1674
1675 FirstDeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1676
1677 if (FirstDeviceExtension->DisplayNumber != 0)
1678 {
1679 DPRINT1("Calling VideoPortCreateSecondaryDisplay for InstanceId %lu\n",
1680 FirstDeviceExtension->DisplayNumber);
1681 }
1682
1684 FirstDeviceExtension->DriverExtension,
1685 FirstDeviceExtension->PhysicalDeviceObject,
1686 FirstDeviceExtension->AdapterNumber,
1687 FirstDeviceExtension->NumberOfSecondaryDisplays + 1,
1688 &DeviceObject);
1689 if (!NT_SUCCESS(Status))
1690 {
1691 DPRINT1("IntVideoPortCreateAdapterDeviceObject() failed with status 0x%08x\n", Status);
1692 return ERROR_DEV_NOT_EXIST;
1693 }
1694
1695 DeviceExtension = DeviceObject->DeviceExtension;
1696
1697 /* Increment secondary display count */
1698 FirstDeviceExtension->NumberOfSecondaryDisplays++;
1699
1700 *SecondaryDeviceExtension = DeviceExtension->MiniPortDeviceExtension;
1701 return NO_ERROR;
1702}
1703
1704/*
1705 * @implemented
1706 */
1707BOOLEAN
1708NTAPI
1710 IN PVOID HwDeviceExtension,
1713{
1714 return KeInsertQueueDpc(
1715 &VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension)->DpcObject,
1717 (PVOID)Context);
1718}
1719
1720/*
1721 * @implemented
1722 */
1723PVOID
1724NTAPI
1727{
1728 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1729
1730 TRACE_(VIDEOPRT, "VideoPortGetAssociatedDeviceExtension\n");
1731 DeviceExtension = ((PDEVICE_OBJECT)DeviceObject)->DeviceExtension;
1732 if (!DeviceExtension)
1733 return NULL;
1734 return DeviceExtension->MiniPortDeviceExtension;
1735}
1736
1737/*
1738 * @implemented
1739 */
1741NTAPI
1743 IN PVOID HwDeviceExtension,
1744 IN OUT PVPOSVERSIONINFO VpOsVersionInfo)
1745{
1747
1748 Version.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
1749 if (VpOsVersionInfo->Size >= sizeof(VPOSVERSIONINFO))
1750 {
1751#if 1
1753 {
1754 VpOsVersionInfo->MajorVersion = Version.dwMajorVersion;
1755 VpOsVersionInfo->MinorVersion = Version.dwMinorVersion;
1756 VpOsVersionInfo->BuildNumber = Version.dwBuildNumber;
1757 VpOsVersionInfo->ServicePackMajor = Version.wServicePackMajor;
1758 VpOsVersionInfo->ServicePackMinor = Version.wServicePackMinor;
1759 return NO_ERROR;
1760 }
1762#else
1763 VpOsVersionInfo->MajorVersion = 5;
1764 VpOsVersionInfo->MinorVersion = 0;
1765 VpOsVersionInfo->BuildNumber = 2195;
1766 VpOsVersionInfo->ServicePackMajor = 4;
1767 VpOsVersionInfo->ServicePackMinor = 0;
1768 return NO_ERROR;
1769#endif
1770 }
1771
1773}
1774
1775/*
1776 * @implemented
1777 */
1778BOOLEAN
1779NTAPI
1781 IN PVOID HwDeviceExtension,
1782 IN USHORT VendorId,
1783 IN USHORT DeviceId,
1784 IN UCHAR RevisionId,
1785 IN USHORT SubVendorId,
1786 IN USHORT SubSystemId,
1787 IN ULONG Flags)
1788{
1789 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1792 IO_STACK_LOCATION IoStack;
1793 ULONG PciFlags = 0;
1795 BOOL DevicePresent;
1796
1797 TRACE_(VIDEOPRT, "VideoPortCheckForDeviceExistence\n");
1798
1800 {
1801 WARN_(VIDEOPRT, "VideoPortCheckForDeviceExistence: Unknown flags 0x%lx\n", Flags & ~(CDE_USE_REVISION | CDE_USE_SUBSYSTEM_IDS));
1802 return FALSE;
1803 }
1804
1805 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1806
1808 PciDevicePresentInterface.Version = 1;
1810 IoStack.Parameters.QueryInterface.Version = PciDevicePresentInterface.Version;
1812 IoStack.Parameters.QueryInterface.InterfaceType =
1813 &GUID_PCI_DEVICE_PRESENT_INTERFACE;
1814 Status = IopInitiatePnpIrp(DeviceExtension->NextDeviceObject,
1816 if (!NT_SUCCESS(Status))
1817 {
1818 WARN_(VIDEOPRT, "IopInitiatePnpIrp() failed! (Status 0x%lx)\n", Status);
1819 return FALSE;
1820 }
1821
1822 if (Flags & CDE_USE_REVISION)
1823 PciFlags |= PCI_USE_REVISION;
1825 PciFlags |= PCI_USE_SUBSYSTEM_IDS;
1826
1827 DevicePresent = PciDevicePresentInterface.IsDevicePresent(
1828 VendorId, DeviceId, RevisionId,
1829 SubVendorId, SubSystemId, PciFlags);
1830
1831 PciDevicePresentInterface.InterfaceDereference(PciDevicePresentInterface.Context);
1832
1833 return DevicePresent;
1834}
1835
1836/*
1837 * @unimplemented
1838 */
1840NTAPI
1842 IN PVOID HwDeviceExtension,
1843 IN ULONG BugcheckCode,
1845 IN ULONG BugcheckDataSize)
1846{
1848 return NO_ERROR;
1849}
1850
1851/*
1852 * @implemented
1853 */
1855NTAPI
1857 IN PVOID HwDeviceExtension,
1858 OUT PLONGLONG PerformanceFrequency OPTIONAL)
1859{
1861
1862 TRACE_(VIDEOPRT, "VideoPortQueryPerformanceCounter\n");
1863 Result = KeQueryPerformanceCounter((PLARGE_INTEGER)PerformanceFrequency);
1864 return Result.QuadPart;
1865}
1866
1867/*
1868 * @implemented
1869 */
1870VOID
1871NTAPI
1873 IN PVOID HwDeviceExtension)
1874{
1875 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1876
1877 TRACE_(VIDEOPRT, "VideoPortAcquireDeviceLock\n");
1878 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1880 // ASSERT(Status == STATUS_SUCCESS);
1881}
1882
1883/*
1884 * @implemented
1885 */
1886VOID
1887NTAPI
1889 IN PVOID HwDeviceExtension)
1890{
1891 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1892
1893 TRACE_(VIDEOPRT, "VideoPortReleaseDeviceLock\n");
1894 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1895 KeReleaseMutex(&DeviceExtension->DeviceLock, FALSE);
1896 //ASSERT(Status == STATUS_SUCCESS);
1897}
1898
1899/*
1900 * @unimplemented
1901 */
1902VOID
1903NTAPI
1906 IN PVOID Data)
1907{
1909}
1910
1911/*
1912 * @implemented
1913 */
1914PVOID
1915NTAPI
1917 IN PVOID HwDeviceExtension,
1920)
1921{
1923}
1924
1925/*
1926 * @implemented
1927 */
1928BOOLEAN
1929NTAPI
1931{
1932 return VpNoVesa;
1933}
static USHORT USHORT * NewLength
static KSYNCHRONIZE_ROUTINE SynchronizeRoutine
Definition: IoInterrupt.c:30
unsigned char BOOLEAN
Definition: actypes.h:127
#define REG_SZ
Definition: layer.c:22
NTSYSAPI ULONG NTAPI vDbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ PCCH Format, _In_ va_list ap)
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
BOOL Error
Definition: chkdsk.c:66
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
#define ARRAYSIZE(a)
Definition: cat.c:25
return Found
Definition: dirsup.c:1270
_In_opt_ PWSTR _In_ PWSTR ParameterName
Definition: cdrom.h:961
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
_In_ PCHAR _In_ ULONG DeviceNumber
Definition: classpnp.h:1230
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
PVOID NTAPI MmAllocateContiguousMemory(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: contmem.c:626
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
_In_ ULONG _In_ ULONG _In_opt_ DXGKCB_MIRACAST_SEND_MESSAGE_CALLBACK _In_opt_ PVOID CallbackContext
Definition: dispmprt.h:622
_In_ PIO_STATUS_BLOCK IoStatusBlock
Definition: dispmprt.h:608
_In_ ULONG _In_ ULONG _In_opt_ DXGKCB_MIRACAST_SEND_MESSAGE_CALLBACK Callback
Definition: dispmprt.h:620
_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ ULONG _In_ ULONG Flags
Definition: dispmprt.h:245
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
NTSTATUS NTAPI RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
Definition: version.c:182
#define RTL_CONSTANT_STRING(s)
Definition: combase.c:35
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRACE_(x)
Definition: compat.h:76
#define RtlImageNtHeader
Definition: compat.h:806
#define __cdecl
Definition: corecrt.h:121
_ACRTIMP wchar_t *__cdecl wcsstr(const wchar_t *, const wchar_t *)
Definition: wcs.c:2998
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
char * va_list
Definition: vadefs.h:50
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dpc.c:725
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:712
@ DPFLTR_VIDEO_ID
Definition: dpfilter.h:55
DRIVER_INITIALIZE DriverEntry
Definition: condrv.c:21
#define L(x)
Definition: resources.c:13
#define ULONG_PTR
Definition: config.h:101
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define SYNCH_LEVEL
Definition: env_spec_w32.h:704
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
struct _DEVICE_OBJECT * PDEVICE_OBJECT
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
#define PagedPool
Definition: env_spec_w32.h:308
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
unsigned int BOOL
Definition: ntddk_ex.h:94
NTSYSAPI NTSTATUS NTAPI ZwQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
@ SystemBasicInformation
Definition: ntddk_ex.h:11
_Must_inspect_result_ _In_ PFLT_GET_OPERATION_STATUS_CALLBACK CallbackRoutine
Definition: fltkernel.h:1035
PVOID NTAPI IntVideoPortGetProcAddress(_In_ PVOID HwDeviceExtension, _In_ PUCHAR FunctionName)
Definition: funclist.c:106
Status
Definition: gdiplustypes.h:24
GLfloat GLfloat p
Definition: glext.h:8902
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
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
LARGE_INTEGER NTAPI KeQueryPerformanceCounter(IN PLARGE_INTEGER PerformanceFreq)
Definition: timer.c:138
unsigned int UINT
Definition: sysinfo.c:13
_In_ GUID _In_ PVOID ValueData
Definition: hubbusif.h:312
UNICODE_STRING KeyPath
return ZwOpenKey(Handle, KEY_READ, &Attributes)
ZwClose(Handle)
_In_ UCXUSBDEVICE _In_ UCXENDPOINT _In_ ULONG Priority
Definition: hubucx.h:414
NTSTATUS IntInitializeInt10(VOID)
Definition: int10.c:766
KMUTEX VideoPortInt10Mutex
Definition: int10.c:41
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:140
PCI_INTERFACE PciDevicePresentInterface
Definition: devhere.c:18
NTSTATUS NTAPI IoQueryDeviceDescription(_In_opt_ PINTERFACE_TYPE BusType, _In_opt_ PULONG BusNumber, _In_opt_ PCONFIGURATION_TYPE ControllerType, _In_opt_ PULONG ControllerNumber, _In_opt_ PCONFIGURATION_TYPE PeripheralType, _In_opt_ PULONG PeripheralNumber, _In_ PIO_QUERY_DEVICE_ROUTINE CalloutRoutine, _In_opt_ PVOID Context)
Reads and returns Hardware information from the appropriate hardware registry key.
Definition: iorsrce.c:1213
_In_ PIRP Irp
Definition: kse.h:79
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
#define Unused(x)
Definition: atlwin.h:28
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:115
#define min(a, b)
Definition: monoChain.cc:55
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4438
_Out_ PNDIS_HANDLE _Out_ PUINT _In_ PNDIS_STRING _In_ NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress
Definition: ndis.h:3232
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4717
#define KernelMode
Definition: asm.h:38
@ DpcObject
Definition: ketypes.h:444
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize _Pre_valid_ PVOID * BaseAddress
Definition: mmfuncs.h:408
_In_ PCWSTR _Inout_ _At_ QueryTable EntryContext
Definition: rtlfuncs.h:4230
_In_ PCWSTR _Inout_ _At_ QueryTable _Pre_unknown_ PRTL_QUERY_REGISTRY_TABLE QueryTable
Definition: rtlfuncs.h:4231
_In_ BOOLEAN _In_ USHORT Directory
Definition: rtlfuncs.h:3962
#define _Out_opt_
Definition: no_sal2.h:214
#define _Inout_
Definition: no_sal2.h:162
#define _Outptr_
Definition: no_sal2.h:262
#define _Null_
Definition: no_sal2.h:52
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define _When_(c, a)
Definition: no_sal2.h:38
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define REG_BINARY
Definition: nt_native.h:1499
@ KeyValuePartialInformation
Definition: nt_native.h:1185
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define RTL_REGISTRY_ABSOLUTE
Definition: nt_native.h:161
#define FASTCALL
Definition: nt_native.h:50
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
#define RTL_REGISTRY_DEVICEMAP
Definition: nt_native.h:165
#define RTL_QUERY_REGISTRY_REQUIRED
Definition: nt_native.h:132
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define READ_CONTROL
Definition: nt_native.h:58
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1063
#define UNICODE_NULL
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
__GNU_EXTENSION typedef __int64 * PLONGLONG
Definition: ntbasedef.h:394
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
NTSTATUS NTAPI IopInitiatePnpIrp(IN PDEVICE_OBJECT DeviceObject, IN PIO_STATUS_BLOCK IoStatusBlock, IN UCHAR MinorFunction, IN PIO_STACK_LOCATION Stack)
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1751
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:973
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:1038
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1306
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1261
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1925
NTSTATUS NTAPI IoAllocateDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress, IN ULONG DriverObjectExtensionSize, OUT PVOID *DriverObjectExtension)
Definition: driver.c:1847
VOID NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
Definition: irq.c:142
BOOLEAN NTAPI KeSynchronizeExecution(IN OUT PKINTERRUPT Interrupt, IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, IN PVOID SynchronizeContext OPTIONAL)
Definition: interrupt.c:237
VOID NTAPI KeInitializeMutex(IN PKMUTEX Mutex, IN ULONG Level)
Definition: mutex.c:67
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
Definition: mutex.c:189
#define STATUS_REVISION_MISMATCH
Definition: ntstatus.h:419
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:31
_In_ ULONG BusNumber
Definition: pciidex.h:65
short WCHAR
Definition: pedump.c:58
unsigned short USHORT
Definition: pedump.c:61
SYSTEM_BASIC_INFORMATION SystemBasicInfo
Definition: perfdata.c:30
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:1382
VOID NTAPI IoInvalidateDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE Type)
Definition: pnpmgr.c:1770
NTSTATUS NTAPI IoReportDetectedDevice(_In_ PDRIVER_OBJECT DriverObject, _In_ INTERFACE_TYPE LegacyBusType, _In_ ULONG BusNumber, _In_ ULONG SlotNumber, _In_opt_ PCM_RESOURCE_LIST ResourceList, _In_opt_ PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements, _In_ BOOLEAN ResourceAssigned, _Inout_ PDEVICE_OBJECT *DeviceObject)
Definition: pnpreport.c:148
VOID NTAPI KeStackAttachProcess(IN PKPROCESS Process, OUT PRKAPC_STATE ApcState)
Definition: procobj.c:704
VOID NTAPI KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
Definition: procobj.c:756
#define FILE_DEVICE_VIDEO
Definition: winioctl.h:80
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:49
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
@ PCIBus
Definition: restypes.h:127
enum _INTERFACE_TYPE INTERFACE_TYPE
#define REG_DWORD
Definition: sdbapi.c:615
@ Latched
Definition: miniport.h:81
@ LevelSensitive
Definition: miniport.h:80
struct _INTERFACE * PINTERFACE
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA _In_ PVOID HwContext
Definition: srb.h:907
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA * HwInitializationData
Definition: srb.h:906
#define VIDEO_ENUM_INVALID_DEVICE
Definition: video.h:141
VIDEO_DEBUG_LEVEL
Definition: video.h:587
VPAPI VP_STATUS NTAPI VideoPortVerifyAccessRanges(_In_ PVOID HwDeviceExtension, _In_opt_ ULONG NumAccessRanges, _In_reads_opt_(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRanges)
Claims or releases a range of hardware resources and checks for conflicts.
Definition: resource.c:982
LONG VP_STATUS
Definition: video.h:153
#define VIDEO_ENUM_NO_MORE_DEVICES
Definition: video.h:140
VOID(NTAPI * PVIDEO_BUGCHECK_CALLBACK)(IN PVOID HwDeviceExtension, IN ULONG BugcheckCode, IN PUCHAR Buffer, IN ULONG BufferSize)
Definition: video.h:527
VIDEO_SYNCHRONIZE_PRIORITY
Definition: video.h:534
@ VpMediumPriority
Definition: video.h:536
@ VpLowPriority
Definition: video.h:535
@ VpHighPriority
Definition: video.h:537
VOID(NTAPI * PMINIPORT_DPC_ROUTINE)(IN PVOID HwDeviceExtension, IN PVOID Context)
Definition: video.h:518
#define SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA
Definition: video.h:119
#define CDE_USE_REVISION
Definition: video.h:147
@ Monitor
Definition: video.h:270
@ Other
Definition: video.h:273
#define VIDEO_ENUM_MORE_DEVICES
Definition: video.h:139
#define SIZE_OF_WXP_VIDEO_HW_INITIALIZATION_DATA
Definition: video.h:121
struct _VIDEO_PORT_CONFIG_INFO VIDEO_PORT_CONFIG_INFO
#define CDE_USE_SUBSYSTEM_IDS
Definition: video.h:146
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
BOOLEAN(NTAPI * PMINIPORT_SYNCHRONIZE_ROUTINE)(IN PVOID Context)
Definition: video.h:523
enum _CONFIGURATION_TYPE CONFIGURATION_TYPE
#define ASSERT_IRQL_LESS_OR_EQUAL(x)
Definition: debug.h:251
#define INFO_(ch,...)
Definition: debug.h:159
#define ERR_(ch,...)
Definition: debug.h:156
#define WARN_(ch,...)
Definition: debug.h:157
wcsncpy
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define DPRINT
Definition: sndvol32.h:73
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
Definition: xml2sdb.h:103
PMINIPORT_GET_REGISTRY_ROUTINE HwGetRegistryRoutine
Definition: videoprt.c:1187
PVOID DeviceExtension
Definition: env_spec_w32.h:418
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntddk_ex.h:178
union _IO_STACK_LOCATION::@1823 Parameters
struct _IO_STACK_LOCATION::@5134::@5160 QueryInterface
Definition: ketypes.h:767
PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine
Definition: nt_native.h:109
ULONG ChildDescriptorSize
Definition: video.h:262
PVOID ChildHwDeviceExtension
Definition: video.h:265
PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor
Definition: video.h:685
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:133
VIDEO_CHILD_TYPE ChildType
Definition: videoprt.h:127
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:132
VIDEO_PORT_COMMON_EXTENSION Common
Definition: videoprt.h:124
KINTERRUPT_MODE InterruptMode
Definition: video.h:172
INTERFACE_TYPE AdapterInterfaceType
Definition: video.h:169
PVIDEO_PORT_GET_PROC_ADDRESS VideoPortGetProcAddress
Definition: video.h:193
ULONG BusInterruptVector
Definition: video.h:171
ULONGLONG SystemMemorySize
Definition: video.h:195
PWSTR DriverRegistryPath
Definition: video.h:194
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:88
PDEVICE_OBJECT NextDeviceObject
Definition: videoprt.h:90
VIDEO_PORT_DRIVER_EXTENSION * DriverExtension
Definition: videoprt.h:104
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:99
CHAR POINTER_ALIGNMENT MiniPortDeviceExtension[1]
Definition: videoprt.h:119
UNICODE_STRING RegistryPath
Definition: videoprt.h:91
LIST_ENTRY AddressMappingListHead
Definition: videoprt.h:102
VIDEO_PORT_COMMON_EXTENSION Common
Definition: videoprt.h:85
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:87
UNICODE_STRING NewRegistryPath
Definition: videoprt.h:92
PDEVICE_OBJECT FunctionalDeviceObject
Definition: videoprt.h:89
VIDEO_HW_INITIALIZATION_DATA InitializationData
Definition: videoprt.h:73
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT Context1
Definition: tdikrnl.h:1095
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT _In_ PTDI_PNP_CONTEXT Context2
Definition: tdikrnl.h:1096
uint16_t * PWSTR
Definition: typedefs.h:56
#define MAXULONG
Definition: typedefs.h:251
uint32_t * PULONG
Definition: typedefs.h:59
char * PSTR
Definition: typedefs.h:51
unsigned char UCHAR
Definition: typedefs.h:53
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
int64_t LONGLONG
Definition: typedefs.h:68
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
ULONG NumOfVgaRanges
Definition: videoprt.c:48
VOID NTAPI VpNotifyEaData(IN PDEVICE_OBJECT DeviceObject, IN PVOID Data)
Definition: videoprt.c:1904
VOID NTAPI VideoPortAcquireDeviceLock(IN PVOID HwDeviceExtension)
Definition: videoprt.c:1872
PKPROCESS CsrProcess
Definition: videoprt.c:39
ULONG NTAPI VideoPortInitialize(_In_ PVOID Context1, _In_ PVOID Context2, _In_ PVIDEO_HW_INITIALIZATION_DATA HwInitializationData, _In_opt_ PVOID HwContext)
Definition: videoprt.c:945
VOID NTAPI IntVideoPortDeferredRoutine(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: videoprt.c:158
BOOLEAN VideoPortUseNewKey
Definition: videoprt.c:41
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:1780
PVOID NTAPI VideoPortAllocateContiguousMemory(IN PVOID HwDeviceExtension, IN ULONG NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: videoprt.c:1916
VOID NTAPI VideoPortLogError(IN PVOID HwDeviceExtension, IN PVIDEO_REQUEST_PACKET Vrp OPTIONAL, IN VP_STATUS ErrorCode, IN ULONG UniqueId)
Definition: videoprt.c:1159
VOID FASTCALL IntDetachFromCSRSS(_In_ PKPROCESS CallingProcess, _In_ PKAPC_STATE ApcState)
Detach the current thread from the CSRSS process. This routine is to be invoked after a previous succ...
Definition: videoprt.c:775
VP_STATUS NTAPI VideoPortSetRegistryParameters(IN PVOID HwDeviceExtension, IN PWSTR ValueName, IN PVOID ValueData, IN ULONG ValueLength)
Definition: videoprt.c:1270
PVOID NTAPI IntVideoPortImageDirectoryEntryToData(PVOID BaseAddress, ULONG Directory)
Definition: videoprt.c:135
VOID FASTCALL IntLoadRegistryParameters(VOID)
Definition: videoprt.c:786
VP_STATUS NTAPI VideoPortRegisterBugcheckCallback(IN PVOID HwDeviceExtension, IN ULONG BugcheckCode, IN PVIDEO_BUGCHECK_CALLBACK Callback, IN ULONG BugcheckDataSize)
Definition: videoprt.c:1841
ULONG VideoDebugLevel
Definition: videoprt.c:34
BOOLEAN NTAPI VideoPortScanRom(IN PVOID HwDeviceExtension, IN PUCHAR RomBase, IN ULONG RomLength, IN PUCHAR String)
Definition: videoprt.c:1390
VP_STATUS NTAPI VideoPortGetVersion(IN PVOID HwDeviceExtension, IN OUT PVPOSVERSIONINFO VpOsVersionInfo)
Definition: videoprt.c:1742
VOID __cdecl VideoPortDebugPrint(_In_ VIDEO_DEBUG_LEVEL DebugPrintLevel, _In_ PSTR DebugMessage, _In_ ...)
Definition: videoprt.c:1139
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:1219
struct QueryRegistryCallbackContext * PQUERY_REGISTRY_CALLBACK_CONTEXT
static ULONG VideoPortMaxObjectNumber
Definition: videoprt.c:40
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:1193
static BOOLEAN IntIsVgaSaveDriver(_In_ PDRIVER_OBJECT DriverObject)
Definition: videoprt.c:53
BOOLEAN VpNoVesa
Definition: videoprt.c:37
UCHAR NTAPI VideoPortGetCurrentIrql(VOID)
Definition: videoprt.c:1178
NTSTATUS NTAPI IntVideoPortCreateAdapterDeviceObject(_In_ PDRIVER_OBJECT DriverObject, _In_ PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, _In_opt_ PDEVICE_OBJECT PhysicalDeviceObject, _In_ USHORT AdapterNumber, _In_ USHORT DisplayNumber, _Out_opt_ PDEVICE_OBJECT *DeviceObject)
Definition: videoprt.c:171
VOID NTAPI VideoPortReleaseDeviceLock(IN PVOID HwDeviceExtension)
Definition: videoprt.c:1888
static NTSTATUS IntVideoPortAddDeviceMapLink(PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: videoprt.c:71
VP_STATUS NTAPI VideoPortEnumerateChildren(IN PVOID HwDeviceExtension, IN PVOID Reserved)
Definition: videoprt.c:1636
PVIDEO_PORT_DEVICE_EXTENSION VgaDeviceExtension
Definition: videoprt.c:46
LONGLONG NTAPI VideoPortQueryPerformanceCounter(IN PVOID HwDeviceExtension, OUT PLONGLONG PerformanceFrequency OPTIONAL)
Definition: videoprt.c:1856
struct QueryRegistryCallbackContext QUERY_REGISTRY_CALLBACK_CONTEXT
BOOLEAN NTAPI VideoPortIsNoVesa(VOID)
Definition: videoprt.c:1930
BOOLEAN VpBaseVideo
Definition: videoprt.c:36
KMUTEX VgaSyncLock
Definition: videoprt.c:45
VP_STATUS NTAPI VideoPortCreateSecondaryDisplay(IN PVOID HwDeviceExtension, IN OUT PVOID *SecondaryDeviceExtension, IN ULONG Flag)
Definition: videoprt.c:1659
static NTSTATUS IntVideoPortEnumBuses(_In_ INTERFACE_TYPE AdapterInterfaceType, _Inout_ PULONG BusNumber)
Enumerates all supported buses on the system.
Definition: videoprt.c:407
static NTSTATUS NTAPI IntVideoPortEnumBusCallback(_In_ PVOID Context, _In_ PUNICODE_STRING PathName, _In_ INTERFACE_TYPE BusType, _In_ ULONG BusNumber, _In_ PKEY_VALUE_FULL_INFORMATION *BusInformation, _In_ CONFIGURATION_TYPE ControllerType, _In_ ULONG ControllerNumber, _In_ PKEY_VALUE_FULL_INFORMATION *ControllerInformation, _In_ CONFIGURATION_TYPE PeripheralType, _In_ ULONG PeripheralNumber, _In_ PKEY_VALUE_FULL_INFORMATION *PeripheralInformation)
A PIO_QUERY_DEVICE_ROUTINE callback for IoQueryDeviceDescription() to return success when an enumerat...
Definition: videoprt.c:373
KSPIN_LOCK HwResetAdaptersLock
Definition: videoprt.c:43
NTSTATUS IntVideoPortFindAdapter(_In_ PDRIVER_OBJECT DriverObject, _In_ PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, _In_ _When_(LegacyDetection, _Null_) PDEVICE_OBJECT DeviceObject, _In_ BOOLEAN LegacyDetection)
Definition: videoprt.c:433
PVOID NTAPI VideoPortGetAssociatedDeviceExtension(IN PVOID DeviceObject)
Definition: videoprt.c:1725
PVOID NTAPI VideoPortGetRomImage(IN PVOID HwDeviceExtension, IN PVOID Unused1, IN ULONG Unused2, IN ULONG Length)
Definition: videoprt.c:1329
PVIDEO_ACCESS_RANGE VgaRanges
Definition: videoprt.c:47
NTSTATUS NTAPI IntVideoPortEnumerateChildren(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: videoprt.c:1472
BOOLEAN FASTCALL IntAttachToCSRSS(_Outptr_ PKPROCESS *CallingProcess, _Out_ PKAPC_STATE ApcState)
Attach the current thread to the CSRSS process. The caller must detach from the process by invoking I...
Definition: videoprt.c:748
BOOLEAN NTAPI VideoPortQueueDpc(IN PVOID HwDeviceExtension, IN PMINIPORT_DPC_ROUTINE CallbackRoutine, IN PVOID Context)
Definition: videoprt.c:1709
VP_STATUS NTAPI VideoPortGetVgaStatus(IN PVOID HwDeviceExtension, OUT PULONG VgaStatus)
Definition: videoprt.c:1301
BOOLEAN NTAPI VideoPortSynchronizeExecution(IN PVOID HwDeviceExtension, IN VIDEO_SYNCHRONIZE_PRIORITY Priority, IN PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine, OUT PVOID Context)
Definition: videoprt.c:1423
LIST_ENTRY HwResetAdaptersList
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:146
#define TAG_VIDEO_PORT
Definition: videoprt.h:38
struct _VIDEO_PORT_DEVICE_EXTENSTION * PVIDEO_PORT_DEVICE_EXTENSION
#define VIDEO_PORT_GET_CHILD_EXTENSION(MiniportExtension)
Definition: videoprt.h:140
struct _VIDEO_PORT_DEVICE_EXTENSTION VIDEO_PORT_DEVICE_EXTENSION
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2439
_In_ WDFDEVICE _In_ PPNP_BUS_INFORMATION BusInformation
Definition: wdfdevice.h:3921
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3281
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
Definition: wdfdpc.h:112
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG _Out_opt_ PULONG _Out_opt_ PULONG ValueType
Definition: wdfregistry.h:282
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG ValueLength
Definition: wdfregistry.h:275
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:68
struct _KPROCESS * PKPROCESS
Definition: wdm.template.h:201
NTSTATUS NTAPI IntVideoPortDispatchClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:434
VOID NTAPI IntVideoPortUnload(PDRIVER_OBJECT DriverObject)
Definition: dispatch.c:1288
NTSTATUS NTAPI IntVideoPortDispatchOpen(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:369
NTSTATUS NTAPI IntVideoPortDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:766
NTSTATUS NTAPI IntVideoPortDispatchSystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:1266
NTSTATUS NTAPI IntVideoPortDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:1200
NTSTATUS NTAPI IntVideoPortAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
Definition: dispatch.c:334
NTSTATUS NTAPI IntVideoPortDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:1232
BOOLEAN NTAPI IntVideoPortSetupInterrupt(IN PDEVICE_OBJECT DeviceObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, IN PVIDEO_PORT_CONFIG_INFO ConfigInfo)
Definition: interrupt.c:45
NTSTATUS NTAPI IntCreateRegistryPath(IN PCUNICODE_STRING DriverRegistryPath, IN ULONG DeviceNumber, OUT PUNICODE_STRING DeviceRegistryPath)
Definition: registry.c:603
NTSTATUS NTAPI IntCreateNewRegistryPath(PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: registry.c:408
NTSTATUS NTAPI IntSetupDeviceSettingsKey(PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: registry.c:298
VOID IntVideoPortReleaseResources(_In_ PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: resource.c:198
BOOLEAN NTAPI IntVideoPortSetupTimer(IN PDEVICE_OBJECT DeviceObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension)
Definition: timer.c:43
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG, PCWSTR, PCWSTR, ULONG, PVOID, ULONG)
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
_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:409
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE BusType
Definition: halfuncs.h:159
@ BusRelations
Definition: iotypes.h:2154
#define IRP_MN_QUERY_INTERFACE
struct _PCI_DEVICE_PRESENT_INTERFACE PCI_DEVICE_PRESENT_INTERFACE
@ DevicePropertyAddress
Definition: iotypes.h:1211
@ DevicePropertyBusNumber
Definition: iotypes.h:1209
@ DevicePropertyLegacyBusType
Definition: iotypes.h:1208
#define IRP_MJ_SYSTEM_CONTROL
#define PCI_USE_REVISION
Definition: iotypes.h:867
#define IRP_MJ_SHUTDOWN
#define IRP_MJ_POWER
#define PCI_USE_SUBSYSTEM_IDS
Definition: iotypes.h:866
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036
#define KeWaitForMutexObject
Definition: kefuncs.h:543
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
@ Executive
Definition: ketypes.h:467
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:756
* PKAPC_STATE
Definition: ketypes.h:1727
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:755
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:757
KAPC_STATE
Definition: ketypes.h:1727
#define PsGetCurrentProcess
Definition: psfuncs.h:17
#define RTL_STATIC_LIST_HEAD(x)
Definition: rtlfuncs.h:47
struct _OSVERSIONINFOEXW RTL_OSVERSIONINFOEXW