mirror of
https://github.com/reactos/reactos.git
synced 2025-07-30 15:22:21 +00:00
[WIN32SS:USER] Rework UserEnumDisplayDevices to correctly report monitors
desk.cpl now returns the correct monitor name.
This commit is contained in:
parent
29b5003455
commit
30a7d19d84
1 changed files with 40 additions and 17 deletions
|
@ -245,6 +245,23 @@ UserEnumDisplayDevices(
|
|||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
if (!pustrDevice)
|
||||
{
|
||||
ASSERT(pGraphicsDevice->PhysDeviceHandle);
|
||||
pdo = pGraphicsDevice->PhysDeviceHandle;
|
||||
}
|
||||
else
|
||||
{
|
||||
EngpUpdateMonitorDevices(pGraphicsDevice);
|
||||
if (iDevNum >= pGraphicsDevice->dwMonCnt)
|
||||
{
|
||||
TRACE("No monitor #%u for '%wZ'\n", iDevNum + 1, pustrDevice);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
pdo = pGraphicsDevice->pvMonDev[iDevNum].pdo;
|
||||
}
|
||||
|
||||
|
||||
/* Open the device map registry key */
|
||||
Status = RegOpenKey(KEY_VIDEO, &hkey);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -266,22 +283,32 @@ UserEnumDisplayDevices(
|
|||
ZwClose(hkey);
|
||||
|
||||
/* Copy device name, device string and StateFlags */
|
||||
RtlStringCbCopyW(pdispdev->DeviceName, sizeof(pdispdev->DeviceName), pGraphicsDevice->szWinDeviceName);
|
||||
RtlStringCbCopyW(pdispdev->DeviceString, sizeof(pdispdev->DeviceString), pGraphicsDevice->pwszDescription);
|
||||
pdispdev->StateFlags = pGraphicsDevice->StateFlags;
|
||||
if (!pustrDevice)
|
||||
{
|
||||
RtlStringCbCopyW(pdispdev->DeviceName, sizeof(pdispdev->DeviceName), pGraphicsDevice->szWinDeviceName);
|
||||
RtlStringCbCopyW(pdispdev->DeviceString, sizeof(pdispdev->DeviceString), pGraphicsDevice->pwszDescription);
|
||||
pdispdev->StateFlags = pGraphicsDevice->StateFlags;
|
||||
pdo = pGraphicsDevice->PhysDeviceHandle;
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf(pdispdev->DeviceName, L"%ws\\Monitor%u", pGraphicsDevice->szWinDeviceName, iDevNum);
|
||||
if (pdo)
|
||||
{
|
||||
Status = IoGetDeviceProperty(pdo,
|
||||
DevicePropertyDeviceDescription,
|
||||
sizeof(pdispdev->DeviceString),
|
||||
pdispdev->DeviceString,
|
||||
&dwLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
pdispdev->DeviceString[0] = UNICODE_NULL;
|
||||
}
|
||||
pdispdev->StateFlags = pGraphicsDevice->pvMonDev[iDevNum].flag;
|
||||
pdo = pGraphicsDevice->pvMonDev[iDevNum].pdo;
|
||||
}
|
||||
pdispdev->DeviceID[0] = UNICODE_NULL;
|
||||
|
||||
/* Fill in DeviceID */
|
||||
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(pdo,
|
||||
|
@ -390,10 +417,6 @@ NtUserEnumDisplayDevices(
|
|||
pustrDevice = NULL;
|
||||
}
|
||||
|
||||
/* If name is given only iDevNum==0 gives results */
|
||||
if (pustrDevice && iDevNum != 0)
|
||||
return FALSE;
|
||||
|
||||
/* Acquire global USER lock */
|
||||
UserEnterShared();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue