ReactOS  0.4.15-dev-980-ge160524
videoprt.c File Reference
#include "videoprt.h"
#include <stdio.h>
#include <ndk/exfuncs.h>
#include <ndk/obfuncs.h>
#include <ndk/rtlfuncs.h>
#include <debug.h>
Include dependency graph for videoprt.c:

Go to the source code of this file.

Classes

struct  QueryRegistryCallbackContext
 

Macros

#define NDEBUG
 

Typedefs

typedef struct QueryRegistryCallbackContext QUERY_REGISTRY_CALLBACK_CONTEXT
 
typedef struct QueryRegistryCallbackContextPQUERY_REGISTRY_CALLBACK_CONTEXT
 

Functions

 RTL_STATIC_LIST_HEAD (HwResetAdaptersList)
 
ULONG NTAPI DriverEntry (IN PVOID Context1, IN PVOID Context2)
 
PVOID NTAPI IntVideoPortImageDirectoryEntryToData (PVOID BaseAddress, ULONG Directory)
 
VOID NTAPI IntVideoPortDeferredRoutine (IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
 
NTSTATUS NTAPI IntVideoPortCreateAdapterDeviceObject (_In_ PDRIVER_OBJECT DriverObject, _In_ PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, _In_opt_ PDEVICE_OBJECT PhysicalDeviceObject, _Out_opt_ PDEVICE_OBJECT *DeviceObject)
 
NTSTATUS NTAPI IntVideoPortFindAdapter (IN PDRIVER_OBJECT DriverObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, IN PDEVICE_OBJECT DeviceObject)
 
VOID FASTCALL IntAttachToCSRSS (PKPROCESS *CallingProcess, PKAPC_STATE ApcState)
 
VOID FASTCALL IntDetachFromCSRSS (PKPROCESS *CallingProcess, PKAPC_STATE ApcState)
 
VOID FASTCALL IntLoadRegistryParameters (VOID)
 
ULONG NTAPI VideoPortInitialize (IN PVOID Context1, IN PVOID Context2, IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData, IN PVOID HwContext)
 
VOID VideoPortDebugPrint (IN VIDEO_DEBUG_LEVEL DebugPrintLevel, IN PCHAR DebugMessage,...)
 
VOID NTAPI VideoPortLogError (IN PVOID HwDeviceExtension, IN PVIDEO_REQUEST_PACKET Vrp OPTIONAL, IN VP_STATUS ErrorCode, IN ULONG UniqueId)
 
UCHAR NTAPI VideoPortGetCurrentIrql (VOID)
 
static NTSTATUS NTAPI QueryRegistryCallback (IN PWSTR ValueName, IN ULONG ValueType, IN PVOID ValueData, IN ULONG ValueLength, IN PVOID Context, IN PVOID EntryContext)
 
VP_STATUS NTAPI VideoPortGetRegistryParameters (IN PVOID HwDeviceExtension, IN PWSTR ParameterName, IN UCHAR IsParameterFileName, IN PMINIPORT_GET_REGISTRY_ROUTINE GetRegistryRoutine, IN PVOID HwContext)
 
VP_STATUS NTAPI VideoPortSetRegistryParameters (IN PVOID HwDeviceExtension, IN PWSTR ValueName, IN PVOID ValueData, IN ULONG ValueLength)
 
VP_STATUS NTAPI VideoPortGetVgaStatus (IN PVOID HwDeviceExtension, OUT PULONG VgaStatus)
 
PVOID NTAPI VideoPortGetRomImage (IN PVOID HwDeviceExtension, IN PVOID Unused1, IN ULONG Unused2, IN ULONG Length)
 
BOOLEAN NTAPI VideoPortScanRom (IN PVOID HwDeviceExtension, IN PUCHAR RomBase, IN ULONG RomLength, IN PUCHAR String)
 
BOOLEAN NTAPI VideoPortSynchronizeExecution (IN PVOID HwDeviceExtension, IN VIDEO_SYNCHRONIZE_PRIORITY Priority, IN PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine, OUT PVOID Context)
 
VP_STATUS NTAPI VideoPortEnumerateChildren (IN PVOID HwDeviceExtension, IN PVOID Reserved)
 
VP_STATUS NTAPI VideoPortCreateSecondaryDisplay (IN PVOID HwDeviceExtension, IN OUT PVOID *SecondaryDeviceExtension, IN ULONG Flag)
 
BOOLEAN NTAPI VideoPortQueueDpc (IN PVOID HwDeviceExtension, IN PMINIPORT_DPC_ROUTINE CallbackRoutine, IN PVOID Context)
 
PVOID NTAPI VideoPortGetAssociatedDeviceExtension (IN PVOID DeviceObject)
 
VP_STATUS NTAPI VideoPortGetVersion (IN PVOID HwDeviceExtension, IN OUT PVPOSVERSIONINFO VpOsVersionInfo)
 
BOOLEAN NTAPI VideoPortCheckForDeviceExistence (IN PVOID HwDeviceExtension, IN USHORT VendorId, IN USHORT DeviceId, IN UCHAR RevisionId, IN USHORT SubVendorId, IN USHORT SubSystemId, IN ULONG Flags)
 
VP_STATUS NTAPI VideoPortRegisterBugcheckCallback (IN PVOID HwDeviceExtension, IN ULONG BugcheckCode, IN PVIDEO_BUGCHECK_CALLBACK Callback, IN ULONG BugcheckDataSize)
 
LONGLONG NTAPI VideoPortQueryPerformanceCounter (IN PVOID HwDeviceExtension, OUT PLONGLONG PerformanceFrequency OPTIONAL)
 
VOID NTAPI VideoPortAcquireDeviceLock (IN PVOID HwDeviceExtension)
 
VOID NTAPI VideoPortReleaseDeviceLock (IN PVOID HwDeviceExtension)
 
VOID NTAPI VpNotifyEaData (IN PDEVICE_OBJECT DeviceObject, IN PVOID Data)
 
PVOID NTAPI VideoPortAllocateContiguousMemory (IN PVOID HwDeviceExtension, IN ULONG NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
 
BOOLEAN NTAPI VideoPortIsNoVesa (VOID)
 

Variables

ULONG VideoDebugLevel = 0
 
BOOLEAN VpBaseVideo = FALSE
 
BOOLEAN VpNoVesa = FALSE
 
PKPROCESS CsrProcess = NULL
 
ULONG VideoPortDeviceNumber = 0
 
KMUTEX VideoPortInt10Mutex
 
KSPIN_LOCK HwResetAdaptersLock
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 29 of file videoprt.c.

Typedef Documentation

◆ PQUERY_REGISTRY_CALLBACK_CONTEXT

◆ QUERY_REGISTRY_CALLBACK_CONTEXT

Function Documentation

◆ DriverEntry()

ULONG NTAPI DriverEntry ( IN PVOID  Context1,
IN PVOID  Context2 
)

Definition at line 49 of file videoprt.c.

52 {
53  return STATUS_SUCCESS;
54 }
return STATUS_SUCCESS
Definition: btrfs.c:3014

◆ IntAttachToCSRSS()

VOID FASTCALL IntAttachToCSRSS ( PKPROCESS CallingProcess,
PKAPC_STATE  ApcState 
)

Definition at line 443 of file videoprt.c.

446 {
447  *CallingProcess = (PKPROCESS)PsGetCurrentProcess();
448  if (*CallingProcess != CsrProcess)
449  {
451  }
452 }
PKPROCESS CsrProcess
Definition: videoprt.c:39
VOID NTAPI KeStackAttachProcess(IN PKPROCESS Process, OUT PRKAPC_STATE ApcState)
Definition: procobj.c:701
#define PsGetCurrentProcess
Definition: psfuncs.h:17
struct _KPROCESS * PKPROCESS
Definition: wdm.template.h:199
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1492

Referenced by IntInt10AllocateBuffer(), IntInt10CallBios(), IntInt10FreeBuffer(), IntInt10ReadMemory(), IntInt10WriteMemory(), and VideoPortGetRomImage().

◆ IntDetachFromCSRSS()

VOID FASTCALL IntDetachFromCSRSS ( PKPROCESS CallingProcess,
PKAPC_STATE  ApcState 
)

Definition at line 456 of file videoprt.c.

459 {
460  if (*CallingProcess != CsrProcess)
461  {
463  }
464 }
PKPROCESS CsrProcess
Definition: videoprt.c:39
VOID NTAPI KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
Definition: procobj.c:753
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1492

Referenced by IntInt10AllocateBuffer(), IntInt10CallBios(), IntInt10FreeBuffer(), IntInt10ReadMemory(), IntInt10WriteMemory(), and VideoPortGetRomImage().

◆ IntLoadRegistryParameters()

VOID FASTCALL IntLoadRegistryParameters ( VOID  )

Definition at line 468 of file videoprt.c.

469 {
472  UNICODE_STRING Path = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control");
473  UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"SystemStartOptions");
477 
478  /* Initialize object attributes with the path we want */
480  &Path,
482  NULL,
483  NULL);
484 
485  /* Open the key */
486  Status = ZwOpenKey(&KeyHandle,
489  if (!NT_SUCCESS(Status))
490  {
491  VideoPortDebugPrint(Error, "ZwOpenKey failed (0x%x)\n", Status);
492  return;
493  }
494 
495  /* Find out how large our buffer should be */
496  Status = ZwQueryValueKey(KeyHandle,
497  &ValueName,
499  NULL,
500  0,
501  &Length);
503  {
504  VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status);
506  return;
507  }
508 
509  /* Allocate it */
511  if (!KeyInfo)
512  {
513  VideoPortDebugPrint(Error, "Out of memory\n");
515  return;
516  }
517 
518  /* Now for real this time */
519  Status = ZwQueryValueKey(KeyHandle,
520  &ValueName,
522  KeyInfo,
523  Length,
524  &NewLength);
526 
527  if (!NT_SUCCESS(Status))
528  {
529  VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status);
531  return;
532  }
533 
534  /* Sanity check */
535  if (KeyInfo->Type != REG_SZ)
536  {
537  VideoPortDebugPrint(Error, "Invalid type for SystemStartOptions\n");
539  return;
540  }
541 
542  /* Check if BASEVIDEO or NOVESA is present in the start options */
543  if (wcsstr((PWCHAR)KeyInfo->Data, L"BASEVIDEO"))
544  VpBaseVideo = TRUE;
545  if (wcsstr((PWCHAR)KeyInfo->Data, L"NOVESA"))
546  VpNoVesa = TRUE;
547 
549 
550  /* FIXME: Old ReactOS-compatibility... */
551  if (VpBaseVideo) VpNoVesa = TRUE;
552 
553  if (VpNoVesa)
554  VideoPortDebugPrint(Info, "VESA mode disabled\n");
555  else
556  VideoPortDebugPrint(Info, "VESA mode enabled\n");
557 
558  /* If we are in BASEVIDEO, create the volatile registry key for Win32k */
559  if (VpBaseVideo)
560  {
561  RtlInitUnicodeString(&Path, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\GraphicsDrivers\\BaseVideo");
562 
564  &Path,
566  NULL,
567  NULL);
568 
569  Status = ZwCreateKey(&KeyHandle,
570  KEY_WRITE,
572  0,
573  NULL,
575  NULL);
576  if (NT_SUCCESS(Status))
578  else
579  ERR_(VIDEOPRT, "Failed to create the BaseVideo key (0x%x)\n", Status);
580  }
581 
582  return;
583 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define TAG_VIDEO_PORT
Definition: videoprt.h:38
BOOLEAN VpBaseVideo
Definition: videoprt.c:36
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define TRUE
Definition: types.h:120
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define ERR_(ch,...)
Definition: debug.h:156
LONG NTSTATUS
Definition: precomp.h:26
uint16_t * PWCHAR
Definition: typedefs.h:56
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
struct TraceInfo Info
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
static USHORT USHORT * NewLength
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WRITE
Definition: nt_native.h:1031
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
BOOL Error
Definition: chkdsk.c:66
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
BOOLEAN VpNoVesa
Definition: videoprt.c:37
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3376
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
VOID VideoPortDebugPrint(IN VIDEO_DEBUG_LEVEL DebugPrintLevel, IN PCHAR DebugMessage,...)
Definition: videoprt.c:794
PRTL_UNICODE_STRING_BUFFER Path
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define REG_SZ
Definition: layer.c:22

Referenced by VideoPortInitialize().

◆ IntVideoPortCreateAdapterDeviceObject()

NTSTATUS NTAPI IntVideoPortCreateAdapterDeviceObject ( _In_ PDRIVER_OBJECT  DriverObject,
_In_ PVIDEO_PORT_DRIVER_EXTENSION  DriverExtension,
_In_opt_ PDEVICE_OBJECT  PhysicalDeviceObject,
_Out_opt_ PDEVICE_OBJECT DeviceObject 
)

Definition at line 94 of file videoprt.c.

99 {
100  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
102  ULONG PciSlotNumber;
104  ULONG Size;
106  WCHAR DeviceBuffer[20];
108  PDEVICE_OBJECT DeviceObject_;
109 
110  if (DeviceObject == NULL)
111  DeviceObject = &DeviceObject_;
112 
113  /*
114  * Find the first free device number that can be used for video device
115  * object names and symlinks.
116  */
118  if (DeviceNumber == 0xFFFFFFFF)
119  {
120  WARN_(VIDEOPRT, "Can't find free device number\n");
121  return STATUS_UNSUCCESSFUL;
122  }
123 
124  /*
125  * Create the device object.
126  */
127 
128  /* Create a unicode device name. */
129  swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
130  RtlInitUnicodeString(&DeviceName, DeviceBuffer);
131 
132  INFO_(VIDEOPRT, "HwDeviceExtension size is: 0x%x\n",
133  DriverExtension->InitializationData.HwDeviceExtensionSize);
134 
135  /* Create the device object. */
137  DriverExtension->InitializationData.HwDeviceExtensionSize;
139  Size,
140  &DeviceName,
142  0,
143  TRUE,
144  DeviceObject);
145 
146  if (!NT_SUCCESS(Status))
147  {
148  WARN_(VIDEOPRT, "IoCreateDevice call failed with status 0x%08x\n", Status);
149  return Status;
150  }
151 
152  /*
153  * Set the buffering strategy here. If you change this, remember
154  * to change VidDispatchDeviceControl too.
155  */
156 
157  (*DeviceObject)->Flags |= DO_BUFFERED_IO;
158 
159  /* Initialize device extension. */
160  DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)((*DeviceObject)->DeviceExtension);
161  DeviceExtension->Common.Fdo = TRUE;
162  DeviceExtension->DeviceNumber = DeviceNumber;
163  DeviceExtension->DriverObject = DriverObject;
164  DeviceExtension->PhysicalDeviceObject = PhysicalDeviceObject;
165  DeviceExtension->FunctionalDeviceObject = *DeviceObject;
166  DeviceExtension->DriverExtension = DriverExtension;
167  DeviceExtension->SessionId = -1;
168 
169  InitializeListHead(&DeviceExtension->ChildDeviceList);
170 
171  /* Get the registry path associated with this device. */
173  &DeviceExtension->RegistryPath);
174  if (!NT_SUCCESS(Status))
175  {
176  WARN_(VIDEOPRT, "IntCreateRegistryPath() call failed with status 0x%08x\n", Status);
178  *DeviceObject = NULL;
179  return Status;
180  }
181 
182  if (PhysicalDeviceObject != NULL)
183  {
184  /* Get bus number from the upper level bus driver. */
185  Size = sizeof(ULONG);
188  Size,
189  &DeviceExtension->SystemIoBusNumber,
190  &Size);
191  if (!NT_SUCCESS(Status))
192  {
193  WARN_(VIDEOPRT, "Couldn't get an information from bus driver. We will try to\n"
194  "use legacy detection method, but even that doesn't mean that\n"
195  "it will work.\n");
196  DeviceExtension->PhysicalDeviceObject = NULL;
197  }
198  }
199 
200  DeviceExtension->AdapterInterfaceType =
201  DriverExtension->InitializationData.AdapterInterfaceType;
202 
203  if (PhysicalDeviceObject != NULL)
204  {
205  /* Get bus type from the upper level bus driver. */
206  Size = sizeof(ULONG);
209  Size,
210  &DeviceExtension->AdapterInterfaceType,
211  &Size);
212 
213  /* Get bus device address from the upper level bus driver. */
214  Size = sizeof(ULONG);
217  Size,
218  &PciSlotNumber,
219  &Size);
220 
221  /* Convert slotnumber to PCI_SLOT_NUMBER */
222  SlotNumber.u.AsULONG = 0;
223  SlotNumber.u.bits.DeviceNumber = (PciSlotNumber >> 16) & 0xFFFF;
224  SlotNumber.u.bits.FunctionNumber = PciSlotNumber & 0xFFFF;
225  DeviceExtension->SystemIoSlotNumber = SlotNumber.u.AsULONG;
226  }
227 
228  InitializeListHead(&DeviceExtension->AddressMappingListHead);
229  InitializeListHead(&DeviceExtension->DmaAdapterList);
230 
231  KeInitializeDpc(&DeviceExtension->DpcObject,
233  DeviceExtension);
234 
235  KeInitializeMutex(&DeviceExtension->DeviceLock, 0);
236 
237  /* Attach the device. */
238  if (PhysicalDeviceObject != NULL)
240  *DeviceObject,
242 
243  IntCreateNewRegistryPath(DeviceExtension);
244  IntSetupDeviceSettingsKey(DeviceExtension);
245 
246  /* Remove the initailizing flag */
247  (*DeviceObject)->Flags &= ~DO_DEVICE_INITIALIZING;
248  return STATUS_SUCCESS;
249 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
PDEVICE_OBJECT FunctionalDeviceObject
Definition: videoprt.h:88
NTSTATUS NTAPI IntCreateNewRegistryPath(PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: registry.c:357
VOID NTAPI IntVideoPortDeferredRoutine(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: videoprt.c:81
#define INFO_(ch,...)
Definition: debug.h:159
VIDEO_PORT_DRIVER_EXTENSION * DriverExtension
Definition: videoprt.h:103
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
struct _VIDEO_PORT_DEVICE_EXTENSTION * PVIDEO_PORT_DEVICE_EXTENSION
LIST_ENTRY AddressMappingListHead
Definition: videoprt.h:101
NTSTATUS NTAPI IntSetupDeviceSettingsKey(PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: registry.c:296
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1155
WCHAR DeviceName[]
Definition: adapter.cpp:21
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:87
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:2088
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FILE_DEVICE_VIDEO
Definition: winioctl.h:140
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
NTSTATUS NTAPI IntCreateRegistryPath(IN PCUNICODE_STRING DriverRegistryPath, OUT PUNICODE_STRING DeviceRegistryPath)
Definition: registry.c:532
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG _In_ ULONG SlotNumber
Definition: halfuncs.h:156
VOID NTAPI KeInitializeMutex(IN PKMUTEX Mutex, IN ULONG Level)
Definition: mutex.c:67
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
PDEVICE_OBJECT NextDeviceObject
Definition: videoprt.h:89
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:86
struct _VIDEO_PORT_DEVICE_EXTENSTION VIDEO_PORT_DEVICE_EXTENSION
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
ULONG VideoPortDeviceNumber
Definition: videoprt.c:40
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
VIDEO_PORT_COMMON_EXTENSION Common
Definition: videoprt.h:84
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
UNICODE_STRING RegistryPath
Definition: videoprt.h:90
_In_ PCHAR _In_ ULONG DeviceNumber
Definition: classpnp.h:1229
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:711
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:98
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define WARN_(ch,...)
Definition: debug.h:157

Referenced by IntVideoPortAddDevice(), and VideoPortInitialize().

◆ IntVideoPortDeferredRoutine()

VOID NTAPI IntVideoPortDeferredRoutine ( IN PKDPC  Dpc,
IN PVOID  DeferredContext,
IN PVOID  SystemArgument1,
IN PVOID  SystemArgument2 
)

Definition at line 81 of file videoprt.c.

86 {
87  PVOID HwDeviceExtension =
88  &((PVIDEO_PORT_DEVICE_EXTENSION)DeferredContext)->MiniPortDeviceExtension;
90 }
struct _VIDEO_PORT_DEVICE_EXTENSTION * PVIDEO_PORT_DEVICE_EXTENSION
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:675
VOID(NTAPI * PMINIPORT_DPC_ROUTINE)(IN PVOID HwDeviceExtension, IN PVOID Context)
Definition: video.h:518
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:675

Referenced by IntVideoPortCreateAdapterDeviceObject().

◆ IntVideoPortFindAdapter()

NTSTATUS NTAPI IntVideoPortFindAdapter ( IN PDRIVER_OBJECT  DriverObject,
IN PVIDEO_PORT_DRIVER_EXTENSION  DriverExtension,
IN PDEVICE_OBJECT  DeviceObject 
)

Definition at line 254 of file videoprt.c.

258 {
259  WCHAR DeviceVideoBuffer[20];
260  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
262  VIDEO_PORT_CONFIG_INFO ConfigInfo;
264  UCHAR Again = FALSE;
265  WCHAR DeviceBuffer[20];
267  WCHAR SymlinkBuffer[20];
268  UNICODE_STRING SymlinkName;
269  BOOL LegacyDetection = FALSE;
271 
273  DeviceNumber = DeviceExtension->DeviceNumber;
274 
275  /* Setup a ConfigInfo structure that we will pass to HwFindAdapter. */
276  RtlZeroMemory(&ConfigInfo, sizeof(VIDEO_PORT_CONFIG_INFO));
277  ConfigInfo.Length = sizeof(VIDEO_PORT_CONFIG_INFO);
278  ConfigInfo.AdapterInterfaceType = DeviceExtension->AdapterInterfaceType;
279  if (ConfigInfo.AdapterInterfaceType == PCIBus)
280  ConfigInfo.InterruptMode = LevelSensitive;
281  else
282  ConfigInfo.InterruptMode = Latched;
283  ConfigInfo.DriverRegistryPath = DriverExtension->RegistryPath.Buffer;
285  ConfigInfo.SystemIoBusNumber = DeviceExtension->SystemIoBusNumber;
286  ConfigInfo.BusInterruptLevel = DeviceExtension->InterruptLevel;
287  ConfigInfo.BusInterruptVector = DeviceExtension->InterruptVector;
288 
291  sizeof(SystemBasicInfo),
292  NULL);
293  if (NT_SUCCESS(Status))
294  {
297  }
298 
299  // FIXME: Check the adapter key and update VideoDebugLevel variable.
300 
301  /*
302  * Call miniport HwVidFindAdapter entry point to detect if
303  * particular device is present. There are two possible code
304  * paths. The first one is for Legacy drivers (NT4) and cases
305  * when we don't have information about what bus we're on. The
306  * second case is the standard one for Plug & Play drivers.
307  */
308  if (DeviceExtension->PhysicalDeviceObject == NULL)
309  {
310  LegacyDetection = TRUE;
311  }
312 
313  if (LegacyDetection)
314  {
315  ULONG BusNumber, MaxBuses;
316 
317  MaxBuses = DeviceExtension->AdapterInterfaceType == PCIBus ? PCI_MAX_BRIDGE_NUMBER : 1;
318 
319  for (BusNumber = 0; BusNumber < MaxBuses; BusNumber++)
320  {
321  DeviceExtension->SystemIoBusNumber =
322  ConfigInfo.SystemIoBusNumber = BusNumber;
323 
324  RtlZeroMemory(&DeviceExtension->MiniPortDeviceExtension,
325  DriverExtension->InitializationData.HwDeviceExtensionSize);
326 
327  /* FIXME: Need to figure out what string to pass as param 3. */
328  Status = DriverExtension->InitializationData.HwFindAdapter(
329  &DeviceExtension->MiniPortDeviceExtension,
330  DriverExtension->HwContext,
331  NULL,
332  &ConfigInfo,
333  &Again);
334 
336  {
337  continue;
338  }
339  else if (Status == NO_ERROR)
340  {
341  break;
342  }
343  else
344  {
345  ERR_(VIDEOPRT, "HwFindAdapter call failed with error 0x%X\n", Status);
346  goto Failure;
347  }
348  }
349  }
350  else
351  {
352  /* FIXME: Need to figure out what string to pass as param 3. */
353  Status = DriverExtension->InitializationData.HwFindAdapter(
354  &DeviceExtension->MiniPortDeviceExtension,
355  DriverExtension->HwContext,
356  NULL,
357  &ConfigInfo,
358  &Again);
359  }
360 
361  if (Status != NO_ERROR)
362  {
363  ERR_(VIDEOPRT, "HwFindAdapter call failed with error 0x%X\n", Status);
364  goto Failure;
365  }
366 
367  /*
368  * Now we know the device is present, so let's do all additional tasks
369  * such as creating symlinks or setting up interrupts and timer.
370  */
371 
372  /* Create a unicode device name. */
373  swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
374  RtlInitUnicodeString(&DeviceName, DeviceBuffer);
375 
376  /* Create symbolic link "\??\DISPLAYx" */
377  swprintf(SymlinkBuffer, L"\\??\\DISPLAY%lu", DeviceNumber + 1);
378  RtlInitUnicodeString(&SymlinkName, SymlinkBuffer);
379  IoCreateSymbolicLink(&SymlinkName, &DeviceName);
380 
381  /* Add entry to DEVICEMAP\VIDEO key in registry. */
382  swprintf(DeviceVideoBuffer, L"\\Device\\Video%d", DeviceNumber);
385  L"VIDEO",
386  DeviceVideoBuffer,
387  REG_SZ,
388  DeviceExtension->RegistryPath.Buffer,
389  DeviceExtension->RegistryPath.Length + sizeof(UNICODE_NULL));
390 
393  L"VIDEO",
394  L"MaxObjectNumber",
395  REG_DWORD,
396  &DeviceNumber,
397  sizeof(DeviceNumber));
398 
399  /* FIXME: Allocate hardware resources for device. */
400 
401  /* Allocate interrupt for device. */
403  {
405  goto Failure;
406  }
407 
408  /* Allocate timer for device. */
410  {
411  if (DeviceExtension->InterruptObject != NULL)
412  IoDisconnectInterrupt(DeviceExtension->InterruptObject);
413  ERR_(VIDEOPRT, "IntVideoPortSetupTimer failed\n");
415  goto Failure;
416  }
417 
418  /* If the device can be reset, insert it in the list of resettable adapters */
419  InitializeListHead(&DeviceExtension->HwResetListEntry);
420  if (DriverExtension->InitializationData.HwResetHw != NULL)
421  {
423  &DeviceExtension->HwResetListEntry,
425  }
426 
427  /* Query children of the device. */
429 
430  INFO_(VIDEOPRT, "STATUS_SUCCESS\n");
431  return STATUS_SUCCESS;
432 
433 Failure:
434  RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
435  if (DeviceExtension->NextDeviceObject)
436  IoDetachDevice(DeviceExtension->NextDeviceObject);
438  return Status;
439 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define PCI_MAX_BRIDGE_NUMBER
Definition: iotypes.h:3251
#define INFO_(ch,...)
Definition: debug.h:159
#define TRUE
Definition: types.h:120
BOOLEAN NTAPI IntVideoPortSetupTimer(IN PDEVICE_OBJECT DeviceObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension)
Definition: timer.c:43
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:140
#define ERR_(ch,...)
Definition: debug.h:156
LONG NTSTATUS
Definition: precomp.h:26
struct _VIDEO_PORT_DEVICE_EXTENSTION * PVIDEO_PORT_DEVICE_EXTENSION
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
WCHAR DeviceName[]
Definition: adapter.cpp:21
#define NO_ERROR
Definition: dderror.h:5
INTERFACE_TYPE AdapterInterfaceType
Definition: video.h:169
PVOID NTAPI IntVideoPortGetProcAddress(IN PVOID HwDeviceExtension, IN PUCHAR FunctionName)
Definition: funclist.c:100
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG, PCWSTR, PCWSTR, ULONG, PVOID, ULONG)
unsigned int BOOL
Definition: ntddk_ex.h:94
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:87
VP_STATUS NTAPI VideoPortEnumerateChildren(IN PVOID HwDeviceExtension, IN PVOID Reserved)
Definition: videoprt.c:1125
NTSYSAPI NTSTATUS NTAPI ZwQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
PVIDEO_PORT_GET_PROC_ADDRESS VideoPortGetProcAddress
Definition: video.h:193
VOID NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
Definition: irq.c:140
KSPIN_LOCK HwResetAdaptersLock
Definition: videoprt.c:42
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
ULONGLONG SystemMemorySize
Definition: video.h:195
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
SYSTEM_BASIC_INFORMATION SystemBasicInfo
Definition: perfdata.c:45
#define swprintf(buf, format,...)
Definition: sprintf.c:56
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
struct _VIDEO_PORT_CONFIG_INFO VIDEO_PORT_CONFIG_INFO
unsigned char UCHAR
Definition: xmlstorage.h:181
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
PWSTR DriverRegistryPath
Definition: video.h:194
PDEVICE_OBJECT NextDeviceObject
Definition: videoprt.h:89
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
BOOLEAN NTAPI IntVideoPortSetupInterrupt(IN PDEVICE_OBJECT DeviceObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, IN PVIDEO_PORT_CONFIG_INFO ConfigInfo)
Definition: interrupt.c:45
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
LIST_ENTRY HwResetAdaptersList
UNICODE_STRING RegistryPath
Definition: videoprt.h:90
_In_ PCHAR _In_ ULONG DeviceNumber
Definition: classpnp.h:1229
#define RTL_REGISTRY_DEVICEMAP
Definition: nt_native.h:165
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:98
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define REG_DWORD
Definition: sdbapi.c:596
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
ULONG BusInterruptVector
Definition: video.h:171
KINTERRUPT_MODE InterruptMode
Definition: video.h:172
#define REG_SZ
Definition: layer.c:22

Referenced by IntVideoPortPnPStartDevice(), and VideoPortInitialize().

◆ IntVideoPortImageDirectoryEntryToData()

PVOID NTAPI IntVideoPortImageDirectoryEntryToData ( PVOID  BaseAddress,
ULONG  Directory 
)

Definition at line 58 of file videoprt.c.

61 {
62  PIMAGE_NT_HEADERS NtHeader;
63  ULONG Va;
64 
65  NtHeader = RtlImageNtHeader(BaseAddress);
66  if (NtHeader == NULL)
67  return NULL;
68 
70  return NULL;
71 
73  if (Va == 0)
74  return NULL;
75 
76  return (PVOID)((ULONG_PTR)BaseAddress + Va);
77 }
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntddk_ex.h:178
smooth NULL
Definition: ftsmooth.c:416
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
#define RtlImageNtHeader
Definition: compat.h:554
unsigned int ULONG
Definition: retypes.h:1
base for all directory entries
Definition: entries.h:138
#define ULONG_PTR
Definition: config.h:101
_In_ BOOLEAN _In_ USHORT Directory
Definition: rtlfuncs.h:3872

◆ QueryRegistryCallback()

static NTSTATUS NTAPI QueryRegistryCallback ( IN PWSTR  ValueName,
IN ULONG  ValueType,
IN PVOID  ValueData,
IN ULONG  ValueLength,
IN PVOID  Context,
IN PVOID  EntryContext 
)
static

Definition at line 848 of file videoprt.c.

855 {
857 
858  INFO_(VIDEOPRT, "Found registry value for name %S: type %d, length %d\n",
860  return (*(CallbackContext->HwGetRegistryRoutine))(
861  CallbackContext->HwDeviceExtension,
862  CallbackContext->HwContext,
863  ValueName,
864  ValueData,
865  ValueLength);
866 }
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR _In_ ULONGLONG _In_ ULONGLONG _In_opt_ PEVENT_FILTER_DESCRIPTOR _Inout_opt_ PVOID CallbackContext
Definition: wmitypes.h:55
#define INFO_(ch,...)
Definition: debug.h:159
_In_ PCWSTR _In_z_ PCWSTR _In_ ULONG ValueType
Definition: rtlfuncs.h:4154
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
struct QueryRegistryCallbackContext * PQUERY_REGISTRY_CALLBACK_CONTEXT
_In_ GUID _In_ PVOID ValueData
Definition: hubbusif.h:311
_In_ GUID _In_ PVOID _In_ ULONG ValueLength
Definition: hubbusif.h:311

Referenced by VideoPortGetRegistryParameters().

◆ RTL_STATIC_LIST_HEAD()

RTL_STATIC_LIST_HEAD ( HwResetAdaptersList  )

◆ VideoPortAcquireDeviceLock()

VOID NTAPI VideoPortAcquireDeviceLock ( IN PVOID  HwDeviceExtension)

Definition at line 1476 of file videoprt.c.

1478 {
1479  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1480  NTSTATUS Status;
1481 
1483 
1484  TRACE_(VIDEOPRT, "VideoPortAcquireDeviceLock\n");
1485  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1486  Status = KeWaitForMutexObject(&DeviceExtension->DeviceLock, Executive,
1487  KernelMode, FALSE, NULL);
1488  // ASSERT(Status == STATUS_SUCCESS);
1489 }
#define KeWaitForMutexObject
Definition: kefuncs.h:555
LONG NTSTATUS
Definition: precomp.h:26
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:137
#define UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:324
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define TRACE_(x)
Definition: compat.h:76
Status
Definition: gdiplustypes.h:24

◆ VideoPortAllocateContiguousMemory()

PVOID NTAPI VideoPortAllocateContiguousMemory ( IN PVOID  HwDeviceExtension,
IN ULONG  NumberOfBytes,
IN PHYSICAL_ADDRESS  HighestAcceptableAddress 
)

Definition at line 1527 of file videoprt.c.

1532 {
1534 }
_Out_ PNDIS_HANDLE _Out_ PUINT _In_ PNDIS_STRING _In_ NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress
Definition: ndis.h:3227
PVOID NTAPI MmAllocateContiguousMemory(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: contmem.c:626
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1002

◆ VideoPortCheckForDeviceExistence()

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 at line 1384 of file videoprt.c.

1392 {
1393  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1396  IO_STACK_LOCATION IoStack;
1397  ULONG PciFlags = 0;
1398  NTSTATUS Status;
1399  BOOL DevicePresent;
1400 
1401  TRACE_(VIDEOPRT, "VideoPortCheckForDeviceExistence\n");
1402 
1404  {
1405  WARN_(VIDEOPRT, "VideoPortCheckForDeviceExistence: Unknown flags 0x%lx\n", Flags & ~(CDE_USE_REVISION | CDE_USE_SUBSYSTEM_IDS));
1406  return FALSE;
1407  }
1408 
1409  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1410 
1412  PciDevicePresentInterface.Version = 1;
1414  IoStack.Parameters.QueryInterface.Version = PciDevicePresentInterface.Version;
1416  IoStack.Parameters.QueryInterface.InterfaceType =
1417  &GUID_PCI_DEVICE_PRESENT_INTERFACE;
1418  Status = IopInitiatePnpIrp(DeviceExtension->NextDeviceObject,
1420  if (!NT_SUCCESS(Status))
1421  {
1422  WARN_(VIDEOPRT, "IopInitiatePnpIrp() failed! (Status 0x%lx)\n", Status);
1423  return FALSE;
1424  }
1425 
1426  if (Flags & CDE_USE_REVISION)
1427  PciFlags |= PCI_USE_REVISION;
1429  PciFlags |= PCI_USE_SUBSYSTEM_IDS;
1430 
1431  DevicePresent = PciDevicePresentInterface.IsDevicePresent(
1432  VendorId, DeviceId, RevisionId,
1433  SubVendorId, SubSystemId, PciFlags);
1434 
1435  PciDevicePresentInterface.InterfaceDereference(PciDevicePresentInterface.Context);
1436 
1437  return DevicePresent;
1438 }
LONG NTSTATUS
Definition: precomp.h:26
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:137
struct _PCI_DEVICE_PRESENT_INTERFACE PCI_DEVICE_PRESENT_INTERFACE
#define PCI_USE_REVISION
Definition: iotypes.h:839
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define FALSE
Definition: types.h:117
#define CDE_USE_REVISION
Definition: video.h:147
unsigned int BOOL
Definition: ntddk_ex.h:94
struct _INTERFACE * PINTERFACE
#define TRACE_(x)
Definition: compat.h:76
#define CDE_USE_SUBSYSTEM_IDS
Definition: video.h:146
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IRP_MN_QUERY_INTERFACE
Status
Definition: gdiplustypes.h:24
PDEVICE_OBJECT NextDeviceObject
Definition: videoprt.h:89
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
unsigned int ULONG
Definition: retypes.h:1
PCI_INTERFACE PciDevicePresentInterface
Definition: devhere.c:18
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2779
NTSTATUS NTAPI IopInitiatePnpIrp(IN PDEVICE_OBJECT DeviceObject, IN PIO_STATUS_BLOCK IoStatusBlock, IN UCHAR MinorFunction, IN PIO_STACK_LOCATION Stack)
#define WARN_(ch,...)
Definition: debug.h:157
#define PCI_USE_SUBSYSTEM_IDS
Definition: iotypes.h:838

◆ VideoPortCreateSecondaryDisplay()

VP_STATUS NTAPI VideoPortCreateSecondaryDisplay ( IN PVOID  HwDeviceExtension,
IN OUT PVOID SecondaryDeviceExtension,
IN ULONG  Flag 
)

Definition at line 1299 of file videoprt.c.

1303 {
1304  UNIMPLEMENTED;
1305  return ERROR_DEV_NOT_EXIST;
1306 }
#define UNIMPLEMENTED
Definition: debug.h:115
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8

◆ VideoPortDebugPrint()

VOID VideoPortDebugPrint ( IN VIDEO_DEBUG_LEVEL  DebugPrintLevel,
IN PCHAR  DebugMessage,
  ... 
)

Definition at line 794 of file videoprt.c.

798 {
799  va_list ap;
800 
801  if (VideoDebugLevel >= DebugPrintLevel)
802  DebugPrintLevel = Error;
803 
804  va_start(ap, DebugMessage);
805  vDbgPrintEx(DPFLTR_IHVVIDEO_ID, DebugPrintLevel, DebugMessage, ap);
806  va_end(ap);
807 }
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
ULONG VideoDebugLevel
Definition: videoprt.c:34
BOOL Error
Definition: chkdsk.c:66
NTSYSAPI ULONG NTAPI vDbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ PCCH Format, _In_ va_list ap)
#define va_start(ap, A)
Definition: acmsvcex.h:91
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32

Referenced by IntLoadRegistryParameters().

◆ VideoPortEnumerateChildren()

VP_STATUS NTAPI VideoPortEnumerateChildren ( IN PVOID  HwDeviceExtension,
IN PVOID  Reserved 
)

Definition at line 1125 of file videoprt.c.

1128 {
1129  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1130  ULONG Status;
1131  VIDEO_CHILD_ENUM_INFO ChildEnumInfo;
1132  BOOLEAN bHaveLastMonitorID = FALSE;
1133  UCHAR LastMonitorID[10];
1134  ULONG Unused;
1135  UINT i;
1136  PDEVICE_OBJECT ChildDeviceObject;
1137  PVIDEO_PORT_CHILD_EXTENSION ChildExtension;
1138 
1139  INFO_(VIDEOPRT, "Starting child device probe\n");
1140  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1142  {
1143  WARN_(VIDEOPRT, "Miniport's HwGetVideoChildDescriptor is NULL!\n");
1144  return NO_ERROR;
1145  }
1146 
1147  if (!IsListEmpty(&DeviceExtension->ChildDeviceList))
1148  {
1149  ERR_(VIDEOPRT, "FIXME: Support calling VideoPortEnumerateChildren again!\n");
1150  return NO_ERROR;
1151  }
1152 
1153  /* Enumerate the children */
1154  for (i = 1; ; i++)
1155  {
1156  Status = IoCreateDevice(DeviceExtension->DriverObject,
1157  sizeof(VIDEO_PORT_CHILD_EXTENSION) +
1159  NULL,
1162  FALSE,
1163  &ChildDeviceObject);
1164  if (!NT_SUCCESS(Status))
1165  return Status;
1166 
1167  ChildExtension = ChildDeviceObject->DeviceExtension;
1168 
1169  RtlZeroMemory(ChildExtension,
1170  sizeof(VIDEO_PORT_CHILD_EXTENSION) +
1172 
1173  ChildExtension->Common.Fdo = FALSE;
1174  ChildExtension->ChildId = i;
1175  ChildExtension->PhysicalDeviceObject = ChildDeviceObject;
1176  ChildExtension->DriverObject = DeviceExtension->DriverObject;
1177 
1178  /* Setup the ChildEnumInfo */
1179  ChildEnumInfo.Size = sizeof(ChildEnumInfo);
1180  ChildEnumInfo.ChildDescriptorSize = sizeof(ChildExtension->ChildDescriptor);
1181  ChildEnumInfo.ACPIHwId = 0;
1182 
1184  ChildEnumInfo.ChildHwDeviceExtension = VIDEO_PORT_GET_CHILD_EXTENSION(ChildExtension);
1185  else
1186  ChildEnumInfo.ChildHwDeviceExtension = NULL;
1187 
1188  ChildEnumInfo.ChildIndex = ChildExtension->ChildId;
1189 
1190  INFO_(VIDEOPRT, "Probing child: %d\n", ChildEnumInfo.ChildIndex);
1192  HwDeviceExtension,
1193  &ChildEnumInfo,
1194  &ChildExtension->ChildType,
1195  ChildExtension->ChildDescriptor,
1196  &ChildExtension->ChildId,
1197  &Unused);
1199  {
1200  if (ChildExtension->ChildType == Monitor)
1201  {
1202  // Check if the EDID is valid
1203  if (ChildExtension->ChildDescriptor[0] == 0x00 &&
1204  ChildExtension->ChildDescriptor[1] == 0xFF &&
1205  ChildExtension->ChildDescriptor[2] == 0xFF &&
1206  ChildExtension->ChildDescriptor[3] == 0xFF &&
1207  ChildExtension->ChildDescriptor[4] == 0xFF &&
1208  ChildExtension->ChildDescriptor[5] == 0xFF &&
1209  ChildExtension->ChildDescriptor[6] == 0xFF &&
1210  ChildExtension->ChildDescriptor[7] == 0x00)
1211  {
1212  if (bHaveLastMonitorID)
1213  {
1214  // Compare the previous monitor ID with the current one, break the loop if they are identical
1215  if (RtlCompareMemory(LastMonitorID, &ChildExtension->ChildDescriptor[8], sizeof(LastMonitorID)) == sizeof(LastMonitorID))
1216  {
1217  INFO_(VIDEOPRT, "Found identical Monitor ID two times, stopping enumeration\n");
1218  IoDeleteDevice(ChildDeviceObject);
1219  break;
1220  }
1221  }
1222 
1223  // Copy 10 bytes from the EDID, which can be used to uniquely identify the monitor
1224  RtlCopyMemory(LastMonitorID, &ChildExtension->ChildDescriptor[8], sizeof(LastMonitorID));
1225  bHaveLastMonitorID = TRUE;
1226 
1227  /* Mark it valid */
1228  ChildExtension->EdidValid = TRUE;
1229  }
1230  else
1231  {
1232  /* Mark it invalid */
1233  ChildExtension->EdidValid = FALSE;
1234  // FIXME: the following break workarounds CORE-16695
1235  // but prevents graphic cards to return an invalid
1236  // EDID as first child, and a valid one as second child.
1237  break;
1238  }
1239  }
1240  }
1241  else if (Status == VIDEO_ENUM_INVALID_DEVICE)
1242  {
1243  WARN_(VIDEOPRT, "Child device %d is invalid!\n", ChildEnumInfo.ChildIndex);
1244  IoDeleteDevice(ChildDeviceObject);
1245  continue;
1246  }
1247  else if (Status == VIDEO_ENUM_NO_MORE_DEVICES)
1248  {
1249  INFO_(VIDEOPRT, "End of child enumeration! (%d children enumerated)\n", i - 1);
1250  IoDeleteDevice(ChildDeviceObject);
1251  break;
1252  }
1253  else
1254  {
1255  WARN_(VIDEOPRT, "HwGetVideoChildDescriptor returned unknown status code 0x%x!\n", Status);
1256  IoDeleteDevice(ChildDeviceObject);
1257  break;
1258  }
1259 
1260  if (ChildExtension->ChildType == Monitor)
1261  {
1262  UINT j;
1263  PUCHAR p = ChildExtension->ChildDescriptor;
1264  INFO_(VIDEOPRT, "Monitor device enumerated! (ChildId = 0x%x)\n", ChildExtension->ChildId);
1265  for (j = 0; j < sizeof (ChildExtension->ChildDescriptor); j += 8)
1266  {
1267  INFO_(VIDEOPRT, "%02x %02x %02x %02x %02x %02x %02x %02x\n",
1268  p[j + 0], p[j + 1], p[j + 2], p[j + 3],
1269  p[j + 4], p[j + 5], p[j + 6], p[j + 7]);
1270  }
1271  }
1272  else if (ChildExtension->ChildType == Other)
1273  {
1274  INFO_(VIDEOPRT, "\"Other\" device enumerated: DeviceId = %S\n", (PWSTR)ChildExtension->ChildDescriptor);
1275  }
1276  else
1277  {
1278  ERR_(VIDEOPRT, "HwGetVideoChildDescriptor returned unsupported type: %d\n", ChildExtension->ChildType);
1279  }
1280 
1281  /* Clear the init flag */
1282  ChildDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
1283 
1284  InsertTailList(&DeviceExtension->ChildDeviceList,
1285  &ChildExtension->ListEntry);
1286  }
1287 
1288  /* Trigger reenumeration by the PnP manager */
1290 
1291  return NO_ERROR;
1292 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
_Must_inspect_result_ typedef _In_ PVOID Unused
Definition: iotypes.h:1133
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
VIDEO_CHILD_TYPE ChildType
Definition: videoprt.h:118
#define INFO_(ch,...)
Definition: debug.h:159
PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor
Definition: video.h:677
VIDEO_PORT_DRIVER_EXTENSION * DriverExtension
Definition: videoprt.h:103
#define TRUE
Definition: types.h:120
uint16_t * PWSTR
Definition: typedefs.h:56
VIDEO_HW_INITIALIZATION_DATA InitializationData
Definition: videoprt.h:72
unsigned char * PUCHAR
Definition: retypes.h:3
#define ERR_(ch,...)
Definition: debug.h:156
ULONG ChildDescriptorSize
Definition: video.h:262
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:137
#define InsertTailList(ListHead, Entry)
#define NO_ERROR
Definition: dderror.h:5
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
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
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:109
#define FALSE
Definition: types.h:117
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:87
#define VIDEO_PORT_GET_CHILD_EXTENSION(MiniportExtension)
Definition: videoprt.h:131
VIDEO_PORT_COMMON_EXTENSION Common
Definition: videoprt.h:115
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define VIDEO_ENUM_MORE_DEVICES
Definition: video.h:139
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:123
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
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Definition: video.h:273
unsigned char UCHAR
Definition: xmlstorage.h:181
Status
Definition: gdiplustypes.h:24
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:86
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
VOID NTAPI IoInvalidateDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE Type)
Definition: pnpmgr.c:2478
Definition: video.h:270
unsigned int UINT
Definition: ndis.h:50
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:124
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PVOID ChildHwDeviceExtension
Definition: video.h:265
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
GLfloat GLfloat p
Definition: glext.h:8902
#define VIDEO_ENUM_NO_MORE_DEVICES
Definition: video.h:140
#define WARN_(ch,...)
Definition: debug.h:157
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
#define VIDEO_ENUM_INVALID_DEVICE
Definition: video.h:141

Referenced by IntVideoPortFindAdapter(), and VBEInitialize().

◆ VideoPortGetAssociatedDeviceExtension()

PVOID NTAPI VideoPortGetAssociatedDeviceExtension ( IN PVOID  DeviceObject)

Definition at line 1329 of file videoprt.c.

1331 {
1332  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1333 
1334  TRACE_(VIDEOPRT, "VideoPortGetAssociatedDeviceExtension\n");
1335  DeviceExtension = ((PDEVICE_OBJECT)DeviceObject)->DeviceExtension;
1336  if (!DeviceExtension)
1337  return NULL;
1338  return DeviceExtension->MiniPortDeviceExtension;
1339 }
struct _DEVICE_OBJECT * PDEVICE_OBJECT
smooth NULL
Definition: ftsmooth.c:416
#define TRACE_(x)
Definition: compat.h:76
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569

◆ VideoPortGetCurrentIrql()

UCHAR NTAPI VideoPortGetCurrentIrql ( VOID  )

Definition at line 833 of file videoprt.c.

834 {
835  return KeGetCurrentIrql();
836 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706

◆ VideoPortGetRegistryParameters()

VP_STATUS NTAPI VideoPortGetRegistryParameters ( IN PVOID  HwDeviceExtension,
IN PWSTR  ParameterName,
IN UCHAR  IsParameterFileName,
IN PMINIPORT_GET_REGISTRY_ROUTINE  GetRegistryRoutine,
IN PVOID  HwContext 
)

Definition at line 874 of file videoprt.c.

880 {
883  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
885 
886  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
887 
888  TRACE_(VIDEOPRT, "VideoPortGetRegistryParameters ParameterName %S, RegPath: %wZ\n",
889  ParameterName, &DeviceExtension->RegistryPath);
890 
891  Context.HwDeviceExtension = HwDeviceExtension;
892  Context.HwContext = HwContext;
893  Context.HwGetRegistryRoutine = GetRegistryRoutine;
894 
898 
900  DeviceExtension->RegistryPath.Buffer,
901  QueryTable,
902  &Context,
903  NULL);
904  if (!NT_SUCCESS(Status))
905  {
906  WARN_(VIDEOPRT, "VideoPortGetRegistryParameters could not find the "
907  "requested parameter\n");
909  }
910 
911  if (IsParameterFileName)
912  {
913  /* FIXME: need to read the contents of the file */
915  }
916 
917  return NO_ERROR;
918 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
_In_ PCWSTR _Inout_ _At_ QueryTable _Pre_unknown_ PRTL_QUERY_REGISTRY_TABLE QueryTable
Definition: rtlfuncs.h:4142
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA _In_ PVOID HwContext
Definition: srb.h:897
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:137
#define NO_ERROR
Definition: dderror.h:5
PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine
Definition: nt_native.h:109
smooth NULL
Definition: ftsmooth.c:416
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:848
#define TRACE_(x)
Definition: compat.h:76
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define RTL_REGISTRY_ABSOLUTE
Definition: nt_native.h:161
_In_opt_ PWSTR _In_ PWSTR ParameterName
Definition: classpnp.h:1402
struct tagContext Context
Definition: acpixf.h:1034
#define UNIMPLEMENTED
Definition: debug.h:115
UNICODE_STRING RegistryPath
Definition: videoprt.h:90
#define RTL_QUERY_REGISTRY_REQUIRED
Definition: nt_native.h:132
#define WARN_(ch,...)
Definition: debug.h:157

◆ VideoPortGetRomImage()

PVOID NTAPI VideoPortGetRomImage ( IN PVOID  HwDeviceExtension,
IN PVOID  Unused1,
IN ULONG  Unused2,
IN ULONG  Length 
)

Definition at line 984 of file videoprt.c.

989 {
990  static PVOID RomImageBuffer = NULL;
991  PKPROCESS CallingProcess;
993 
994  TRACE_(VIDEOPRT, "VideoPortGetRomImage(HwDeviceExtension 0x%X Length 0x%X)\n",
995  HwDeviceExtension, Length);
996 
997  /* If the length is zero then free the existing buffer. */
998  if (Length == 0)
999  {
1000  if (RomImageBuffer != NULL)
1001  {
1002  ExFreePool(RomImageBuffer);
1003  RomImageBuffer = NULL;
1004  }
1005  return NULL;
1006  }
1007  else
1008  {
1009  /*
1010  * The DDK says we shouldn't use the legacy C0000 method but get the
1011  * rom base address from the corresponding pci or acpi register but
1012  * lets ignore that and use C0000 anyway. We have already mapped the
1013  * bios area into memory so we'll copy from there.
1014  */
1015 
1016  /* Copy the bios. */
1017  Length = min(Length, 0x10000);
1018  if (RomImageBuffer != NULL)
1019  {
1020  ExFreePool(RomImageBuffer);
1021  }
1022 
1023  RomImageBuffer = ExAllocatePool(PagedPool, Length);
1024  if (RomImageBuffer == NULL)
1025  {
1026  return NULL;
1027  }
1028 
1029  IntAttachToCSRSS(&CallingProcess, &ApcState);
1030  RtlCopyMemory(RomImageBuffer, (PUCHAR)0xC0000, Length);
1031  IntDetachFromCSRSS(&CallingProcess, &ApcState);
1032 
1033  return RomImageBuffer;
1034  }
1035 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
KAPC_STATE
Definition: ketypes.h:1273
unsigned char * PUCHAR
Definition: retypes.h:3
smooth NULL
Definition: ftsmooth.c:416
#define TRACE_(x)
Definition: compat.h:76
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
VOID FASTCALL IntAttachToCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState)
Definition: videoprt.c:443
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1492
#define min(a, b)
Definition: monoChain.cc:55
VOID FASTCALL IntDetachFromCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState)
Definition: videoprt.c:456
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

◆ VideoPortGetVersion()

VP_STATUS NTAPI VideoPortGetVersion ( IN PVOID  HwDeviceExtension,
IN OUT PVPOSVERSIONINFO  VpOsVersionInfo 
)

Definition at line 1346 of file videoprt.c.

1349 {
1351 
1352  Version.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
1353  if (VpOsVersionInfo->Size >= sizeof(VPOSVERSIONINFO))
1354  {
1355 #if 1
1357  {
1358  VpOsVersionInfo->MajorVersion = Version.dwMajorVersion;
1359  VpOsVersionInfo->MinorVersion = Version.dwMinorVersion;
1360  VpOsVersionInfo->BuildNumber = Version.dwBuildNumber;
1361  VpOsVersionInfo->ServicePackMajor = Version.wServicePackMajor;
1362  VpOsVersionInfo->ServicePackMinor = Version.wServicePackMinor;
1363  return NO_ERROR;
1364  }
1365  return ERROR_INVALID_PARAMETER;
1366 #else
1367  VpOsVersionInfo->MajorVersion = 5;
1368  VpOsVersionInfo->MinorVersion = 0;
1369  VpOsVersionInfo->BuildNumber = 2195;
1370  VpOsVersionInfo->ServicePackMajor = 4;
1371  VpOsVersionInfo->ServicePackMinor = 0;
1372  return NO_ERROR;
1373 #endif
1374  }
1375 
1376  return ERROR_INVALID_PARAMETER;
1377 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:361
NTSTATUS NTAPI RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
Definition: version.c:158
#define NO_ERROR
Definition: dderror.h:5
struct _OSVERSIONINFOEXW RTL_OSVERSIONINFOEXW
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32

◆ VideoPortGetVgaStatus()

VP_STATUS NTAPI VideoPortGetVgaStatus ( IN PVOID  HwDeviceExtension,
OUT PULONG  VgaStatus 
)

Definition at line 956 of file videoprt.c.

959 {
960  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
961 
962  TRACE_(VIDEOPRT, "VideoPortGetVgaStatus\n");
963 
964  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
966  {
967  if (DeviceExtension->AdapterInterfaceType == PCIBus)
968  {
969  /* VgaStatus: 0 == VGA not enabled, 1 == VGA enabled. */
970  /* Assumed for now */
971  *VgaStatus = 1;
972  return NO_ERROR;
973  }
974  }
975 
976  return ERROR_INVALID_FUNCTION;
977 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:137
#define NO_ERROR
Definition: dderror.h:5
#define TRACE_(x)
Definition: compat.h:76
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:98

◆ VideoPortInitialize()

ULONG NTAPI VideoPortInitialize ( IN PVOID  Context1,
IN PVOID  Context2,
IN PVIDEO_HW_INITIALIZATION_DATA  HwInitializationData,
IN PVOID  HwContext 
)

Definition at line 592 of file videoprt.c.

597 {
602  BOOLEAN PnpDriver = FALSE, LegacyDetection = FALSE;
603  static BOOLEAN FirstInitialization;
604 
605  TRACE_(VIDEOPRT, "VideoPortInitialize\n");
606 
607  if (!FirstInitialization)
608  {
609  FirstInitialization = TRUE;
613  }
614 
615  /* As a first thing do parameter checks. */
616  if (HwInitializationData->HwInitDataSize > sizeof(VIDEO_HW_INITIALIZATION_DATA))
617  {
618  ERR_(VIDEOPRT, "Invalid HwInitializationData\n");
620  }
621 
622  if ((HwInitializationData->HwFindAdapter == NULL) ||
623  (HwInitializationData->HwInitialize == NULL) ||
624  (HwInitializationData->HwStartIO == NULL))
625  {
626  ERR_(VIDEOPRT, "Invalid HwInitializationData\n");
628  }
629 
630  switch (HwInitializationData->HwInitDataSize)
631  {
632  /*
633  * NT4 drivers are special case, because we must use legacy method
634  * of detection instead of the Plug & Play one.
635  */
637  INFO_(VIDEOPRT, "We were loaded by a Windows NT miniport driver.\n");
638  break;
639 
641  INFO_(VIDEOPRT, "We were loaded by a Windows 2000 miniport driver.\n");
642  break;
643 
644  case sizeof(VIDEO_HW_INITIALIZATION_DATA):
645  INFO_(VIDEOPRT, "We were loaded by a Windows XP or later miniport driver.\n");
646  break;
647 
648  default:
649  ERR_(VIDEOPRT, "Invalid HwInitializationData size.\n");
650  return STATUS_UNSUCCESSFUL;
651  }
652 
653  /* Set dispatching routines */
661 
662  /* Determine type of the miniport driver */
663  if ((HwInitializationData->HwInitDataSize >=
664  FIELD_OFFSET(VIDEO_HW_INITIALIZATION_DATA, HwQueryInterface)) &&
665  (HwInitializationData->HwSetPowerState != NULL) &&
666  (HwInitializationData->HwGetPowerState != NULL) &&
667  (HwInitializationData->HwGetVideoChildDescriptor != NULL))
668  {
669  INFO_(VIDEOPRT, "The miniport is a PnP miniport driver\n");
670  PnpDriver = TRUE;
671  }
672 
673  /* Check if legacy detection should be applied */
674  if (!PnpDriver || HwContext)
675  {
676  INFO_(VIDEOPRT, "Legacy detection for adapter interface %d\n",
677  HwInitializationData->AdapterInterfaceType);
678 
679  /* FIXME: Move the code for legacy detection
680  to another function and call it here */
681  LegacyDetection = TRUE;
682  }
683 
684  /*
685  * NOTE:
686  * The driver extension can be already allocated in case that we were
687  * called by legacy driver and failed detecting device. Some miniport
688  * drivers in that case adjust parameters and call VideoPortInitialize
689  * again.
690  */
692  if (DriverExtension == NULL)
693  {
695  DriverObject,
697  (PVOID *)&DriverExtension);
698  if (!NT_SUCCESS(Status))
699  {
700  ERR_(VIDEOPRT, "IoAllocateDriverObjectExtension failed 0x%x\n", Status);
701  return Status;
702  }
703 
704  /*
705  * Save the registry path. This should be done only once even if
706  * VideoPortInitialize is called multiple times.
707  */
708  if (RegistryPath->Length != 0)
709  {
710  DriverExtension->RegistryPath.Length = 0;
711  DriverExtension->RegistryPath.MaximumLength =
712  RegistryPath->Length + sizeof(UNICODE_NULL);
713  DriverExtension->RegistryPath.Buffer =
715  PagedPool,
716  DriverExtension->RegistryPath.MaximumLength,
717  'RTSU');
718  if (DriverExtension->RegistryPath.Buffer == NULL)
719  {
720  RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL);
722  }
723 
725  INFO_(VIDEOPRT, "RegistryPath: %wZ\n", &DriverExtension->RegistryPath);
726  }
727  else
728  {
729  RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL);
730  }
731  }
732 
733  /* Copy the correct miniport initialization data to the device extension. */
734  RtlCopyMemory(&DriverExtension->InitializationData,
736  HwInitializationData->HwInitDataSize);
737  if (HwInitializationData->HwInitDataSize <
739  {
740  RtlZeroMemory((PVOID)((ULONG_PTR)&DriverExtension->InitializationData +
741  HwInitializationData->HwInitDataSize),
743  HwInitializationData->HwInitDataSize);
744  }
745  DriverExtension->HwContext = HwContext;
746 
747  /*
748  * Plug & Play drivers registers the device in AddDevice routine.
749  * For legacy drivers we must do it now.
750  */
751  if (LegacyDetection)
752  {
754 
756  {
757  /* Power management */
759  }
760 
763  NULL,
764  &DeviceObject);
765  if (!NT_SUCCESS(Status))
766  {
767  ERR_(VIDEOPRT, "IntVideoPortCreateAdapterDeviceObject returned 0x%x\n", Status);
768  return Status;
769  }
770 
772  if (NT_SUCCESS(Status))
774  else
775  ERR_(VIDEOPRT, "IntVideoPortFindAdapter returned 0x%x\n", Status);
776 
777  return Status;
778  }
779  else
780  {
785 
786  return STATUS_SUCCESS;
787  }
788 }
VOID FASTCALL IntLoadRegistryParameters(VOID)
Definition: videoprt.c:468
NTSTATUS NTAPI IntVideoPortFindAdapter(IN PDRIVER_OBJECT DriverObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, IN PDEVICE_OBJECT DeviceObject)
Definition: videoprt.c:254
#define STATUS_REVISION_MISMATCH
Definition: ntstatus.h:325
NTSTATUS NTAPI IntVideoPortDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:1115
NTSTATUS NTAPI IntVideoPortCreateAdapterDeviceObject(_In_ PDRIVER_OBJECT DriverObject, _In_ PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, _In_opt_ PDEVICE_OBJECT PhysicalDeviceObject, _Out_opt_ PDEVICE_OBJECT *DeviceObject)
Definition: videoprt.c:94
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define INFO_(ch,...)
Definition: debug.h:159
NTSTATUS NTAPI IoAllocateDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress, IN ULONG DriverObjectExtensionSize, OUT PVOID *DriverObjectExtension)
Definition: driver.c:1791
#define IRP_MJ_SHUTDOWN
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define ERR_(ch,...)
Definition: debug.h:156
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA _In_ PVOID HwContext
Definition: srb.h:897
KMUTEX VideoPortInt10Mutex
Definition: videoprt.c:41
NTSTATUS NTAPI IntVideoPortDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:714
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
PDRIVER_EXTENSION DriverExtension
Definition: iotypes.h:2181
VOID NTAPI IntVideoPortUnload(PDRIVER_OBJECT DriverObject)
Definition: dispatch.c:1171
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
struct _VIDEO_HW_INITIALIZATION_DATA VIDEO_HW_INITIALIZATION_DATA
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
KSPIN_LOCK HwResetAdaptersLock
Definition: videoprt.c:42
NTSTATUS NTAPI IntVideoPortDispatchClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:429
#define TRACE_(x)
Definition: compat.h:76
_In_z_ PWSTR RegistryPath
Definition: classp.h:1930
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA
Definition: video.h:119
NTSTATUS NTAPI IntVideoPortDispatchSystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:1149
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
VOID NTAPI KeInitializeMutex(IN PKMUTEX Mutex, IN ULONG Level)
Definition: mutex.c:67
#define IRP_MJ_POWER
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI IntVideoPortAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
Definition: dispatch.c:334
PDRIVER_UNLOAD DriverUnload
Definition: iotypes.h:2187
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1869
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
#define IRP_MJ_SYSTEM_CONTROL
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT _In_ PTDI_PNP_CONTEXT Context2
Definition: tdikrnl.h:1094
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
PDRIVER_ADD_DEVICE AddDevice
Definition: iotypes.h:2119
ULONG VideoPortDeviceNumber
Definition: videoprt.c:40
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT Context1
Definition: tdikrnl.h:1094
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
NTSTATUS NTAPI IntVideoPortDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:1083
NTSTATUS NTAPI IntVideoPortDispatchOpen(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:366
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2188
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA
Definition: video.h:120
return STATUS_SUCCESS
Definition: btrfs.c:3014
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA * HwInitializationData
Definition: srb.h:897
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52

Referenced by DriverEntry().

◆ VideoPortIsNoVesa()

BOOLEAN NTAPI VideoPortIsNoVesa ( VOID  )

Definition at line 1541 of file videoprt.c.

1542 {
1543  return VpNoVesa;
1544 }
BOOLEAN VpNoVesa
Definition: videoprt.c:37

Referenced by InitializeModeTable(), and VBEFindAdapter().

◆ VideoPortLogError()

VOID NTAPI VideoPortLogError ( IN PVOID  HwDeviceExtension,
IN PVIDEO_REQUEST_PACKET Vrp  OPTIONAL,
IN VP_STATUS  ErrorCode,
IN ULONG  UniqueId 
)

Definition at line 814 of file videoprt.c.

819 {
821 
822  INFO_(VIDEOPRT, "VideoPortLogError ErrorCode %d (0x%x) UniqueId %lu (0x%lx)\n",
823  ErrorCode, ErrorCode, UniqueId, UniqueId);
824  if (Vrp)
825  INFO_(VIDEOPRT, "Vrp->IoControlCode %lu (0x%lx)\n", Vrp->IoControlCode, Vrp->IoControlCode);
826 }
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define INFO_(ch,...)
Definition: debug.h:159
#define UNIMPLEMENTED
Definition: debug.h:115

◆ VideoPortQueryPerformanceCounter()

LONGLONG NTAPI VideoPortQueryPerformanceCounter ( IN PVOID  HwDeviceExtension,
OUT PLONGLONG PerformanceFrequency  OPTIONAL 
)

Definition at line 1460 of file videoprt.c.

1463 {
1465 
1466  TRACE_(VIDEOPRT, "VideoPortQueryPerformanceCounter\n");
1467  Result = KeQueryPerformanceCounter((PLARGE_INTEGER)PerformanceFrequency);
1468  return Result.QuadPart;
1469 }
LARGE_INTEGER NTAPI KeQueryPerformanceCounter(IN PLARGE_INTEGER PerformanceFreq)
Definition: timer.c:138
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define TRACE_(x)
Definition: compat.h:76

◆ VideoPortQueueDpc()

BOOLEAN NTAPI VideoPortQueueDpc ( IN PVOID  HwDeviceExtension,
IN PMINIPORT_DPC_ROUTINE  CallbackRoutine,
IN PVOID  Context 
)

Definition at line 1313 of file videoprt.c.

1317 {
1318  return KeInsertQueueDpc(
1319  &VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension)->DpcObject,
1321  (PVOID)Context);
1322 }
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dpc.c:724
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:137
_Must_inspect_result_ _In_ PFLT_GET_OPERATION_STATUS_CALLBACK CallbackRoutine
Definition: fltkernel.h:1035

◆ VideoPortRegisterBugcheckCallback()

VP_STATUS NTAPI VideoPortRegisterBugcheckCallback ( IN PVOID  HwDeviceExtension,
IN ULONG  BugcheckCode,
IN PVIDEO_BUGCHECK_CALLBACK  Callback,
IN ULONG  BugcheckDataSize 
)

Definition at line 1445 of file videoprt.c.

1450 {
1451  UNIMPLEMENTED;
1452  return NO_ERROR;
1453 }
#define NO_ERROR
Definition: dderror.h:5
#define UNIMPLEMENTED
Definition: debug.h:115

◆ VideoPortReleaseDeviceLock()

VOID NTAPI VideoPortReleaseDeviceLock ( IN PVOID  HwDeviceExtension)

Definition at line 1496 of file videoprt.c.

1498 {
1499  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1500  LONG Status;
1501 
1503 
1504  TRACE_(VIDEOPRT, "VideoPortReleaseDeviceLock\n");
1505  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1506  Status = KeReleaseMutex(&DeviceExtension->DeviceLock, FALSE);
1507  //ASSERT(Status == STATUS_SUCCESS);
1508 }
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:137
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
Definition: mutex.c:189
#define UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:324
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
#define TRACE_(x)
Definition: compat.h:76
Status
Definition: gdiplustypes.h:24

