ReactOS 0.4.16-dev-1067-ge98bba2
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 337 of file child.c.

341{
342 PDEVICE_CAPABILITIES DeviceCaps = IrpSp->Parameters.DeviceCapabilities.Capabilities;
343 ULONG i;
344
345 /* Set some values */
346 DeviceCaps->LockSupported = FALSE;
347 DeviceCaps->EjectSupported = FALSE;
348 DeviceCaps->DockDevice = FALSE;
349 DeviceCaps->UniqueID = FALSE;
350 DeviceCaps->RawDeviceOK = FALSE;
351 DeviceCaps->WakeFromD0 = FALSE;
352 DeviceCaps->WakeFromD1 = FALSE;
353 DeviceCaps->WakeFromD2 = FALSE;
354 DeviceCaps->WakeFromD3 = FALSE;
355 DeviceCaps->HardwareDisabled = FALSE;
356 DeviceCaps->NoDisplayInUI = FALSE;
357
358 /* Address and UI number are set by default */
359
360 DeviceCaps->DeviceState[PowerSystemWorking] = PowerDeviceD0;
361 for (i = 1; i < POWER_SYSTEM_MAXIMUM; i++)
362 {
363 DeviceCaps->DeviceState[i] = PowerDeviceD3;
364 }
365
366 DeviceCaps->SystemWake = PowerSystemUnspecified;
367 DeviceCaps->DeviceWake = PowerDeviceUnspecified;
368
369 /* FIXME: Device power states */
370 DeviceCaps->DeviceD1 = FALSE;
371 DeviceCaps->DeviceD2 = FALSE;
372 DeviceCaps->D1Latency = 0;
373 DeviceCaps->D2Latency = 0;
374 DeviceCaps->D3Latency = 0;
375
376 switch (ChildExtension->ChildType)
377 {
378 case VideoChip:
379 /* FIXME: Copy capabilities from parent */
380 ASSERT(FALSE);
381 break;
382
383 case NonPrimaryChip: /* Reserved */
384 ASSERT(FALSE);
385 break;
386
387 case Monitor:
388 DeviceCaps->SilentInstall = TRUE;
389 DeviceCaps->Removable = TRUE;
390 DeviceCaps->SurpriseRemovalOK = TRUE;
391 break;
392
393 default: /* Other */
394 DeviceCaps->SilentInstall = FALSE;
395 DeviceCaps->Removable = FALSE;
396 DeviceCaps->SurpriseRemovalOK = FALSE;
397 break;
398 }
399
400 return STATUS_SUCCESS;
401}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4138
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 ASSERT(a)
Definition: mode.c:44
#define POWER_SYSTEM_MAXIMUM
Definition: ntpoapi.h:45
@ PowerSystemUnspecified
Definition: ntpoapi.h:35
@ PowerSystemWorking
Definition: ntpoapi.h:36
@ PowerDeviceUnspecified
Definition: ntpoapi.h:48
@ PowerDeviceD0
Definition: ntpoapi.h:49
@ PowerDeviceD3
Definition: ntpoapi.h:52
@ Monitor
Definition: video.h:270
@ VideoChip
Definition: video.h:272
@ NonPrimaryChip
Definition: video.h:271
#define STATUS_SUCCESS
Definition: shellext.h:65
union _IO_STACK_LOCATION::@1619 Parameters
struct _IO_STACK_LOCATION::@4106::@4133 DeviceCapabilities
uint32_t ULONG
Definition: typedefs.h:59
* PDEVICE_CAPABILITIES
Definition: iotypes.h:965

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 HANDLE hKey;
126
127 switch (IrpSp->Parameters.QueryId.IdType)
128 {
129 case BusQueryDeviceID:
130 switch (ChildExtension->ChildType)
131 {
132 case Monitor:
133 if (ChildExtension->EdidValid)
134 {
135 StaticBuffer = L"DISPLAY\\";
136 Buffer = ExAllocatePool(PagedPool, (wcslen(StaticBuffer) + 8) * sizeof(WCHAR));
137 if (!Buffer) return STATUS_NO_MEMORY;
138
139 /* Write the static portion */
140 RtlCopyMemory(Buffer, StaticBuffer, wcslen(StaticBuffer) * sizeof(WCHAR));
141
142 /* Add the dynamic portion */
143 IntVideoPortGetMonitorId(ChildExtension,
144 &Buffer[wcslen(StaticBuffer)]);
145 }
146 else
147 {
148 StaticBuffer = L"DISPLAY\\Default_Monitor";
149 Buffer = ExAllocatePool(PagedPool, (wcslen(StaticBuffer) + 1) * sizeof(WCHAR));
150 if (!Buffer) return STATUS_NO_MEMORY;
151
152 /* Copy the default id */
153 RtlCopyMemory(Buffer, StaticBuffer, (wcslen(StaticBuffer) + 1) * sizeof(WCHAR));
154 }
155 break;
156 default:
157 ASSERT(FALSE);
158 break;
159 }
160 break;
162 Buffer = ExAllocatePool(PagedPool, 5 * sizeof(WCHAR));
163 if (!Buffer) return STATUS_NO_MEMORY;
164
165 UnicodeStr.Buffer = Buffer;
166 UnicodeStr.Length = 0;
167 UnicodeStr.MaximumLength = 4 * sizeof(WCHAR);
168 RtlIntegerToUnicodeString(ChildExtension->ChildId, 16, &UnicodeStr);
169 break;
171 switch (ChildExtension->ChildType)
172 {
173 case Monitor:
174 if (ChildExtension->EdidValid)
175 {
176 StaticBuffer = L"MONITOR\\";
177 Buffer = ExAllocatePool(PagedPool, (wcslen(StaticBuffer) + 9) * sizeof(WCHAR));
178 if (!Buffer) return STATUS_NO_MEMORY;
179
180 /* Write the static portion */
181 RtlCopyMemory(Buffer, StaticBuffer, wcslen(StaticBuffer) * sizeof(WCHAR));
182
183 /* Add the dynamic portion */
184 IntVideoPortGetMonitorId(ChildExtension,
185 &Buffer[wcslen(StaticBuffer)]);
186
187 /* Add the second null termination char */
188 Buffer[wcslen(StaticBuffer) + 8] = UNICODE_NULL;
189 }
190 else
191 {
192 StaticBuffer = L"MONITOR\\Default_Monitor";
193 Buffer = ExAllocatePool(PagedPool, (wcslen(StaticBuffer) + 2) * sizeof(WCHAR));
194 if (!Buffer) return STATUS_NO_MEMORY;
195
196 /* Copy the default id */
197 RtlCopyMemory(Buffer, StaticBuffer, (wcslen(StaticBuffer) + 1) * sizeof(WCHAR));
198
199 /* Add the second null terminator */
200 Buffer[wcslen(StaticBuffer) + 1] = UNICODE_NULL;
201 }
202
203 /* Try to write EDID to registry (ignore errors) */
204 Status = IoOpenDeviceRegistryKey(ChildExtension->PhysicalDeviceObject,
207 &hKey);
208 if (NT_SUCCESS(Status))
209 {
211 hKey,
212 ChildExtension->EdidValid ? L"EDID" : L"BAD_EDID",
214 ChildExtension->ChildDescriptor,
215 sizeof(ChildExtension->ChildDescriptor));
216 ZwClose(hKey);
217 }
218 break;
219 default:
220 ASSERT(FALSE);
221 break;
222 }
223 break;
225 switch (ChildExtension->ChildType)
226 {
227 case Monitor:
228 if (ChildExtension->EdidValid)
229 {
230 StaticBuffer = L"*PNP09FF";
231 Buffer = ExAllocatePool(PagedPool, (wcslen(StaticBuffer) + 2) * sizeof(WCHAR));
232 if (!Buffer) return STATUS_NO_MEMORY;
233
234 RtlCopyMemory(Buffer, StaticBuffer, (wcslen(StaticBuffer) + 1) * sizeof(WCHAR));
235
236 Buffer[wcslen(StaticBuffer)+1] = UNICODE_NULL;
237 }
238 else
239 {
240 /* No PNP ID for non-PnP monitors */
241 return Irp->IoStatus.Status;
242 }
243 break;
244 default:
245 ASSERT(FALSE);
246 break;
247 }
248 break;
249 default:
250 return Irp->IoStatus.Status;
251 }
252
253 INFO_(VIDEOPRT, "Reporting ID: %S\n", Buffer);
254 Irp->IoStatus.Information = (ULONG_PTR)Buffer;
255
256 return STATUS_SUCCESS;
257}
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI IntVideoPortGetMonitorId(IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN OUT PWCHAR Buffer)
Definition: child.c:32
Definition: bufpool.h:45
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define ULONG_PTR
Definition: config.h:101
#define PagedPool
Definition: env_spec_w32.h:308
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
FxAutoRegKey hKey
Status
Definition: gdiplustypes.h:25
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG, PCWSTR, PCWSTR, ULONG, PVOID, ULONG)
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define REG_BINARY
Definition: nt_native.h:1496
NTSYSAPI NTSTATUS NTAPI RtlIntegerToUnicodeString(ULONG Value, ULONG Base, PUNICODE_STRING String)
#define RTL_REGISTRY_HANDLE
Definition: nt_native.h:168
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define UNICODE_NULL
#define L(x)
Definition: ntvdm.h:50
NTSTATUS NTAPI IoOpenDeviceRegistryKey(IN PDEVICE_OBJECT DeviceObject, IN ULONG DevInstKeyType, IN ACCESS_MASK DesiredAccess, OUT PHANDLE DevInstRegKey)
Definition: pnpmgr.c:1621
#define INFO_(ch,...)
Definition: debug.h:159
struct _IO_STACK_LOCATION::@4106::@4137 QueryId
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint16_t * PWCHAR
Definition: typedefs.h:56
#define PLUGPLAY_REGKEY_DEVICE
Definition: iofuncs.h:2786
@ BusQueryCompatibleIDs
Definition: iotypes.h:2938
@ BusQueryInstanceID
Definition: iotypes.h:2939
@ BusQueryDeviceID
Definition: iotypes.h:2936
@ BusQueryHardwareIDs
Definition: iotypes.h:2937
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by IntVideoPortDispatchPdoPnp().

