ReactOS  0.4.15-dev-3203-gacde1e0
child.c File Reference
#include "videoprt.h"
#include <stdio.h>
#include <debug.h>
Include dependency graph for child.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOLEAN NTAPI IntVideoPortGetMonitorId (IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN OUT PWCHAR Buffer)
 
BOOLEAN NTAPI IntVideoPortSearchDescriptor (IN PUCHAR Descriptor, IN UCHAR DescriptorID, OUT PUCHAR *pDescriptorData)
 
BOOLEAN NTAPI IntVideoPortSearchDescriptors (IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN UCHAR DescriptorID, OUT PUCHAR *pDescriptorData)
 
BOOLEAN NTAPI IntVideoPortGetMonitorDescription (IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, OUT PCHAR *pMonitorDescription)
 
NTSTATUS NTAPI IntVideoPortChildQueryId (IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
 
NTSTATUS NTAPI IntVideoPortChildQueryText (IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
 
NTSTATUS NTAPI IntVideoPortChildQueryRelations (IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
 
NTSTATUS NTAPI IntVideoPortChildQueryCapabilities (IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
 
NTSTATUS NTAPI IntVideoPortDispatchPdoPnp (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 25 of file child.c.

Function Documentation

◆ IntVideoPortChildQueryCapabilities()

NTSTATUS NTAPI IntVideoPortChildQueryCapabilities ( IN PVIDEO_PORT_CHILD_EXTENSION  ChildExtension,
IN PIRP  Irp,
IN PIO_STACK_LOCATION  IrpSp 
)

Definition at line 319 of file child.c.

323 {
324  PDEVICE_CAPABILITIES DeviceCaps = IrpSp->Parameters.DeviceCapabilities.Capabilities;
325  ULONG i;
326 
327  /* Set some values */
328  DeviceCaps->LockSupported = FALSE;
329  DeviceCaps->EjectSupported = FALSE;
330  DeviceCaps->DockDevice = FALSE;
331  DeviceCaps->UniqueID = FALSE;
332  DeviceCaps->RawDeviceOK = FALSE;
333  DeviceCaps->WakeFromD0 = FALSE;
334  DeviceCaps->WakeFromD1 = FALSE;
335  DeviceCaps->WakeFromD2 = FALSE;
336  DeviceCaps->WakeFromD3 = FALSE;
337  DeviceCaps->HardwareDisabled = FALSE;
338  DeviceCaps->NoDisplayInUI = FALSE;
339 
340  /* Address and UI number are set by default */
341 
342  DeviceCaps->DeviceState[PowerSystemWorking] = PowerDeviceD0;
343  for (i = 1; i < POWER_SYSTEM_MAXIMUM; i++)
344  {
345  DeviceCaps->DeviceState[i] = PowerDeviceD3;
346  }
347 
348  DeviceCaps->SystemWake = PowerSystemUnspecified;
349  DeviceCaps->DeviceWake = PowerDeviceUnspecified;
350 
351  /* FIXME: Device power states */
352  DeviceCaps->DeviceD1 = FALSE;
353  DeviceCaps->DeviceD2 = FALSE;
354  DeviceCaps->D1Latency = 0;
355  DeviceCaps->D2Latency = 0;
356  DeviceCaps->D3Latency = 0;
357 
358  switch (ChildExtension->ChildType)
359  {
360  case VideoChip:
361  /* FIXME: Copy capabilities from parent */
362  ASSERT(FALSE);
363  break;
364 
365  case NonPrimaryChip: /* Reserved */
366  ASSERT(FALSE);
367  break;
368 
369  case Monitor:
370  DeviceCaps->SilentInstall = TRUE;
371  DeviceCaps->Removable = TRUE;
372  DeviceCaps->SurpriseRemovalOK = TRUE;
373  break;
374 
375  default: /* Other */
376  DeviceCaps->SilentInstall = FALSE;
377  DeviceCaps->Removable = FALSE;
378  DeviceCaps->SurpriseRemovalOK = FALSE;
379  break;
380  }
381 
382  return STATUS_SUCCESS;
383 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ASSERT(a)
Definition: mode.c:44
* PDEVICE_CAPABILITIES
Definition: iotypes.h:965
Definition: video.h:270
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
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
#define POWER_SYSTEM_MAXIMUM
Definition: ntpoapi.h:45

Referenced by IntVideoPortDispatchPdoPnp().

◆ IntVideoPortChildQueryId()

NTSTATUS NTAPI IntVideoPortChildQueryId ( IN PVIDEO_PORT_CHILD_EXTENSION  ChildExtension,
IN PIRP  Irp,
IN PIO_STACK_LOCATION  IrpSp 
)

Definition at line 117 of file child.c.

121 {
122  PWCHAR Buffer = NULL, StaticBuffer;
123  UNICODE_STRING UnicodeStr;
124 
125  switch (IrpSp->Parameters.QueryId.IdType)
126  {
127  case BusQueryDeviceID:
128  switch (ChildExtension->ChildType)
129  {
130  case Monitor:
131  if (ChildExtension->EdidValid)
132  {
133  StaticBuffer = L"DISPLAY\\";
134  Buffer = ExAllocatePool(PagedPool, (wcslen(StaticBuffer) + 8) * sizeof(WCHAR));
135  if (!Buffer) return STATUS_NO_MEMORY;
136 
137  /* Write the static portion */
138  RtlCopyMemory(Buffer, StaticBuffer, wcslen(StaticBuffer) * sizeof(WCHAR));
139 
140  /* Add the dynamic portion */
141  IntVideoPortGetMonitorId(ChildExtension,
142  &Buffer[wcslen(StaticBuffer)]);
143  }
144  else
145  {
146  StaticBuffer = L"DISPLAY\\Default_Monitor";
147  Buffer = ExAllocatePool(PagedPool, (wcslen(StaticBuffer) + 1) * sizeof(WCHAR));
148  if (!Buffer) return STATUS_NO_MEMORY;
149 
150  /* Copy the default id */
151  RtlCopyMemory(Buffer, StaticBuffer, (wcslen(StaticBuffer) + 1) * sizeof(WCHAR));
152  }
153  break;
154  default:
155  ASSERT(FALSE);
156  break;
157  }
158  break;
159  case BusQueryInstanceID:
160  Buffer = ExAllocatePool(PagedPool, 5 * sizeof(WCHAR));
161  if (!Buffer) return STATUS_NO_MEMORY;
162 
163  UnicodeStr.Buffer = Buffer;
164  UnicodeStr.Length = 0;
165  UnicodeStr.MaximumLength = 4 * sizeof(WCHAR);
166  RtlIntegerToUnicodeString(ChildExtension->ChildId, 16, &UnicodeStr);
167  break;
168  case BusQueryHardwareIDs:
169  switch (ChildExtension->ChildType)
170  {
171  case Monitor:
172  if (ChildExtension->EdidValid)
173  {
174  StaticBuffer = L"MONITOR\\";
175  Buffer = ExAllocatePool(PagedPool, (wcslen(StaticBuffer) + 9) * sizeof(WCHAR));
176  if (!Buffer) return STATUS_NO_MEMORY;
177 
178  /* Write the static portion */
179  RtlCopyMemory(Buffer, StaticBuffer, wcslen(StaticBuffer) * sizeof(WCHAR));
180 
181  /* Add the dynamic portion */
182  IntVideoPortGetMonitorId(ChildExtension,
183  &Buffer[wcslen(StaticBuffer)]);
184 
185  /* Add the second null termination char */
186  Buffer[wcslen(StaticBuffer) + 8] = UNICODE_NULL;
187  }
188  else
189  {
190  StaticBuffer = L"MONITOR\\Default_Monitor";
191  Buffer = ExAllocatePool(PagedPool, (wcslen(StaticBuffer) + 2) * sizeof(WCHAR));
192  if (!Buffer) return STATUS_NO_MEMORY;
193 
194  /* Copy the default id */
195  RtlCopyMemory(Buffer, StaticBuffer, (wcslen(StaticBuffer) + 1) * sizeof(WCHAR));
196 
197  /* Add the second null terminator */
198  Buffer[wcslen(StaticBuffer) + 1] = UNICODE_NULL;
199  }
200  break;
201  default:
202  ASSERT(FALSE);
203  break;
204  }
205  break;
207  switch (ChildExtension->ChildType)
208  {
209  case Monitor:
210  if (ChildExtension->EdidValid)
211  {
212  StaticBuffer = L"*PNP09FF";
213  Buffer = ExAllocatePool(PagedPool, (wcslen(StaticBuffer) + 2) * sizeof(WCHAR));
214  if (!Buffer) return STATUS_NO_MEMORY;
215 
216  RtlCopyMemory(Buffer, StaticBuffer, (wcslen(StaticBuffer) + 1) * sizeof(WCHAR));
217 
218  Buffer[wcslen(StaticBuffer)+1] = UNICODE_NULL;
219  }
220  else
221  {
222  /* No PNP ID for non-PnP monitors */
223  return Irp->IoStatus.Status;
224  }
225  break;
226  default:
227  ASSERT(FALSE);
228  break;
229  }
230  break;
231  default:
232  return Irp->IoStatus.Status;
233  }
234 
235  INFO_(VIDEOPRT, "Reporting ID: %S\n", Buffer);
236  Irp->IoStatus.Information = (ULONG_PTR)Buffer;
237 
238  return STATUS_SUCCESS;
239 }
#define INFO_(ch,...)
Definition: debug.h:159
USHORT MaximumLength
Definition: env_spec_w32.h:370
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
uint16_t * PWCHAR
Definition: typedefs.h:56
BOOLEAN NTAPI IntVideoPortGetMonitorId(IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN OUT PWCHAR Buffer)
Definition: child.c:32
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
_In_ PIRP Irp
Definition: csq.h:116
Definition: bufpool.h:45
NTSYSAPI NTSTATUS NTAPI RtlIntegerToUnicodeString(ULONG Value, ULONG Base, PUNICODE_STRING String)
#define ASSERT(a)
Definition: mode.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR L[]
Definition: oid.c:1250
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
Definition: video.h:270
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define ULONG_PTR
Definition: config.h:101
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_SUCCESS
Definition: shellext.h:65
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128

Referenced by IntVideoPortDispatchPdoPnp().

◆ IntVideoPortChildQueryRelations()

NTSTATUS NTAPI IntVideoPortChildQueryRelations ( IN PVIDEO_PORT_CHILD_EXTENSION  ChildExtension,
IN PIRP  Irp,
IN PIO_STACK_LOCATION  IrpSp 
)

Definition at line 292 of file child.c.

296 {
297  PDEVICE_RELATIONS DeviceRelations;
298 
299  if (IrpSp->Parameters.QueryDeviceRelations.Type != TargetDeviceRelation)
300  {
301  WARN_(VIDEOPRT, "Unsupported device relations type\n");
302  return Irp->IoStatus.Status;
303  }
304 
305  DeviceRelations = ExAllocatePool(NonPagedPool, sizeof(DEVICE_RELATIONS));
306  if (!DeviceRelations) return STATUS_NO_MEMORY;
307 
308  DeviceRelations->Count = 1;
309  DeviceRelations->Objects[0] = ChildExtension->PhysicalDeviceObject;
310 
311  ObReferenceObject(DeviceRelations->Objects[0]);
312 
313  Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
314 
315  return STATUS_SUCCESS;
316 }
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2163
_In_ PIRP Irp
Definition: csq.h:116
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define ObReferenceObject
Definition: obfuncs.h:204
#define ULONG_PTR
Definition: config.h:101
#define STATUS_SUCCESS
Definition: shellext.h:65
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
#define WARN_(ch,...)
Definition: debug.h:157

Referenced by IntVideoPortDispatchPdoPnp().

◆ IntVideoPortChildQueryText()

NTSTATUS NTAPI IntVideoPortChildQueryText ( IN PVIDEO_PORT_CHILD_EXTENSION  ChildExtension,
IN PIRP  Irp,
IN PIO_STACK_LOCATION  IrpSp 
)

Definition at line 242 of file child.c.

246 {
247  ANSI_STRING StringA;
248  UNICODE_STRING StringU;
250 
251  if (IrpSp->Parameters.QueryDeviceText.DeviceTextType != DeviceTextDescription)
252  return Irp->IoStatus.Status;
253 
254  switch (ChildExtension->ChildType)
255  {
256  case Monitor:
257  if (IntVideoPortGetMonitorDescription(ChildExtension,
258  &StringA.Buffer))
259  {
260  StringA.Buffer++; /* Skip reserved byte */
261  StringA.MaximumLength = 13;
262  for (StringA.Length = 0;
263  StringA.Length < StringA.MaximumLength && StringA.Buffer[StringA.Length] != '\n';
264  StringA.Length++)
265  ;
266  }
267  else
268  RtlInitAnsiString(&StringA, "Monitor");
269  break;
270 
271  case VideoChip:
272  /* FIXME: No idea what we return here */
273  RtlInitAnsiString(&StringA, "Video chip");
274  break;
275 
276  default: /* Other */
277  RtlInitAnsiString(&StringA, "Other device");
278  break;
279  }
280 
281  Status = RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
282  if (!NT_SUCCESS(Status))
283  return Status;
284 
285  INFO_(VIDEOPRT, "Reporting description: %S\n", StringU.Buffer);
286  Irp->IoStatus.Information = (ULONG_PTR)StringU.Buffer;
287 
288  return STATUS_SUCCESS;
289 }
#define INFO_(ch,...)
Definition: debug.h:159
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
_In_ PIRP Irp
Definition: csq.h:116
Status
Definition: gdiplustypes.h:24
USHORT MaximumLength
Definition: env_spec_w32.h:377
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
BOOLEAN NTAPI IntVideoPortGetMonitorDescription(IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, OUT PCHAR *pMonitorDescription)
Definition: child.c:103
Definition: video.h:270
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define ULONG_PTR
Definition: config.h:101
#define STATUS_SUCCESS
Definition: shellext.h:65
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128

Referenced by IntVideoPortDispatchPdoPnp().

◆ IntVideoPortDispatchPdoPnp()

NTSTATUS NTAPI IntVideoPortDispatchPdoPnp ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 386 of file child.c.

389 {
391  NTSTATUS Status = Irp->IoStatus.Status;
392 
394 
395  switch (IrpSp->MinorFunction)
396  {
397  case IRP_MN_START_DEVICE:
398  case IRP_MN_STOP_DEVICE:
399  /* Nothing to do */
401  break;
402 
405  /* None (keep old status) */
406  break;
407 
408  case IRP_MN_QUERY_ID:
409  /* Call our helper */
410  Status = IntVideoPortChildQueryId(DeviceObject->DeviceExtension,
411  Irp,
412  IrpSp);
413  break;
414 
416  /* Call our helper */
418  Irp,
419  IrpSp);
420  break;
421 
425  break;
426 
428  Irp->IoStatus.Status = STATUS_SUCCESS;
431  return STATUS_SUCCESS;
432 
434  /* Call our helper */
436  Irp,
437  IrpSp);
438  break;
439 
441  /* Call our helper */
443  Irp,
444  IrpSp);
445  break;
446 
447  default:
448  break;
449  }
450 
451  Irp->IoStatus.Status = Status;
452 
454 
455  return Status;
456 }
#define IRP_MN_QUERY_RESOURCES
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_ID
NTSTATUS NTAPI IntVideoPortChildQueryCapabilities(IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
Definition: child.c:319
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
LONG NTSTATUS
Definition: precomp.h:26
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MN_QUERY_REMOVE_DEVICE
#define IoCompleteRequest
Definition: irp.c:1240
Status
Definition: gdiplustypes.h:24
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IRP_MN_STOP_DEVICE
#define IRP_MN_START_DEVICE
#define IRP_MN_QUERY_DEVICE_TEXT
NTSTATUS NTAPI IntVideoPortChildQueryRelations(IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
Definition: child.c:292
NTSTATUS NTAPI IntVideoPortChildQueryText(IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
Definition: child.c:242
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define IRP_MN_QUERY_DEVICE_RELATIONS
NTSTATUS NTAPI IntVideoPortChildQueryId(IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
Definition: child.c:117
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define STATUS_SUCCESS
Definition: shellext.h:65
#define IRP_MN_QUERY_CAPABILITIES

Referenced by IntVideoPortDispatchPnp().

◆ IntVideoPortGetMonitorDescription()

BOOLEAN NTAPI IntVideoPortGetMonitorDescription ( IN PVIDEO_PORT_CHILD_EXTENSION  ChildExtension,
OUT PCHAR pMonitorDescription 
)

Definition at line 103 of file child.c.

106 {
107  PUCHAR MonitorDescription;
108 
109  if (!IntVideoPortSearchDescriptors(ChildExtension, 0xFC, &MonitorDescription))
110  return FALSE;
111 
112  *pMonitorDescription = (PCHAR)MonitorDescription;
113  return TRUE;
114 }
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
BOOLEAN NTAPI IntVideoPortSearchDescriptors(IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN UCHAR DescriptorID, OUT PUCHAR *pDescriptorData)
Definition: child.c:80
#define FALSE
Definition: types.h:117
#define PCHAR
Definition: match.c:90

Referenced by IntVideoPortChildQueryText().

◆ IntVideoPortGetMonitorId()

BOOLEAN NTAPI IntVideoPortGetMonitorId ( IN PVIDEO_PORT_CHILD_EXTENSION  ChildExtension,
IN OUT PWCHAR  Buffer 
)

Definition at line 32 of file child.c.

35 {
36  USHORT Manufacturer, Model;
37 
38  /* This must be valid to call this function */
39  ASSERT(ChildExtension->EdidValid);
40 
41  /* 3 letters 5-bit ANSI manufacturer code (big endian) */
42  /* Letters encoded as A=1 to Z=26 */
43  Manufacturer = ((USHORT)ChildExtension->ChildDescriptor[8] << 8) +
44  (USHORT)ChildExtension->ChildDescriptor[9];
45 
46  /* Model number (16-bit little endian) */
47  Model = ((USHORT)ChildExtension->ChildDescriptor[11] << 8) +
48  (USHORT)ChildExtension->ChildDescriptor[10];
49 
50  /* Convert the Monitor ID to a readable form */
52  L"%C%C%C%04hx",
53  (WCHAR)((Manufacturer >> 10 & 0x001F) + 'A' - 1),
54  (WCHAR)((Manufacturer >> 5 & 0x001F) + 'A' - 1),
55  (WCHAR)((Manufacturer & 0x001F) + 'A' - 1),
56  Model);
57 
58  /* And we're done */
59  return TRUE;
60 }
#define TRUE
Definition: types.h:120
#define swprintf
Definition: precomp.h:40
Definition: bufpool.h:45
#define ASSERT(a)
Definition: mode.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR L[]
Definition: oid.c:1250
unsigned short USHORT
Definition: pedump.c:61

Referenced by IntVideoPortChildQueryId().

◆ IntVideoPortSearchDescriptor()

BOOLEAN NTAPI IntVideoPortSearchDescriptor ( IN PUCHAR  Descriptor,
IN UCHAR  DescriptorID,
OUT PUCHAR pDescriptorData 
)

Definition at line 64 of file child.c.

68 {
69  if (Descriptor[0] != 0 || Descriptor[1] != 0 || Descriptor[2] != 0)
70  return FALSE;
71  if (Descriptor[3] != DescriptorID)
72  return FALSE;
73 
74  *pDescriptorData = Descriptor + 4;
75  return TRUE;
76 }
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117

Referenced by IntVideoPortSearchDescriptors().

◆ IntVideoPortSearchDescriptors()

BOOLEAN NTAPI IntVideoPortSearchDescriptors ( IN PVIDEO_PORT_CHILD_EXTENSION  ChildExtension,
IN UCHAR  DescriptorID,
OUT PUCHAR pDescriptorData 
)

Definition at line 80 of file child.c.

84 {
85  if (!ChildExtension->EdidValid)
86  return FALSE;
87 
88  if (IntVideoPortSearchDescriptor(ChildExtension->ChildDescriptor + 0x36, DescriptorID, pDescriptorData))
89  return TRUE;
90  if (IntVideoPortSearchDescriptor(ChildExtension->ChildDescriptor + 0x48, DescriptorID, pDescriptorData))
91  return TRUE;
92  if (IntVideoPortSearchDescriptor(ChildExtension->ChildDescriptor + 0x5A, DescriptorID, pDescriptorData))
93  return TRUE;
94  if (IntVideoPortSearchDescriptor(ChildExtension->ChildDescriptor + 0x6C, DescriptorID, pDescriptorData))
95  return TRUE;
96 
97  /* FIXME: search in extension? */
98  return FALSE;
99 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOLEAN NTAPI IntVideoPortSearchDescriptor(IN PUCHAR Descriptor, IN UCHAR DescriptorID, OUT PUCHAR *pDescriptorData)
Definition: child.c:64

Referenced by IntVideoPortGetMonitorDescription().