◆ VideoPortScanRom()

BOOLEAN NTAPI VideoPortScanRom ( IN PVOID  HwDeviceExtension,
IN PUCHAR  RomBase,
IN ULONG  RomLength,
IN PUCHAR  String 
)

Definition at line 1042 of file videoprt.c.

1047 {
1048  SIZE_T StringLength;
1049  BOOLEAN Found;
1050  PUCHAR SearchLocation;
1051 
1052  TRACE_(VIDEOPRT, "VideoPortScanRom RomBase %p RomLength 0x%x String %s\n", RomBase, RomLength, String);
1053 
1054  StringLength = strlen((PCHAR)String);
1055  Found = FALSE;
1056  for (SearchLocation = RomBase;
1057  !Found && SearchLocation < RomBase + RomLength - StringLength;
1058  SearchLocation++)
1059  {
1060  Found = (RtlCompareMemory(SearchLocation, String, StringLength) == StringLength);
1061  if (Found)
1062  {
1063  INFO_(VIDEOPRT, "Match found at %p\n", SearchLocation);
1064  }
1065  }
1066 
1067  return Found;
1068 }
signed char * PCHAR
Definition: retypes.h:7
#define INFO_(ch,...)
Definition: debug.h:159
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
unsigned char * PUCHAR
Definition: retypes.h:3
static WCHAR String[]
Definition: stringtable.c:55
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
return Found
Definition: dirsup.c:1270
#define TRACE_(x)
Definition: compat.h:76
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465