◆ IntVideoPortChildQueryRelations()

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

Definition at line 310 of file child.c.

314{
315 PDEVICE_RELATIONS DeviceRelations;
316
318 {
319 WARN_(VIDEOPRT, "Unsupported device relations type\n");
320 return Irp->IoStatus.Status;
321 }
322
323 DeviceRelations = ExAllocatePool(NonPagedPool, sizeof(DEVICE_RELATIONS));
324 if (!DeviceRelations) return STATUS_NO_MEMORY;
325
326 DeviceRelations->Count = 1;
327 DeviceRelations->Objects[0] = ChildExtension->PhysicalDeviceObject;
328
329 ObReferenceObject(DeviceRelations->Objects[0]);
330
331 Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
332
333 return STATUS_SUCCESS;
334}
#define NonPagedPool
Definition: env_spec_w32.h:307
#define WARN_(ch,...)
Definition: debug.h:157
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2163
struct _IO_STACK_LOCATION::@4106::@4131 QueryDeviceRelations
@ TargetDeviceRelation
Definition: iotypes.h:2156
#define ObReferenceObject
Definition: obfuncs.h:204

Referenced by IntVideoPortDispatchPdoPnp().

◆ IntVideoPortChildQueryText()

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

Definition at line 260 of file child.c.

264{
265 ANSI_STRING StringA;
266 UNICODE_STRING StringU;
268
270 return Irp->IoStatus.Status;
271
272 switch (ChildExtension->ChildType)
273 {
274 case Monitor:
275 if (IntVideoPortGetMonitorDescription(ChildExtension,
276 &StringA.Buffer))
277 {
278 StringA.Buffer++; /* Skip reserved byte */
279 StringA.MaximumLength = 13;
280 for (StringA.Length = 0;
281 StringA.Length < StringA.MaximumLength && StringA.Buffer[StringA.Length] != '\n';
282 StringA.Length++)
283 ;
284 }
285 else
286 RtlInitAnsiString(&StringA, "Monitor");
287 break;
288
289 case VideoChip:
290 /* FIXME: No idea what we return here */
291 RtlInitAnsiString(&StringA, "Video chip");
292 break;
293
294 default: /* Other */
295 RtlInitAnsiString(&StringA, "Other device");
296 break;
297 }
298
299 Status = RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
300 if (!NT_SUCCESS(Status))
301 return Status;
302
303 INFO_(VIDEOPRT, "Reporting description: %S\n", StringU.Buffer);
304 Irp->IoStatus.Information = (ULONG_PTR)StringU.Buffer;
305
306 return STATUS_SUCCESS;
307}
BOOLEAN NTAPI IntVideoPortGetMonitorDescription(IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, OUT PCHAR *pMonitorDescription)
Definition: child.c:103
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
USHORT MaximumLength
Definition: env_spec_w32.h:377
struct _IO_STACK_LOCATION::@4106::@4138 QueryDeviceText
@ DeviceTextDescription
Definition: iotypes.h:2945

