[WIN32SS] Add missing code parts for monitor handling

- [VIDEOPRT] Add stub for IOCTL_VIDEO_ENUM_MONITOR_PDO.

- [WIN32SS:ENG] Add missing checks and comments.

- [WIN32SS:NTUSER] Add missing monitor handling and comments.

Addendum to 31827c43. CORE-18197 CORE-11715
This commit is contained in:
Stanislav Motylkov 2022-05-25 00:18:10 +03:00
parent 31827c43b6
commit 26b88af642
No known key found for this signature in database
GPG key ID: AFE513258CBA9E92
3 changed files with 57 additions and 8 deletions

View file

@ -790,6 +790,11 @@ IntVideoPortDispatchDeviceControl(
Status = STATUS_NOT_IMPLEMENTED;
break;
case IOCTL_VIDEO_ENUM_MONITOR_PDO:
WARN_(VIDEOPRT, "- IOCTL_VIDEO_ENUM_MONITOR_PDO is UNIMPLEMENTED!\n");
Status = STATUS_NOT_IMPLEMENTED;
break;
case IOCTL_VIDEO_INIT_WIN32K_CALLBACKS:
INFO_(VIDEOPRT, "- IOCTL_VIDEO_INIT_WIN32K_CALLBACKS\n");
Status = VideoPortInitWin32kCallbacks(DeviceObject,

View file

@ -351,6 +351,19 @@ EngpRegisterGraphicsDevice(
// if (Win32kCallbacks.DualviewFlags & ???)
pGraphicsDevice->PhysDeviceHandle = Win32kCallbacks.pPhysDeviceObject;
/* FIXME: Enumerate children monitor devices for this video adapter
*
* - Force the adapter to re-enumerate its monitors:
* IoSynchronousInvalidateDeviceRelations(pdo, BusRelations)
*
* - Retrieve all monitor PDOs from VideoPrt:
* EngDeviceIoControl(0x%p, IOCTL_VIDEO_ENUM_MONITOR_PDO)
*
* - Initialize these fields and structures accordingly:
* pGraphicsDevice->dwMonCnt
* pGraphicsDevice->pvMonDev[0..dwMonCnt-1]
*/
/* Copy the device name */
RtlStringCbCopyNW(pGraphicsDevice->szNtDeviceName,
sizeof(pGraphicsDevice->szNtDeviceName),
@ -445,7 +458,7 @@ EngpFindGraphicsDevice(
if (pustrDevice && pustrDevice->Buffer)
{
/* Loop through the list of devices */
/* Find specified video adapter by name */
for (pGraphicsDevice = gpGraphicsDeviceFirst;
pGraphicsDevice;
pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice)
@ -457,10 +470,21 @@ EngpFindGraphicsDevice(
break;
}
}
if (pGraphicsDevice)
{
/* Validate selected monitor number */
#if 0
if (iDevNum >= pGraphicsDevice->dwMonCnt)
pGraphicsDevice = NULL;
#else
/* FIXME: dwMonCnt not initialized, see EngpRegisterGraphicsDevice */
#endif
}
}
else
{
/* Loop through the list of devices */
/* Select video adapter by device number */
for (pGraphicsDevice = gpGraphicsDeviceFirst, i = 0;
pGraphicsDevice && i < iDevNum;
pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice, i++);

View file

@ -237,6 +237,7 @@ UserEnumDisplayDevices(
DWORD dwFlags)
{
PGRAPHICS_DEVICE pGraphicsDevice;
PDEVICE_OBJECT pdo;
PWCHAR pHardwareId;
ULONG cbSize, dwLength;
HKEY hkey;
@ -284,9 +285,19 @@ UserEnumDisplayDevices(
pdispdev->DeviceID[0] = UNICODE_NULL;
/* Fill in DeviceID */
if (pGraphicsDevice->PhysDeviceHandle != NULL)
if (!pustrDevice)
pdo = pGraphicsDevice->PhysDeviceHandle;
else
#if 0
pdo = pGraphicsDevice->pvMonDev[iDevNum].pdo;
#else
/* FIXME: pvMonDev not initialized, see EngpRegisterGraphicsDevice */
pdo = NULL;
#endif
if (pdo != NULL)
{
Status = IoGetDeviceProperty(pGraphicsDevice->PhysDeviceHandle,
Status = IoGetDeviceProperty(pdo,
DevicePropertyHardwareID,
0,
NULL,
@ -303,7 +314,7 @@ UserEnumDisplayDevices(
return STATUS_INSUFFICIENT_RESOURCES;
}
Status = IoGetDeviceProperty(pGraphicsDevice->PhysDeviceHandle,
Status = IoGetDeviceProperty(pdo,
DevicePropertyHardwareID,
dwLength,
pHardwareId,
@ -319,10 +330,19 @@ UserEnumDisplayDevices(
* which usually is the longest one and unique enough */
RtlStringCbCopyW(pdispdev->DeviceID, sizeof(pdispdev->DeviceID), pHardwareId);
/* For monitors it should be the first Hardware ID
if (pustrDevice)
{
/* For monitors it should be the first Hardware ID,
* which we already have obtained above,
* concatenated with the unique driver registry key */
/* FIXME: Handle monitors! */
RtlStringCbCatW(pdispdev->DeviceID, sizeof(pdispdev->DeviceID), L"\\");
/* FIXME: DevicePropertyDriverKeyName string should be appended */
pHardwareId[0] = UNICODE_NULL;
RtlStringCbCatW(pdispdev->DeviceID, sizeof(pdispdev->DeviceID), pHardwareId);
}
TRACE("Hardware ID: %ls\n", pdispdev->DeviceID);
}