◆ VideoPortSetRegistryParameters()

VP_STATUS NTAPI VideoPortSetRegistryParameters ( IN PVOID  HwDeviceExtension,
IN PWSTR  ValueName,
IN PVOID  ValueData,
IN ULONG  ValueLength 
)

Definition at line 925 of file videoprt.c.

930 {
931  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
933 
934  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
935  TRACE_(VIDEOPRT, "VideoPortSetRegistryParameters ParameterName %S, RegPath: %wZ\n",
936  ValueName,
937  &DeviceExtension->RegistryPath);
940  DeviceExtension->RegistryPath.Buffer,
941  ValueName,
942  REG_BINARY,
943  ValueData,
944  ValueLength);
945  if (Status != NO_ERROR)
946  WARN_(VIDEOPRT, "VideoPortSetRegistryParameters error 0x%x\n", Status);
947 
948  return Status;
949 }
#define ASSERT_IRQL_LESS_OR_EQUAL(x)
Definition: debug.h:251
#define REG_BINARY
Definition: nt_native.h:1496
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:137
#define NO_ERROR
Definition: dderror.h:5
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG, PCWSTR, PCWSTR, ULONG, PVOID, ULONG)
#define TRACE_(x)
Definition: compat.h:76
_In_ GUID _In_ PVOID ValueData
Definition: hubbusif.h:311
Status
Definition: gdiplustypes.h:24
_In_ GUID _In_ PVOID _In_ ULONG ValueLength
Definition: hubbusif.h:311
#define RTL_REGISTRY_ABSOLUTE
Definition: nt_native.h:161
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
LONG VP_STATUS
Definition: video.h:153
UNICODE_STRING RegistryPath
Definition: videoprt.h:90
#define WARN_(ch,...)
Definition: debug.h:157