Referenced by IntVideoPortDispatchPdoPnp().

◆ IntVideoPortDispatchPdoPnp()

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

Definition at line 404 of file child.c.

407{
409 NTSTATUS Status = Irp->IoStatus.Status;
410
412
413 switch (IrpSp->MinorFunction)
414 {
417 /* Nothing to do */
419 break;
420
423 /* None (keep old status) */
424 break;
425
426 case IRP_MN_QUERY_ID:
427 /* Call our helper */
429 Irp,
430 IrpSp);
431 break;
432
434 /* Call our helper */
436 Irp,
437 IrpSp);
438 break;
439
443 break;
444
446 Irp->IoStatus.Status = STATUS_SUCCESS;
449 return STATUS_SUCCESS;
450
452 /* Call our helper */
454 Irp,
455 IrpSp);
456 break;
457
459 /* Call our helper */
461 Irp,
462 IrpSp);
463 break;
464
465 default:
466 break;
467 }
468
469 Irp->IoStatus.Status = Status;
470
472
473 return Status;
474}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
NTSTATUS NTAPI IntVideoPortChildQueryId(IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
Definition: child.c:117
NTSTATUS NTAPI IntVideoPortChildQueryRelations(IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
Definition: child.c:310
NTSTATUS NTAPI IntVideoPortChildQueryCapabilities(IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
Definition: child.c:337
NTSTATUS NTAPI IntVideoPortChildQueryText(IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp)
Definition: child.c:260
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define IoCompleteRequest
Definition: irp.c:1240
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_START_DEVICE
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_ID
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IRP_MN_QUERY_DEVICE_TEXT
#define IRP_MN_QUERY_CAPABILITIES
#define IRP_MN_QUERY_RESOURCES
#define IRP_MN_STOP_DEVICE
#define IRP_MN_QUERY_REMOVE_DEVICE

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}
BOOLEAN NTAPI IntVideoPortSearchDescriptors(IN PVIDEO_PORT_CHILD_EXTENSION ChildExtension, IN UCHAR DescriptorID, OUT PUCHAR *pDescriptorData)
Definition: child.c:80
#define PCHAR
Definition: match.c:90
unsigned char * PUCHAR
Definition: typedefs.h:53

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 swprintf
Definition: precomp.h:40
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:342

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}
BOOLEAN NTAPI IntVideoPortSearchDescriptor(IN PUCHAR Descriptor, IN UCHAR DescriptorID, OUT PUCHAR *pDescriptorData)
Definition: child.c:64

Referenced by IntVideoPortGetMonitorDescription().