Referenced by Pc98VidFindAdapter(), and VmxFindAdapter().

◆ VideoPortSynchronizeExecution()

BOOLEAN NTAPI VideoPortSynchronizeExecution ( IN PVOID  HwDeviceExtension,
IN VIDEO_SYNCHRONIZE_PRIORITY  Priority,
IN PMINIPORT_SYNCHRONIZE_ROUTINE  SynchronizeRoutine,
OUT PVOID  Context 
)

Definition at line 1075 of file videoprt.c.

1080 {
1081  BOOLEAN Ret;
1082  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1083  KIRQL OldIrql;
1084 
1085  switch (Priority)
1086  {
1087  case VpLowPriority:
1088  Ret = (*SynchronizeRoutine)(Context);
1089  break;
1090 
1091  case VpMediumPriority:
1092  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1093  if (DeviceExtension->InterruptObject == NULL)
1094  Ret = (*SynchronizeRoutine)(Context);
1095  else
1096  Ret = KeSynchronizeExecution(
1097  DeviceExtension->InterruptObject,
1099  Context);
1100  break;
1101 
1102  case VpHighPriority:
1104  if (OldIrql < SYNCH_LEVEL)
1106 
1107  Ret = (*SynchronizeRoutine)(Context);
1108 
1109  if (OldIrql < SYNCH_LEVEL)
1111  break;
1112 
1113  default:
1114  Ret = FALSE;
1115  }
1116 
1117  return Ret;
1118 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
FORCEINLINE _Post_maybenull_ _Must_inspect_result_ _In_ SIZE_T _In_ ULONG _In_ EX_POOL_PRIORITY Priority
Definition: exfuncs.h:700
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:137
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_In_ PKSYNCHRONIZE_ROUTINE SynchronizeRoutine
Definition: kefuncs.h:536
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
#define SYNCH_LEVEL
Definition: env_spec_w32.h:704
struct tagContext Context
Definition: acpixf.h:1034
BOOLEAN NTAPI KeSynchronizeExecution(IN OUT PKINTERRUPT Interrupt, IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, IN PVOID SynchronizeContext OPTIONAL)
Definition: interrupt.c:142

◆ VpNotifyEaData()

VOID NTAPI VpNotifyEaData ( IN PDEVICE_OBJECT  DeviceObject,
IN PVOID  Data 
)

Definition at line 1515 of file videoprt.c.

1518 {
1519  UNIMPLEMENTED;
1520 }
#define UNIMPLEMENTED
Definition: debug.h:115

Variable Documentation

◆ CsrProcess

◆ HwResetAdaptersLock

KSPIN_LOCK HwResetAdaptersLock

◆ VideoDebugLevel

ULONG VideoDebugLevel = 0

Definition at line 34 of file videoprt.c.

Referenced by VideoPortDebugPrint().

◆ VideoPortDeviceNumber

ULONG VideoPortDeviceNumber = 0

◆ VideoPortInt10Mutex

KMUTEX VideoPortInt10Mutex

Definition at line 41 of file videoprt.c.

Referenced by IntInt10CallBios(), and VideoPortInitialize().

◆ VpBaseVideo

BOOLEAN VpBaseVideo = FALSE

Definition at line 36 of file videoprt.c.

Referenced by IntLoadRegistryParameters().

◆ VpNoVesa

BOOLEAN VpNoVesa = FALSE

Definition at line 37 of file videoprt.c.

Referenced by IntLoadRegistryParameters(), and VideoPortIsNoVesa().